Interstitial ads are full-screen or full-page ads that temporarily cover an app’s interface.
They’re typically shown at natural pauses or transition points—such as after completing a level in a game or when navigating between major views.
The following sections show you how to load and then show an interstitial ad.
Loading an interstitial ad
The following code shows you how to load the first interstitial:
localinterstitial_ad_unit_ids= {
android="«android-ad-unit-ID»",
ios="«ios-ad-unit-ID»"
}
functioninitialize_interstitial_ads()
localad_unit_id
localsysinfo=sys.get_sys_info()
ifsysinfo.system_name =="Android" then
ad_unit_id=interstitial_ad_unit_ids["android"]
elseifsysinfo.system_name =="iPhone OS" then
ad_unit_id=interstitial_ad_unit_ids["ios"]
end
applovin.load_interstitial(ad_unit_id)
-- Interstitial Ad Callbacks
localfunctionapplovin_callback(self,name,params)
ifname=="OnInterstitialAdLoadedEvent" then
-- Interstitial ad is ready to be shown. applovin.is_interstitial_ready(ad_unit_id) will now return true
ifname=="OnInterstitialAdLoadFailedEvent" then
⋮
ifname=="OnInterstitialAdDisplayedEvent" then
⋮
ifname=="OnInterstitialAdDisplayFailedEvent" then
⋮
ifname=="OnInterstitialAdClickedEvent" then
⋮
ifname=="OnInterstitialAdHiddenEvent" then
⋮
ifname=="OnInterstitialAdRevenuePaidEvent" then
⋮
Showing an interstitial ad
To show an interstitial ad, call show_interstitial():
ifapplovin.is_interstitial_ready(«ad-unit-ID») then