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
- Rewarded Video
- Interstitial
- Banner
- Native
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
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)
Rewarded Video Ads
Rewarded video ads enable users to earn in-app rewards by watching video ads.
Benefits
- Increase revenue with highest eCPM rates
- Increase in-app purchases
- Increase user engagement and retention
Implementation
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.
Yodo1U3dRewardAd.GetInstance().autoDelayIfLoadFail = true;
// Load the ad
Yodo1U3dRewardAd.GetInstance().LoadAd();
// Show the ad
bool isLoaded = Yodo1U3dRewardAd.GetInstance().IsLoaded();
if (isLoaded)
{
// Show without placement
Yodo1U3dRewardAd.GetInstance().ShowAd();
// Or show with placement
Yodo1U3dRewardAd.GetInstance().ShowAd("Your placement ID");
}
Events
private void Awake()
{
Yodo1U3dRewardAd.GetInstance().OnAdLoadedEvent += OnRewardAdLoadedEvent;
Yodo1U3dRewardAd.GetInstance().OnAdLoadFailedEvent += OnRewardAdLoadFailedEvent;
Yodo1U3dRewardAd.GetInstance().OnAdOpenedEvent += OnRewardAdOpenedEvent;
Yodo1U3dRewardAd.GetInstance().OnAdOpenFailedEvent += OnRewardAdOpenFailedEvent;
Yodo1U3dRewardAd.GetInstance().OnAdClosedEvent += OnRewardAdClosedEvent;
Yodo1U3dRewardAd.GetInstance().OnAdEarnedEvent += OnRewardAdEarnedEvent;
}
private void OnRewardAdLoadedEvent(Yodo1U3dRewardAd ad)
{
Debug.Log("[Yodo1 Mas] Reward ad loaded");
}
private void OnRewardAdLoadFailedEvent(Yodo1U3dRewardAd ad, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Reward ad failed to load with error code: " + error.ToString());
}
private void OnRewardAdOpenedEvent(Yodo1U3dRewardAd ad)
{
Debug.Log("[Yodo1 Mas] Reward ad opened");
}
private void OnRewardAdOpenFailedEvent(Yodo1U3dRewardAd ad, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Reward ad failed to open with error code: " + error.ToString());
}
private void OnRewardAdClosedEvent(Yodo1U3dRewardAd ad)
{
Debug.Log("[Yodo1 Mas] Reward ad closed");
}
private void OnRewardAdEarnedEvent(Yodo1U3dRewardAd ad)
{
Debug.Log("[Yodo1 Mas] Reward ad earned");
}
Impression-Level User Revenue
Yodo1U3dRewardAd.GetInstance().OnAdPayRevenueEvent += OnRewardAdPayRevenueEvent;
private void OnRewardAdPayRevenueEvent(Yodo1U3dRewardAd 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)
Interstitial Ads
Interstitial ads are full-screen ads that appear at natural transition points in your app.
Benefits
- Engaging full-screen content
- Media content can be static, video-based or interactive
- Positive UX when placed at natural transition points
Implementation
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.
Yodo1U3dInterstitialAd.GetInstance().autoDelayIfLoadFail = true;
// Load the ad
Yodo1U3dInterstitialAd.GetInstance().LoadAd();
// Show the ad
bool isLoaded = Yodo1U3dInterstitialAd.GetInstance().IsLoaded();
if (isLoaded)
{
// Show without placement
Yodo1U3dInterstitialAd.GetInstance().ShowAd();
// Or show with placement
Yodo1U3dInterstitialAd.GetInstance().ShowAd("Your placement ID");
}
Events
private void Awake()
{
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] Interstitial ad loaded");
}
private void OnInterstitialAdLoadFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Interstitial ad failed to load with error code: " + error.ToString());
}
private void OnInterstitialAdOpenedEvent(Yodo1U3dInterstitialAd ad)
{
Debug.Log("[Yodo1 Mas] Interstitial ad opened");
}
private void OnInterstitialAdOpenFailedEvent(Yodo1U3dInterstitialAd ad, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Interstitial ad failed to open with error code: " + error.ToString());
}
private void OnInterstitialAdClosedEvent(Yodo1U3dInterstitialAd ad)
{
Debug.Log("[Yodo1 Mas] Interstitial ad closed");
}
Impression-Level User Revenue
Yodo1U3dInterstitialAd.GetInstance().OnAdPayRevenueEvent += OnInterstitialAdPayRevenueEvent;
private void OnInterstitialAdPayRevenueEvent(Yodo1U3dInterstitialAd 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)
Banner Ads
Banner ads are rectangular ads that occupy a portion of an app's layout and can refresh automatically.
Benefits
- Banner Ads are among the oldest advertisements and can make instant impressions at a relatively low cost.
- Banner Ads offer a quick, easy, and cost-effective way to generate immediate interest.
- Banner Ads can pique viewers' curiosity and help retain them by promoting brand awareness.
Implementation
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.
Yodo1U3dBannerAd.GetInstance().autoDelayIfLoadFail = true;
// Create and load banner ad
Yodo1U3dBannerAdView bannerAdView = new Yodo1U3dBannerAdView(Yodo1U3dBannerAdSize.Banner,
Yodo1U3dBannerAdPosition.BannerBottom | Yodo1U3dBannerAdPosition.BannerHorizontalCenter);
bannerAdView.LoadAd();
// Show the banner
bannerAdView.Show();
// Hide the banner
bannerAdView.Hide();
Events
private void Awake()
{
bannerAdView.OnAdLoadedEvent += OnBannerAdLoadedEvent;
bannerAdView.OnAdLoadFailedEvent += OnBannerAdLoadFailedEvent;
bannerAdView.OnAdOpenedEvent += OnBannerAdOpenedEvent;
bannerAdView.OnAdOpenFailedEvent += OnBannerAdOpenFailedEvent;
bannerAdView.OnAdClosedEvent += OnBannerAdClosedEvent;
}
private void OnBannerAdLoadedEvent(Yodo1U3dBannerAdView bannerAdView)
{
Debug.Log("[Yodo1 Mas] Banner ad loaded");
}
private void OnBannerAdLoadFailedEvent(Yodo1U3dBannerAdView bannerAdView, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Banner ad failed to load with error code: " + error.ToString());
}
private void OnBannerAdOpenedEvent(Yodo1U3dBannerAdView bannerAdView)
{
Debug.Log("[Yodo1 Mas] Banner ad opened");
}
private void OnBannerAdOpenFailedEvent(Yodo1U3dBannerAdView bannerAdView, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Banner ad failed to open with error code: " + error.ToString());
}
private void OnBannerAdClosedEvent(Yodo1U3dBannerAdView bannerAdView)
{
Debug.Log("[Yodo1 Mas] Banner ad closed");
}
Impression-Level User Revenue
bannerAdView.OnAdPayRevenueEvent += OnBannerAdPayRevenueEvent;
private void OnBannerAdPayRevenueEvent(Yodo1U3dBannerAdView bannerAdView, 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)
Native Ads
Native ads allow you to customize the ad experience by blending it directly into your app's UI.
Benefits
- Better eCPMs than Banners
- Positive impact on retention
- Customizable to match your app's UI
Implementation
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.
Yodo1U3dNativeAd.GetInstance().autoDelayIfLoadFail = true;
// Create and load native ad
Yodo1U3dNativeAdView nativeAdView = new Yodo1U3dNativeAdView(
Yodo1U3dNativeAdPosition.NativeTop | Yodo1U3dNativeAdPosition.NativeLeft,
0, 0, 360, 300);
nativeAdView.LoadAd();
// Show the native ad
nativeAdView.Show();
// Hide the native ad
nativeAdView.Hide();
Events
private void Awake()
{
nativeAdView.OnAdLoadedEvent += OnNativeAdLoadedEvent;
nativeAdView.OnAdLoadFailedEvent += OnNativeAdLoadFailedEvent;
nativeAdView.OnAdOpenedEvent += OnNativeAdOpenedEvent;
nativeAdView.OnAdOpenFailedEvent += OnNativeAdOpenFailedEvent;
nativeAdView.OnAdClosedEvent += OnNativeAdClosedEvent;
}
private void OnNativeAdLoadedEvent(Yodo1U3dNativeAdView nativeAdView)
{
Debug.Log("[Yodo1 Mas] Native ad loaded");
}
private void OnNativeAdLoadFailedEvent(Yodo1U3dNativeAdView nativeAdView, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Native ad failed to load with error code: " + error.ToString());
}
private void OnNativeAdOpenedEvent(Yodo1U3dNativeAdView nativeAdView)
{
Debug.Log("[Yodo1 Mas] Native ad opened");
}
private void OnNativeAdOpenFailedEvent(Yodo1U3dNativeAdView nativeAdView, Yodo1U3dAdError error)
{
Debug.Log("[Yodo1 Mas] Native ad failed to open with error code: " + error.ToString());
}
private void OnNativeAdClosedEvent(Yodo1U3dNativeAdView nativeAdView)
{
Debug.Log("[Yodo1 Mas] Native ad closed");
}
Impression-Level User Revenue
nativeAdView.OnAdPayRevenueEvent += OnNativeAdPayRevenueEvent;
private void OnNativeAdPayRevenueEvent(Yodo1U3dNativeAdView nativeAdView, 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
- Preload Ads: Always preload ads before showing them to ensure they're ready when needed.
- Use Placements: Set placement names when showing ads to track performance in the dashboard.
- Handle Failures: Wait at least 10 seconds before retrying after a failed load.
- User Experience: Place ads at natural transition points in your app.
- Error Handling: Always implement proper error handling in the event callbacks.