Skip to main content

Banner Ads

Banner ad units display rectangular ads that occupy a portion of an app's layout. They can refresh automatically after a set period. This means users will view a new ad regularly, even if they stay on the same screen in your app. They're also the simplest ad format to implement.

Benefits of Banner Ads

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

Supported size

SIZEDESCRIPTIONAVAILABILITYADSIZE CONSTANT
320×50Standard BannerPhones and TabletsBanner
320×100Large BannerPhones and TabletsLargeBanner
300×250IAB Medium RectanglePhones and TabletsIABMediumRectangle
Full-screen width x
Adaptive height
Adaptive bannerPhones and TabletsAdaptiveBanner
Screen width x
32/50/90
Smart bannerPhones and TabletsSmartBanner
caution

You should finish these steps before releasing.

Load and Display 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.

Yodo1U3dBannerAdView bannerAdView = new Yodo1U3dBannerAdView(Yodo1U3dBannerAdSize.Banner, Yodo1U3dBannerAdPosition.BannerBottom | Yodo1U3dBannerAdPosition.BannerHorizontalCenter);
bannerAdView.LoadAd();
bannerAdView.Show();

Configure the ad events

The MAS SDK fires several events to inform you of ad availability.

using Yodo1.MAS;

public class BannerAdLoader : MonoBehaviour
{
Yodo1U3dBannerAdView bannerAdView = null;
private void Start()
{
bannerAdView = new Yodo1U3dBannerAdView(Yodo1U3dBannerAdSize.Banner, Yodo1U3dBannerAdPosition.BannerBottom | Yodo1U3dBannerAdPosition.BannerHorizontalCenter);
SetupEventCallbacks();
LoadBannerAd();
}

private void SetupEventCallbacks()
{
bannerAdView.OnAdLoadedEvent += OnBannerAdLoadedEvent;
bannerAdView.OnAdFailedToLoadEvent += OnBannerAdLoadFailedEvent;
bannerAdView.OnAdOpenedEvent += OnBannerAdOpenedEvent;
bannerAdView.OnAdFailedToOpenEvent += OnBannerAdOpenFailedEvent;
bannerAdView.OnAdClosedEvent += OnBannerAdClosedEvent;
}

private void LoadBannerAd()
{
bannerAdView.SetAdPlacement("Your placement ID");
bannerAdView.LoadAd();
}

private void OnBannerAdLoadedEvent(Yodo1U3dBannerAdView ad)
{
// Code to be executed when an ad finishes loading.
}

private void OnBannerAdLoadFailedEvent(Yodo1U3dBannerAdView ad, Yodo1U3dAdError adError)
{
// Code to be executed when an ad request fails.
}

private void OnBannerAdOpenedEvent(Yodo1U3dBannerAdView ad)
{
// Code to be executed when an ad opened
}

private void OnBannerAdOpenFailedEvent(Yodo1U3dBannerAdView ad, Yodo1U3dAdError adError)
{
// Code to be executed when an ad open fails.
}

private void OnBannerAdClosedEvent(Yodo1U3dBannerAdView ad)
{
// Code to be executed when the ad closed
}
}

Impression-Level User Revenue

Starting in SDK version 4.13.2, you can access impression-level user revenue data on the client side. You can use this data to compare different sources and campaigns.

You can 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 callback:

bannerAdView.OnAdPayRevenueEvent += OnBannerAdPayRevenueEvent;

private void OnBannerAdPayRevenueEvent(Yodo1U3dBannerAdView ad, Yodo1U3dAdValue adValue)
{
double revenue = adValue.Revenue;
string currency = adValue.Currency;
}

You can also retrieve a precision evaluation for the revenue value, as shown in the following example:

string revenuePrecision = adValue.RevenuePrecision;

Video Tutorial