May 19, 2021 WeChat Mini Program Development Document
In-screen advertising components. A n on-screen advertising component is a native component that is higher than a normal component. Each time an on-screen ad component is created, a brand new instance is returned (screened ad instances on the small terminal are not allowed across pages), which is hidden by default and needs to be displayed by calling InterstitialAd.show().
Base library 2.8.0 starts to support, and low versions need to be compatible.
Destroy in-screen ad instances.
Base library 2.8.0 starts to support, and low versions need to be compatible.
Load in-screen ads.
The result of the on-screen ad loading data
Cancel listening to on-screen ad close events
The callback function for the screen ad close event
Cancel the listening intersting error event
The callback function for the screen error event
Cancel listening for on-screen ad load events
The callback function for the on-screen ad load event
Listen for on-screen ad close events.
The callback function for the screen ad close event
Listen for on-screen error events.
The callback function for the screen error event
Property | Type | Description |
---|---|---|
errMsg | string | The error message |
errCode | number | Error code |
The legal value of errCode
Value | Description | The lowest version |
---|---|---|
1000 | The back-end interface call failed | |
1001 | The argument is wrong | |
1002 | The ad unit is not valid | |
1003 | Internal error | |
1004 | No suitable ads | |
1005 | Ad component review | |
1006 | The ad component was rejected | |
1007 | The ad component is blocked | |
1008 | The ad unit is turned off |
The error code is an error message obtained through onError. D uring debugging, you can capture information by returning exceptions. After the small program is released online, if you encounter an exception problem, you can search for error logs in the Operations Center, and you can also add appropriate monitoring information to the exception return.
Code | Abnormal condition | Reason | Solution |
---|---|---|---|
1000 | The back-end error call failed | This error is not an exception for the developer | In general, you can recover by ignoring it for a period of time. |
1001 | The argument is wrong | The method used is wrong | You can go developers.weixin.qq.com to confirm specific tutorials (small programs and games have their own tutorials) and you can switch between the top options, to the right of the Design column. |
1002 | The ad unit is not valid | It could be a misspelling or a misuse of another APP's ad ID | Please go back to mp.weixin.qq.com confirm your ad bit ID. |
1003 | Internal error | This error is not an exception for the developer | In general, you can recover by ignoring it for a period of time. |
1004 | No suitable ads | Ads don't appear every time, and this time they don't appear because the user isn't suitable for viewing ads | This is normal, and developers need to be morphologically compatible with this situation. |
1005 | Ad component review | Your ad is being reviewed and can't show it | Please go to mp.weixin.qq.com to confirm the status of the audit, and the developer needs to be morphologically compatible for this situation. |
1006 | The ad component was rejected | Your ad review failed to show your ad | Please go to mp.weixin.qq.com to confirm the status of the audit, and the developer needs to be morphologically compatible for this situation. |
1007 | The ad component was rejected | Your advertising capabilities have been banned and you will not be able to display ads during the ban | Go to mp.weixin.qq.com to confirm the small program ad blocking status. |
1008 | The ad unit is turned off | The advertising capabilities of this ad space have been turned off | Go to mp.weixin.qq.com to reopen the display of the corresponding ad space. |
Listen for on-screen ad load events.
The callback function for the on-screen ad load event
Show in-screen ads.
The on-screen ad shows the results of the action
If the on-screen ad fails, the InterstitialAd.show() method returns a rejected Promise that allows the developer to obtain the error code and the corresponding error message.
Code | Abnormal condition | Reason |
---|---|---|
2001 | Trigger frequency limit | Small programs are not allowed to display on-screen ads for a certain period of time |
2002 | Trigger frequency limit | Insemployment ads are not allowed enough time intervals to show in-screen ads from small programs or to motivate video ads to play |
2003 | Trigger frequency limit | Incentive video ads or in-screen ads are currently playing, and screen ads are not allowed to appear again |
2004 | The ad rendering failed | This error is not an exception for the developer, or the ad rendering failed due to a small program page switch |
2005 | The ad call is unusual | Plug-in ad instances do not allow cross-page calls |