MAS Knowledge Base

MAS Knowledge Base

Docy

App Open Ads

Prerequisites

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

1. Load the ad

				
					Yodo1U3dAppOpenAd.GetInstance().LoadAd();
				
			

2. Show the ad

You can show the ad using this code, but we recommend using the ad events as you’ll be able to show the ad once it’s loaded. You can check the full script provided below.

				
					Yodo1U3dAppOpenAd.GetInstance().ShowAd();
				
			

3. Configure the ad events

				
					private void RequestAppOpen()
{
    Yodo1U3dAppOpenAd.GetInstance().OnAdLoadedEvent += OnAppOpenAdLoadedEvent;
    Yodo1U3dAppOpenAd.GetInstance().OnAdLoadFailedEvent += OnAppOpenAdLoadFailedEvent;
    Yodo1U3dAppOpenAd.GetInstance().OnAdOpenedEvent += OnAppOpenAdOpenedEvent;
    Yodo1U3dAppOpenAd.GetInstance().OnAdOpenFailedEvent += OnAppOpenAdOpenFailedEvent;
    Yodo1U3dAppOpenAd.GetInstance().OnAdClosedEvent += OnAppOpenAdClosedEvent;
}

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

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

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

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

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

4. Full script

				
					using Yodo1.MAS;

private Yodo1U3dAppOpenAd appOpenAd;

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

private void RequestAppOpen()
{
    appOpenAd = Yodo1U3dAppOpenAd.GetInstance();

	 // Ad Events
    appOpenAd.OnAdLoadedEvent += OnAppOpenAdLoadedEvent;
    appOpenAd.OnAdLoadFailedEvent += OnAppOpenAdLoadFailedEvent;
    appOpenAd.OnAdOpenedEvent += OnAppOpenAdOpenedEvent;
    appOpenAd.OnAdOpenFailedEvent += OnAppOpenAdOpenFailedEvent;
    appOpenAd.OnAdClosedEvent += OnAppOpenAdClosedEvent;
    appOpenAd.LoadAd();
}

private void OnAppOpenAdLoadedEvent(Yodo1U3dAppOpenAd ad)
{
    Debug.Log("[Yodo1 Mas] OnAppOpenAdLoadedEvent event received");
    ad.ShowAd();
}

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

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

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

private void OnAppOpenAdClosedEvent(Yodo1U3dAppOpenAd ad)
{
    Debug.Log("[Yodo1 Mas] OnAppOpenAdClosedEvent event received");
}
				
			
CONTENTS