Interstitial ad component. This is a native component at a higher layer than normal components. Each time the interstitial ad component is created, a new instance (interstitial ad instances on the Mini Program cannot be used across pages) is returned. Interstitial ads are hidden by default, and InterstitialAd.show() must be called to display them.
Reference
Methods
destroy
Destorys an interstitial ad.
Reference
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.destroy | ✔️ | | |
offClose
Un-listens on the interstitial ad close event.
Reference
(callback: OffCloseCallback) => void
Property | Type |
---|
callback | OffCloseCallback |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.offClose | ✔️ | | |
offError
Un-listens on the interstitial ad error event.
Reference
(callback: OffErrorCallback) => void
Property | Type |
---|
callback | OffErrorCallback |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.offError | ✔️ | | |
offLoad
Un-listens on the interstitial ad loading event.
Reference
(callback: OffLoadCallback) => void
Property | Type |
---|
callback | OffLoadCallback |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.offLoad | ✔️ | | |
onClose
Listens on interstitial ad close event.
Reference
(callback: OnCloseCallback) => void
Property | Type |
---|
callback | OnCloseCallback |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.onClose | ✔️ | | |
onError
Listens on the interstitial ad error event.
Reference
(callback: OnErrorCallback) => void
Property | Type |
---|
callback | OnErrorCallback |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.onError | ✔️ | | |
onLoad
Listens on the interstitial ad loading event.
Reference
(callback: OnLoadCallback) => void
Property | Type |
---|
callback | OnLoadCallback |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.onLoad | ✔️ | | |
load
Loads an interstitial ad.
Reference
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.load | ✔️ | | |
show
Displays an interstitial ad.
Error Codes
If an interstitial ad fails to display. the InterstitialAd.show()
method returns a rejected Promise, which allows the developer to obtain the error code and the error message.
Code | Exception | Cause |
---|
2001 | Rate limit triggered | Interstitial ads cannot be displayed for a certain time after the Mini Program starts. |
2002 | Rate limit triggered | Interstitial ads cannot be displayed until a specified interval elapses after the display of a previous interstitial ad or rewarded video ad. |
2003 | Rate limit triggered | Interstitial ads cannot be displayed when a rewarded video ad or another interstitial ad is being displayed. |
2004 | Failed to render ad | This error is not caused by the developer's abnormal operation. It may be a result of switching between Mini Program pages. |
2005 | Unusual ad call | Cross-page calls are not allowed for interstitial ad instances. |
Reference
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.show | ✔️ | | |
Parameters
OffCloseCallback
The callback function for the interstitial ad close event.
(res: CallbackResult) => void
Property | Type |
---|
res | CallbackResult |
OffErrorCallback
The callback function for the interstitial ad error event.
(res: CallbackResult) => void
Property | Type |
---|
res | CallbackResult |
OffLoadCallback
The callback function for the interstitial ad loading event.
(res: CallbackResult) => void
Property | Type |
---|
res | CallbackResult |
OnCloseCallback
The callback function for the interstitial ad close event.
(res: CallbackResult) => void
Property | Type |
---|
res | CallbackResult |
OnErrorCallback
The callback function for the interstitial ad error event.
(result: OnErrorCallbackResult) => void
Property | Type |
---|
result | OnErrorCallbackResult |
OnLoadCallback
The callback function for the interstitial ad loading event.
(res: CallbackResult) => void
Property | Type |
---|
res | CallbackResult |
OnErrorCallbackResult
Property | Type | Description |
---|
errCode | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | Error code Reference |
errMsg | string | Error message |
API Support
API | WeChat Mini-Program | H5 | React Native |
---|
InterstitialAd.destroy | ✔️ | | |
InterstitialAd.offClose | ✔️ | | |
InterstitialAd.offError | ✔️ | | |
InterstitialAd.offLoad | ✔️ | | |
InterstitialAd.onClose | ✔️ | | |
InterstitialAd.onError | ✔️ | | |
InterstitialAd.onLoad | ✔️ | | |
InterstitialAd.load | ✔️ | | |
InterstitialAd.show | ✔️ | | |