Skip to main content
Version: 3.x

InterstitialAd

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

() => void

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.destroy✔️

offClose

Un-listens on the interstitial ad close event.

Reference

(callback: OffCloseCallback) => void
PropertyType
callbackOffCloseCallback

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.offClose✔️

offError

Un-listens on the interstitial ad error event.

Reference

(callback: OffErrorCallback) => void
PropertyType
callbackOffErrorCallback

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.offError✔️

offLoad

Un-listens on the interstitial ad loading event.

Reference

(callback: OffLoadCallback) => void
PropertyType
callbackOffLoadCallback

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.offLoad✔️

onClose

Listens on interstitial ad close event.

Reference

(callback: OnCloseCallback) => void
PropertyType
callbackOnCloseCallback

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.onClose✔️

onError

Listens on the interstitial ad error event.

Reference

(callback: OnErrorCallback) => void
PropertyType
callbackOnErrorCallback

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.onError✔️

onLoad

Listens on the interstitial ad loading event.

Reference

(callback: OnLoadCallback) => void
PropertyType
callbackOnLoadCallback

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.onLoad✔️

load

Loads an interstitial ad.

Reference

() => Promise<any>

API Support

APIWeChat Mini-ProgramH5React 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.

CodeExceptionCause
2001Rate limit triggeredInterstitial ads cannot be displayed for a certain time after the Mini Program starts.
2002Rate limit triggeredInterstitial ads cannot be displayed until a specified interval elapses after the display of a previous interstitial ad or rewarded video ad.
2003Rate limit triggeredInterstitial ads cannot be displayed when a rewarded video ad or another interstitial ad is being displayed.
2004Failed to render adThis error is not caused by the developer's abnormal operation. It may be a result of switching between Mini Program pages.
2005Unusual ad callCross-page calls are not allowed for interstitial ad instances.

Reference

() => Promise<any>

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.show✔️

Parameters

OffCloseCallback

The callback function for the interstitial ad close event.

(res: CallbackResult) => void
PropertyType
resCallbackResult

OffErrorCallback

The callback function for the interstitial ad error event.

(res: CallbackResult) => void
PropertyType
resCallbackResult

OffLoadCallback

The callback function for the interstitial ad loading event.

(res: CallbackResult) => void
PropertyType
resCallbackResult

OnCloseCallback

The callback function for the interstitial ad close event.

(res: CallbackResult) => void
PropertyType
resCallbackResult

OnErrorCallback

The callback function for the interstitial ad error event.

(result: OnErrorCallbackResult) => void
PropertyType
resultOnErrorCallbackResult

OnLoadCallback

The callback function for the interstitial ad loading event.

(res: CallbackResult) => void
PropertyType
resCallbackResult

OnErrorCallbackResult

PropertyTypeDescription
errCode1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008Error code
Reference
errMsgstringError message

API Support

APIWeChat Mini-ProgramH5React Native
InterstitialAd.destroy✔️
InterstitialAd.offClose✔️
InterstitialAd.offError✔️
InterstitialAd.offLoad✔️
InterstitialAd.onClose✔️
InterstitialAd.onError✔️
InterstitialAd.onLoad✔️
InterstitialAd.load✔️
InterstitialAd.show✔️