Skip to main content

Banner

info

Here you can find our demo implementation of banner ads in Bidon.

Create An Instance

Add Bidon namespace to your script.

using Bidon.Mediation;

Create a BidonBannerAd instance as shown below.

var bidonBanner = new BidonBannerAd();

Subscribe To Events

Subscribe to desired events for receiving callbacks during ad object lifecycle.

bidonBanner.OnAdLoaded += (sender, args) =>
{
Debug.Log($"Ecpm: {args.Ad?.Ecpm}");
};

Below you can find all available events for banners.

event EventHandler<BidonAdLoadedEventArgs> OnAdLoaded;
event EventHandler<BidonAdLoadFailedEventArgs> OnAdLoadFailed;
event EventHandler<BidonAdShownEventArgs> OnAdShown;
event EventHandler<BidonAdShowFailedEventArgs> OnAdShowFailed;
event EventHandler<BidonAdClickedEventArgs> OnAdClicked;
event EventHandler<BidonAdExpiredEventArgs> OnAdExpired;
event EventHandler<BidonAdRevenueReceivedEventArgs> OnAdRevenueReceived;

Set Format

We recommend setting format before trying to load an ad.

_bannerAd.SetFormat(BidonBannerFormat.Mrec);
info

Default format is Banner

Here you can find all supported banner formats.

Banner FormatSizeDescription
Banner320 x 50Fixed size banner for phones
Leaderboard728 x 90Fixed size banner for pads
Mrec300 x 250Fixed medium rectangle banners
Adaptive-/- x 50/90Flexible width banners

Set Position

Set desired banner position and rotation using one of the following methods

info

Only the last method called will have an effect

Predefined Position

bidonBanner.SetPredefinedPosition(BidonBannerPosition.HorizontalBottom);
PositionDescription
HorizontalBottomThis position places the banner at the bottom of the screen, typically spanning horizontally
HorizontalTopThis position places the banner at the top of the screen, typically spanning horizontally
VerticalLeftThis position places the banner on the left side of the screen, typically spanning vertically
VerticalRightThis position places the banner on the right side of the screen, typically spanning vertically

Custom Position And Rotation

var offset = new Vector2Int(Screen.width / 2, Screen.height / 6);
int angle = -8;
var anchorPoint = new Vector2(0.5f, 0f);
bidonBanner.SetCustomPositionAndRotation(offset, angle, anchorPoint);
note

AnchorPoint affects rotation and positioning (x, y: 0 to 1)

Angle is in degrees (-180 to 180)

Load

double priceFloor = 0.01d;
bidonBanner.Load(priceFloor);

Show

if (bidonBanner.IsReady())
{
bidonBanner.Show();
}

Hide

if (bidonBanner.IsShowing())
{
bidonBanner.Hide();
}

Dispose

To release resources we recommend destroying instances when you don't need them anymore.

bidonBanner.Dispose();
bidonBanner = null;

Send Extra Data

note

The value has to be one of the following types: bool, char, int, long, float, double, string.

Passing null as a value will remove existing KeyValuePair from dictionary.

bidonBanner.SetExtraData("some_key", true);

You can also read all current extras as shown below:

var extras = bidonBanner.GetExtraData();

Win / Loss Notifications

Use the following methods to let Bidon know whether or not it won the show opportunity.

bidonBanner.NotifyWin();
bidonBanner.NotifyLoss("winner_demand_id", (double)winnerEcpm);