Skip to main content

Interstitial Ads

Interstitial ad units show full-page ads in your app. Place them at natural breaks & transitions in your app's interface, such as after level completion in a gaming app.

Benefits of Interstitial Ads

  • Engaging content
  • Full-screen size
  • Media content can be static, video-based or interactive
  • Positive UX
  • Placement in natural transition points improves overall user experience (UX)
caution

You should finish these steps before releasing.

Load the ad

Yodo1U3dInterstitialAd.GetInstance().LoadAd();
Setup the auto delay load

Loading a new ad from OnAdLoadFailedEvent() without delay is not recommended. If a new ad needs to be loaded immediately on OnAdLoadFailedEvent(), then the auto delay config variable must be set to true to limit ad load retries to avoid continuous failed ad requests to avoid ANR issues.

// Remember to call this function before SDK init.
Yodo1U3dInterstitialAd.GetInstance().autoDelayIfLoadFail = true;

Display the ad

bool isLoaded = Yodo1U3dInterstitialAd.GetInstance().IsLoaded();

// Show ad with placement name, like app_start, level_end
if (isLoaded)
{
Yodo1U3dInterstitialAd.GetInstance().ShowAd("Your Placement Id");
}

// Show ad without placement name
if (isLoaded)
{
Yodo1U3dInterstitialAd.GetInstance().ShowAd();
}

Configure the ad events

The MAS SDK fires several events to inform you of ad availability.

using Yodo1.MAS;

public class InterstitialAdLoader : MonoBehaviour
{
private int retryAttempt = 0;

private void Start()
{
SetupEventCallbacks();
LoadInterstitialAd();
}

private void SetupEventCallbacks()
{
Yodo1U3dInterstitialAd.GetInstance().OnAdLoadedEvent += OnInterstitialAdLoadedEvent;
Yodo1U3dInterstitialAd.GetInstance().OnAdLoadFailedEvent += OnInterstitialAdLoadFailedEvent;
Yodo1U3dInterstitialAd.GetInstance().OnAdOpenedEvent += OnInterstitialAdOpenedEvent;
Yodo1U3dInterstitialAd.GetInstance().OnAdOpenFailedEvent += OnInterstitialAdOpenFailedEvent;
Yodo1U3dInterstitialAd.GetInstance().OnAdClosedEvent += OnInterstitialAdClosedEvent;
}

private void LoadInterstitialAd()
{
Yodo1U3dInterstitialAd.GetInstance().LoadAd();
}

private void OnInterstitialAdLoadedEvent(Yodo1U3dInterstitialAd ad)
{
// Code to be executed when an ad finishes loading.
retryAttempt = 0;
Yodo1U3dInterstitialAd.GetInstance().ShowAd();
}

private void OnInterstitialAdLoadFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError adError)
{
// Code to be executed when an ad request fails.
retryAttempt++;
double retryDelay = Math.Pow(2, Math.Min(6, retryAttempt));
Invoke("LoadInterstitialAd", (float) retryDelay);
}

private void OnInterstitialAdOpenedEvent(Yodo1U3dInterstitialAd ad)
{
// Code to be executed when an ad opened
}

private void OnInterstitialAdOpenFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError adError)
{
// Code to be executed when an ad open fails.
LoadInterstitialAd();
}

private void OnInterstitialAdClosedEvent(Yodo1U3dInterstitialAd ad)
{
// Code to be executed when the ad closed
LoadInterstitialAd();
}
}

Impression-Level User Revenue

Starting in SDK version 4.13.2, you can access impression-level user revenue data on the client side. You can use this data to compare different sources and campaigns.

You can share impression-level ad revenue data with your mobile measurement partner of choice.

You can retrieve the revenue amount in all ad lifecycle callbacks. The following example shows how to do this within callback:

Yodo1U3dInterstitialAd.GetInstance().OnAdPayRevenueEvent += OnInterstitialAdPayRevenueEvent;

private void OnInterstitialAdPayRevenueEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdValue adValue)
{
double revenue = adValue.Revenue;
string currency = adValue.Currency;
}

You can also retrieve a precision evaluation for the revenue value, as shown in the following example:

string revenuePrecision = adValue.RevenuePrecision;

This precision takes one of the following values:

"publisher_defined": the revenue amount is the price assigned by the publisher

"exact": the revenue amount is the result of a real-time auction

"estimated": the revenue amount is based on Auto-CPM or FB Bidding estimates

"": revenue and precision are not valid (for example, in test mode)

Video Tutorial

Best Practices

1. Preload

We recommend that you preload the interstitial ad before showing it. This will ensure the ad is ready to be displayed when needed.

2. Placement

We recommend setting the placement name when you show the ad. This will help you track each placement's performance in the dashboard.

3. Handle Failures

If the ad fails to load, you should NOT try to reload immediately. Instead, it would be best if you waited a while before reloading the ad again. We recommend waiting at least 10 seconds before trying to fill the ad.