Initialising an ad
Start by creating an instance ofCIInterstitialAd with the following parameters. Create one instance per ad you intend to show.
Required
placementId: string: Unique ID for this Ad Placement provided by Content Ignite.
Optional
pageUrl: string: URL used for targeting, for example if the ad is displayed in a section of the app which has an equivalent URL on the web.targeting: Record<string, string[]>: Pass custom key-value pairs to ad requests.eventListener: CIInterstitialEventListener: Respond to load and dismiss events. See Handling ad events.
Load the ad
When you are ready to load the ad, callload(). It resolves to true when an ad is ready and false if loading failed:
Show the ad
When you are ready to display the ad, such as after a transition in the app flow, callshow(). Like load(), it resolves to a boolean: true once the ad has been shown and dismissed, or false immediately if no ad was loaded:
To show another ad after one is dismissed, call
load() again to prepare a fresh ad.Handling ad events
To listen and respond to events from an Interstitial ad, pass aCIInterstitialEventListener when creating the ad. All callbacks are optional, so provide only the ones you need:
load() and show() — use whichever style suits your app. The events map to the same signals:
| Callback | Also surfaced by |
|---|---|
interstitialLoaded | load() resolves true |
interstitialLoadFailed | load() resolves false |
interstitialDismissed | show() resolves true |
Releasing the ad
Calldestroy() to release the native ad, stop listening for events, and free resources — for example when the component that owns the ad unmounts: