Skip to main content

Ad Format Integration

Here's how to integrate the supported ad formats on Unity. Each ad format has its own unique characteristics and implementation details.

App Open Ads

App open ads appear when the user opens your app or switches back to your app. They are displayed on the loading or splash screen.

Benefits

  • An ad overlays the loading screen
  • The unique app open ad layout offers the best user experience for this placement
  • Unlock new inventory: monetize users as soon as they open your app
    • Maximize demands
    • Highest bidding ad creatives
    • Availability of both full-screen and partial-screen ads
    • Optimized user experience rendering

Implementation

Setup the auto delay load

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

// Remember to call this function before SDK init.
Yodo1U3dAppOpenAd.GetInstance().autoDelayIfLoadFail = true;
// Load the ad
Yodo1U3dAppOpenAd.GetInstance().LoadAd();

// Show the ad
bool isLoaded = Yodo1U3dAppOpenAd.GetInstance().IsLoaded();
if (isLoaded)
{
// Show without placement
Yodo1U3dAppOpenAd.GetInstance().ShowAd();
// Or show with placement
Yodo1U3dAppOpenAd.GetInstance().ShowAd("Your placement ID");
}

Events

private void Awake()
{
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] App Open ad loaded");
}

private void OnAppOpenAdLoadFailedEvent(Yodo1U3dAppOpenAd ad, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] App Open ad failed to load with error code: " + error.ToString());
}

private void OnAppOpenAdOpenedEvent(Yodo1U3dAppOpenAd ad)
{
Debug.Log("[Yodo1 Mas] App Open ad opened");
}

private void OnAppOpenAdOpenFailedEvent(Yodo1U3dAppOpenAd ad, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] App Open ad failed to open with error code: " + error.ToString());
}

private void OnAppOpenAdClosedEvent(Yodo1U3dAppOpenAd ad)
{
Debug.Log("[Yodo1 Mas] App Open ad closed");
}

Impression-Level User Revenue

Impression-level user revenue data allows you to access detailed revenue information for each ad impression. This data can be used to compare different sources and campaigns, and to 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 a callback:

Yodo1U3dAppOpenAd.GetInstance().OnAdPayRevenueEvent += OnAppOpenAdPayRevenueEvent;

private void OnAppOpenAdPayRevenueEvent(Yodo1U3dAppOpenAd ad, Yodo1U3dAdValue adValue)
{
double revenue = adValue.Revenue;
string currency = adValue.Currency;
string revenuePrecision = adValue.RevenuePrecision;
}

The revenuePrecision 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)

Best Practices

  1. Preload Ads: Always preload ads before showing them to ensure they're ready when needed.
  2. Use Placements: Set placement names when showing ads to track performance in the dashboard.
  3. Handle Failures: Wait at least 10 seconds before retrying after a failed load.
  4. User Experience: Place ads at natural transition points in your app.
  5. Error Handling: Always implement proper error handling in the event callbacks.