Interstitial Ad

1. Basic requirements

  • Add ​ADX Unity SDK to your project.

  • Use the Ad Unit ID issued for Banner Ads.

  • Before requesting an ad, SDK initialization must be done first.

    • SDK initialization should be called only once when the app launches and ad requests should be made after SDK initialization is complete.

2. Implementation

  1. If the app is distributed on both Android and iOS, enter the Ad Unit ID issued for each platform.

  2. Instantiate AdxInterstitialAd and register the required callbacks.

  3. Call Load() to load the ad.

  4. When disposing of the ad object, call Destroy().

#if UNITY_ANDROID
    string adxInterstitialAdUnitId = "<ANDROID_ADX_INTERSTITIAL_AD_UNIT_ID>";
#elif UNITY_IOS
    string adxInterstitialAdUnitId = "<IOS_ADX_INTERSTITIAL_AD_UNIT_ID>";
#endif

void LoadInterstitialAd()
{
    if (interstitialAd == null)
    {
        interstitialAd = new AdxInterstitialAd(adxInterstitialAdUnitId);
        interstitialAd.OnAdLoaded += InterstitialAd_OnAdLoaded;
        interstitialAd.OnAdFailedToLoad += InterstitialAd_OnAdFailedToLoad;
        interstitialAd.OnAdClicked += InterstitialAd_OnAdClicked;
        interstitialAd.OnAdShown += InterstitialAd_OnAdShown;
        interstitialAd.OnAdClosed += InterstitialAd_OnAdClosed;
        interstitialAd.OnAdFailedToShow += InterstitialAd_OnAdFailedToShow;
    }

    interstitialAd.Load();
}
  • Check whether an ad is available using IsLoaded(), and if so, display the ad with Show().

void ShowInterstitialAd()
{
    if (interstitialAd != null && interstitialAd.IsLoaded()){
        interstitialAd.Show();
    }
}
  • When disposing of the ad object, call Destroy()

void DestroyInterstitialAd()
{
    if (interstitialAd != null){
        interstitialAd.Destroy();
        interstitialAd = null;
    }
}

3. Callback

You can receive specific events. Please implement them as needed.

public event Action OnAdLoaded = delegate { };
public event Action<int> OnAdFailedToLoad = delegate { };
public event Action OnAdClicked = delegate { };
public event Action OnAdShown = delegate { };
public event Action OnAdClosed = delegate { };
public event Action OnAdFailedToShow = delegate { };
public event Action<double> OnPaidEvent = delegate { };

4. Ad Revenue (OnPaidEvent)

You can check the estimated ad revenue for ad impressions.

  • As shown in the example below, use OnPaidEvent to check the estimated eCPM value.

  • Manually set values during mediation setup and actual values may be mixed, so it is recommended to treat this as an estimate.

  • The currency unit of eCPM is USD.

  • You can link ad revenue data with your MMP. For details, please refer to the SDK integration guides below:

interstitialAd.OnPaidEvent += InterstitialAd_OnPaidEvent;

void InterstitialAd_OnPaidEvent(double ecpm)
{
   double revenue = ecpm / 1000f;
   
   // Firebase Analytics Example
   var impressionParameters = new[] {
    new Firebase.Analytics.Parameter("ad_platform", "AD(X)"),
    new Firebase.Analytics.Parameter("ad_unit_name", "ADX Interstitial Ad"),
    new Firebase.Analytics.Parameter("ad_format", "InterstitialAd"),
    new Firebase.Analytics.Parameter("value", revenue),
    new Firebase.Analytics.Parameter("currency", "USD")
   };

   Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_impression", impressionParameters);
   
   // AppsFlyer Example   
   Dictionary<string, string> dic = new Dictionary<string, string>();
   dic.Add("AdUnitName", "ADX Interstitial Ad")
   dic.Add("AdType", "InterstitialAd");

   AppsFlyerAdRevenue.logAdRevenue("AD(X)", AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeCustomMediation, revenue, "USD", dic);
}

Last updated

Was this helpful?