Interstitial Ads
Interstitial ads are full-screen ads that cover the interface. Display them at natural pause points in your game, such as between levels or after completing a task.
Each ad format uses a Zone ID to identify the ad placement. Zone IDs are configured in the Empower dashboard.
tip
Load the interstitial in advance, after OnSdkReady, and show it at a natural break point.
Loading an Interstitial Ad
Load the ad in advance:
EmpowerAds.LoadInterstitialAd("YOUR_INTERSTITIAL_ZONE_ID");
Showing an Interstitial Ad
Show the ad at a natural break point, such as a level transition:
EmpowerAds.ShowInterstitial("YOUR_INTERSTITIAL_ZONE_ID");
Listening to Interstitial Status
OnInterstitialStatusChanged reports these statuses:
| Status | Reported when |
|---|---|
Initializing | The load started |
Ready | Ad is loaded and ready to display |
Shown | Ad is being displayed |
Skipped | The user dismissed the ad |
Closed | The ad is closed |
WillLeave | User clicked the ad (leaving the game) |
Failed | The zone could not load an ad and has given up |
Track Ready to know when the ad can be shown, and load the next ad on Closed:
using Empower.MobileAds;
using UnityEngine;
public class InterstitialController : MonoBehaviour
{
private const string ZoneId = "YOUR_INTERSTITIAL_ZONE_ID";
private bool _isReady;
void OnEnable()
{
EmpowerAds.OnInterstitialStatusChanged += HandleInterstitialStatus;
}
void OnDisable()
{
EmpowerAds.OnInterstitialStatusChanged -= HandleInterstitialStatus;
}
// Call after OnSdkReady.
public void Load()
{
EmpowerAds.LoadInterstitialAd(ZoneId);
}
public void Show()
{
if (_isReady)
EmpowerAds.ShowInterstitial(ZoneId);
}
private void HandleInterstitialStatus(AdStatus status, string zoneId)
{
if (zoneId != ZoneId) return;
switch (status)
{
case AdStatus.Ready:
_isReady = true;
break;
case AdStatus.Failed:
_isReady = false;
break;
case AdStatus.Closed:
_isReady = false;
EmpowerAds.LoadInterstitialAd(ZoneId);
break;
}
}
}
iOS
On Android Closed always follows Skipped, so loading the next ad on Closed is enough. On iOS Closed may not follow, so handle Skipped there as well.