Docy

Rewarded Interstitials

Prerequisites

You need MAS 4.8.0 or above to use this ad format.

1. Load the ad

				
					Yodo1U3dRewardedInterstitialAd.GetInstance().LoadAd();
				
			

2. Show the ad

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

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

3. Configure the ad events

				
					private void RequestRewardedInterstitial()
{
    Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdLoadedEvent += OnRewardedInterstitialAdLoadedEvent;
    Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdLoadFailedEvent += OnRewardedInterstitialAdLoadFailedEvent;
    Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdOpenedEvent += OnRewardedInterstitialAdOpenedEvent;
    Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdOpenFailedEvent += OnRewardedInterstitialAdOpenFailedEvent;
    Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdClosedEvent += OnRewardedInterstitialAdClosedEvent;
    Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdEarnedEvent += OnRewardedInterstitialAdEarnedEvent;
}

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

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

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

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

private void OnRewardedInterstitialAdClosedEvent(Yodo1U3dRewardedInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnRewardedInterstitialAdClosedEvent event received");
    rewardedInterstitialAd.LoadAd();
}

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

4. 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.

				
					Yodo1U3dRewardedInterstitialAd.GetInstance().SetAdPlacement("Placement_Name")
				
			

You can find more details about the ad placements here.

5. Full script

				
					using Yodo1.MAS;

private Yodo1U3dRewardedInterstitialAd rewardedInterstitialAd;

public void Start()
{
    this.RequestRewardedInterstitial();
}

private void RequestRewardedInterstitial()
{
    rewardedInterstitialAd = Yodo1U3dRewardedInterstitialAd.GetInstance();

	 // Ad Events
    rewardedInterstitialAd.OnAdLoadedEvent += OnRewardedInterstitialAdLoadedEvent;
    rewardedInterstitialAd.OnAdLoadFailedEvent += OnRewardedInterstitialAdLoadFailedEvent;
    rewardedInterstitialAd.OnAdOpenedEvent += OnRewardedInterstitialAdOpenedEvent;
    rewardedInterstitialAd.OnAdOpenFailedEvent += OnRewardedInterstitialAdOpenFailedEvent;
    rewardedInterstitialAd.OnAdClosedEvent += OnRewardedInterstitialAdClosedEvent;
    rewardedInterstitialAd.OnAdEarnedEvent += OnRewardedInterstitialAdEarnedEvent;
    
    rewardedInterstitialAd.LoadAd();
}

private void ShowRewardedInterstitial()
{
    bool isLoaded = rewardedInterstitialAd.IsLoaded();

    if(isLoaded) rewardedInterstitialAd.ShowAd();
}

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

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

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

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

private void OnRewardedInterstitialAdClosedEvent(Yodo1U3dRewardedInterstitialAd ad)
{
    Debug.Log("[Yodo1 Mas] OnRewardedInterstitialAdClosedEvent event received");
    rewardedInterstitialAd.LoadAd();
}

private void OnRewardedInterstitialAdEarnedEvent(Yodo1U3dRewardedInterstitialAd ad) 
{
    Debug.Log("[Yodo1 Mas] OnRewardedInterstitialAdEarnedEvent event received");
    // Add your reward code here
}

				
			
CONTENTS