Docy

Interstitials

1. Add the Auto Delay Config

Auto Delay config make sure that ads are not loading multilpe times in case of ad load failure. Not adding this config can cause ANR’s.
Note : Make sure to add this line before you initialize the SDK.

				
					 Yodo1U3dInterstitialAd.GetInstance().autoDelayIfLoadFail = true;
				
			

2. Configure the ad events

				
					private void InitializeInterstitial()
{
    // Instantiate
    Yodo1U3dInterstitialAd.GetInstance();
    
    // Ad Events
    Yodo1U3dInterstitialAd.GetInstance().OnAdLoadedEvent += OnInterstitialAdLoadedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdLoadFailedEvent += OnInterstitialAdLoadFailedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdOpenedEvent += OnInterstitialAdOpenedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdOpenFailedEvent += OnInterstitialAdOpenFailedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdClosedEvent += OnInterstitialAdClosedEvent;
}

private void OnInterstitialAdLoadedEvent(Yodo1U3dInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdLoadedEvent event received");
}

private void OnInterstitialAdLoadFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError adError)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdLoadFailedEvent event received with error: " + adError.ToString());
}

private void OnInterstitialAdOpenedEvent(Yodo1U3dInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdOpenedEvent event received");
}

private void OnInterstitialAdOpenFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError adError)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdOpenFailedEvent event received with error: " + adError.ToString());
    // Load the next ad
    Yodo1U3dInterstitialAd.GetInstance().LoadAd();
}

private void OnInterstitialAdClosedEvent(Yodo1U3dInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdClosedEvent event received");
    // Load the next ad
    Yodo1U3dInterstitialAd.GetInstance().LoadAd();
}
				
			

3. Load the ad

				
					Yodo1U3dInterstitialAd.GetInstance().LoadAd();
				
			

4. Show the ad

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

if(isLoaded) Yodo1U3dInterstitialAd.GetInstance().ShowAd();

				
			

5. Ad placements (optional)

You can use the ad placements to analyze the performance of your ads or run an A/B test to help you optimize your monetization strategy.

Simply add the placement name when you show the ad.

				
					Yodo1U3dInterstitialAd.GetInstance().ShowAd("Your Placement");
				
			

You can learn more about the ad placements here.

6. Full script

				
					using Yodo1.MAS;

public void Start()
{
    this.InitializeInterstitial();
    this.RequestInterstitial();
}

private void InitializeInterstitial() 
{
    // Instantiate
    Yodo1U3dInterstitialAd.GetInstance();
    
    // Ad Events
    Yodo1U3dInterstitialAd.GetInstance().OnAdLoadedEvent += OnInterstitialAdLoadedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdLoadFailedEvent += OnInterstitialAdLoadFailedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdOpenedEvent += OnInterstitialAdOpenedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdOpenFailedEvent += OnInterstitialAdOpenFailedEvent;
    Yodo1U3dInterstitialAd.GetInstance().OnAdClosedEvent += OnInterstitialAdClosedEvent;
}

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

private void ShowInterstitial()
{
    bool isLoaded = Yodo1U3dInterstitialAd.GetInstance().IsLoaded();

    if(isLoaded) Yodo1U3dInterstitialAd.GetInstance().ShowAd();
}

private void OnInterstitialAdLoadedEvent(Yodo1U3dInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdLoadedEvent event received");
}

private void OnInterstitialAdLoadFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError adError)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdLoadFailedEvent event received with error: " + adError.ToString());
}

private void OnInterstitialAdOpenedEvent(Yodo1U3dInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdOpenedEvent event received");
}

private void OnInterstitialAdOpenFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError adError)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdOpenFailedEvent event received with error: " + adError.ToString());
    // Load the next ad
    this.RequestInterstitial();
}

private void OnInterstitialAdClosedEvent(Yodo1U3dInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnInterstitialAdClosedEvent event received");
    // Load the next ad
    this.RequestInterstitial();
}

				
			

7. Video tutorial

CONTENTS