Standard Banner in Unity

Creating a Zone

First, create a standard zone from the Tapsell panel.

Requesting Ads

Use the TapsellPlus.RequestStandardBannerAd method to request an ad. For example:

TapsellPlus.RequestStandardBannerAd(ZoneID, BANNER_TYPE,
            tapsellPlusAdModel => {
                Debug.Log ("on response " + tapsellPlusAdModel.responseId);
                _responseId = tapsellPlusAdModel.responseId;
            },
            error => {
                Debug.Log ("Error " + error.message);
            }
        );

If you want to request an ad again in the error Callback method, be sure to do so with the help of a variable such as a counter. Because you can set a limit on the number of times to request by using that variable. For example, when you disable this ad position from the panel, if you request again each time in error Callback without limiting the number of times, your app will fall into an infinite loop and its performance will be disrupted.

Showing Ads

After receiving the responseId parameter from the previous step, the Ad is ready to be shown, and you can display it as the following

TapsellPlus.ShowStandardBannerAd(_responseId, HORIZONTAL_GRAVITY, VERTICAL_GRAVITY,

            tapsellPlusAdModel => {
                Debug.Log ("onOpenAd " + tapsellPlusAdModel.zoneId);
            },
            error => {
                Debug.Log ("onError " + error.errorMessage);
            }
        );

BANNER_TYPE is the banner display size and can be the following values:

Banner TypeSizeSupported Ad Networks
BANNER_320x50320x50Tapsell, AdMob, AppLovin, UnityAds
BANNER_320x100320x100Tapsell, AdMob
BANNER_250x250250x250Tapsell
BANNER_300x250300x250Tapsell, AdMob, AppLovin
BANNER_468x60468x60AdMob, UnityAds
BANNER_728x90728x90AdMob, AppLovin, UnityAds

VERTICAL_GRAVITY andHORIZONTAL_GRAVITY are the position of the banner on the page and can be the following values.

Gravity.TOP - Gravity.BOTTOM - Gravity.LEFT - Gravity.RIGHT - Gravity.CENTER

Showing and hiding ads

By default, when a banner ad is received, it is added to the page and becomes Visible. Use this code if for any reason you want to hide the banner or show the hidden banner:

TapsellPlus.HideStandardBannerAd();
TapsellPlus.TapsellPlus.DisplayStandardBannerAd();

Removing Ads

At the end of the view life cycle or whenever you want to close the ad, you should call the following method:

TapsellPlus.DestroyStandardBannerAd(_responseId);