Skip to main content
Version: 3.4.0

Banner

Banner ads are classic static banners, which are usually located at the bottom or top of the screen.

Appodeal supports traditional 320x50 banners, tablet 728x90 ones, and adaptive banners (for Admob only) that adjust to the size and orientation of the device.

You can display only one banner view on the screen.

You can use our demo app as a reference project.

Demo App


Fixed Positioned Banner

Display

Banner ads are refreshed every 15 seconds automatically by default. To display banner, you need to call one of the following methods:

// Display banner at the bottom of the screen
Appodeal.Show(AppodealShowStyle.BannerBottom);

// Display banner at the top of the screen
Appodeal.Show(AppodealShowStyle.BannerTop);

// Display banner at the left of the screen
Appodeal.Show(AppodealShowStyle.BannerLeft);

// Display banner at the right of the screen
Appodeal.Show(AppodealShowStyle.BannerRight);

Hide Banner

To hide a banner that was shown via Appodeal.Show() method use the following method:

Appodeal.Hide(AppodealAdType.Banner);

Check If Ad Is Loaded

You can check whether or not an ad is loaded at a certain moment. This method returns a boolean value, representing the banner ad loading status.

Appodeal.IsLoaded(AppodealAdType.Banner);
note

The Appodeal.Show() method for banners can be called at any moment. If there is no ad available, we will cache one and show it right away.


Callbacks

The callbacks are used to track different events in the lifecycle of an ad, e.g. when an ad was clicked on or closed. Follow the steps below to implement them:

Subscribe to the desired banner event using one of the options from this guide. (you can subscribe to any number of events you want)

AppodealCallbacks.Banner.OnLoaded += (sender, args) => { };

You will find all existing banner events in the example below:

public void SomeMethod()
{
AppodealCallbacks.Banner.OnLoaded += OnBannerLoaded;
AppodealCallbacks.Banner.OnFailedToLoad += OnBannerFailedToLoad;
AppodealCallbacks.Banner.OnShown += OnBannerShown;
AppodealCallbacks.Banner.OnShowFailed += OnBannerShowFailed;
AppodealCallbacks.Banner.OnClicked += OnBannerClicked;
AppodealCallbacks.Banner.OnExpired += OnBannerExpired;
}

#region BannerAd Callbacks

// Called when a banner is loaded (height arg shows banner's height, precache arg shows if the loaded ad is precache
private void OnBannerLoaded(object sender, BannerLoadedEventArgs e)
{
Debug.Log("Banner loaded");
}

// Called when banner failed to load
private void OnBannerFailedToLoad(object sender, EventArgs e)
{
Debug.Log("Banner failed to load");
}

// Called when banner failed to show
private void OnBannerShowFailed(object sender, EventArgs e)
{
Debug.Log("Banner show failed");
}

// Called when banner is shown
private void OnBannerShown(object sender, EventArgs e)
{
Debug.Log("Banner shown");
}

// Called when banner is clicked
private void OnBannerClicked(object sender, EventArgs e)
{
Debug.Log("Banner clicked");
}

// Called when banner is expired and can not be shown
private void OnBannerExpired(object sender, EventArgs e)
{
Debug.Log("Banner expired");
}

#endregion
Unity Main Thread

All callbacks are called on native main threads that do not match the main thread of the Unity. If you need to receive callbacks in the main Unity thread follow our Callback Usage Guide.


Custom Positioned Banner

Displaying Banner At Custom Position

Banner ad can be moved along the axis to the desired position.

To show Banner at Custom Position use the following method:

Appodeal.ShowBannerView(yPosition, xPosition, "placementName");

Use int value or one of the constants below for yPosition:

  • AppodealViewPosition.VerticalTop — to align a banner to the top of the screen.
  • AppodealViewPosition.VerticalBottom — to align a banner to the bottom of the screen.

Use int value or one of the constants below for xPosition:

  • AppodealViewPosition.HorizontalSmart — to use the full-screen width.
  • AppodealViewPosition.HorizontalCenter — to center a banner horizontally.
  • AppodealViewPosition.HorizontalRight — to align a banner to the right.
  • AppodealViewPosition.HorizontalLeft — to align a banner to the left.
Banner positioning is relative to the top left corner of the screen.

Hide Banner

To hide a banner that was shown via Appodeal.ShowBannerView() method use the following method:

Appodeal.HideBannerView();

Advanced

Placements

Appodeal SDK allows you to tag each impression with different placement. To use placements, you need to create placements in Appodeal Dashboard. Read more about placements.

To show an ad with placement, you have to call show method with specifying placement's name:

Appodeal.Show(AppodealShowStyle.BannerTop, "placementName");

Destroy Hidden Banner

To free memory from hidden banner call the code below:

Appodeal.Destroy(AppodealAdType.Banner);

Get Predicted eCPM

This method returns expected eCPM for a currently cached advertisement. The amount is calculated based on historical data for the current ad unit.

Appodeal.GetPredictedEcpm(AppodealAdType.Banner);

Enable 728x90 Banners

To enable 728*90 banner use the following method before initialization:

Appodeal.SetTabletBanners(true);

Disable Banner Refresh Animation

To disable banner refresh animation use the following method before initialization:

Appodeal.SetBannerAnimation(false);

Smart Banners

Smart banners are the banner ads which automatically fit the screen size. Using them helps to deal with the increasing fragmentation of the screen sizes on different devices. In the Appodeal SDK the smart banners are enabled by default. To disable them, use the following method before initialization:

Appodeal.SetSmartBanners(false);