Banner Ads
Banner ads are rectangular ads that occupy a portion of the screen. In Unity a banner is shown on top of the Unity view. It refreshes automatically and stays on screen, across scenes, until you pause or destroy it.
Each ad format uses a Zone ID to identify the ad placement. Zone IDs are configured in the Empower dashboard.
A banner does not appear in the Unity Editor. Test on a device.
Loading a Banner Ad
Load the banner after OnSdkReady:
using Empower.MobileAds;
EmpowerAds.LoadBannerAd("YOUR_BANNER_ZONE_ID", BannerPosition.BottomCenter, width: 0);
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | none | The zone ID for the banner placement |
position | BannerPosition | No | BottomCenter | Where the banner is placed: TopLeft, TopCenter, TopRight, CenterLeft, Centered, CenterRight, BottomLeft, BottomCenter or BottomRight |
width | int | No | 320 | Width in dp on Android and points on iOS. 0 fills the screen width |
height | int | No | 50 | Minimum height. The banner is as tall as the ad on display |
The banner is placed inside the safe area.
Pausing and Destroying a Banner
Pause the banner on screens where it must not show. A paused banner is hidden and requests no new ads.
EmpowerAds.PauseBannerZone("YOUR_BANNER_ZONE_ID");
EmpowerAds.ResumeBannerZone("YOUR_BANNER_ZONE_ID");
// Remove the banner when the placement is no longer needed
EmpowerAds.DestroyBannerZone("YOUR_BANNER_ZONE_ID");
Listening to Banner Status
The status event is optional. The SDK loads and displays the banner, retries failed loads and refreshes the banner on schedule. Do not build manual reload loops, for example calling LoadBannerAd again when a load fails. Use the event only if you need to track ad states for analytics or UI updates.
| Status | Description |
|---|---|
Ready | Banner is loaded and displayed |
Failed | Banner failed to load |
WillLeave | User clicked the ad (leaving the game) |
No status arrives for a zone ID that is not in your app's configuration, or while ads are disabled. The banner stays hidden.
If you need to track banner status:
void OnEnable()
{
EmpowerAds.OnBannerStatusChanged += HandleBannerStatus;
}
void OnDisable()
{
EmpowerAds.OnBannerStatusChanged -= HandleBannerStatus;
}
private void HandleBannerStatus(AdStatus status, string zoneId)
{
if (zoneId != "YOUR_BANNER_ZONE_ID") return;
switch (status)
{
case AdStatus.Ready:
break;
case AdStatus.Failed:
break;
case AdStatus.WillLeave:
break;
}
}
Custom Parameters (Optional)
One LoadBannerAd overload takes targeting parameters for Google banner requests. It works on Android only for now.
EmpowerAds.LoadBannerAd(
"YOUR_BANNER_ZONE_ID",
BannerPosition.BottomCenter,
0,
50,
"category=sports§ion=news");
EmpowerBannerAd Component (Optional)
If you prefer the Inspector, attach the EmpowerBannerAd component to a GameObject and set its Zone Id, Width and Height. It loads a banner at the bottom center of the screen in Start, pauses it while the GameObject is disabled and destroys it with the GameObject.