Banner Ad Format

A banner is a rectangular ad format with predefined sizes, typically displayed at the bottom of the screen, within content, or in a content feed. Follow the steps below to integrate and manage banner ads in Unity.

1. Import RTB-Stack SDK

First, import the SDK into your Unity class:

using Plugins.RtbStackSDK;

2. Show a Banner Ad

To load and display a banner ad, call the following method:

int [,] sizes = {{300, 250}};
RtbStackSDK.LoadBanner("ENDPOINT_REQUEST_URL", "TAG_ID", sizes, RtbStackSDK.BannerPosition.BOTTOM);

Details:

  • ENDPOINT_REQUEST_URL: Obtain this from the Edit Endpoint window as described in the following article.
  • TAG_ID: Use a random string value as a Tag ID for reporting purposes.
  • sizes: Define the dimensions of the banner ad (e.g., 300x250 pixels).
  • BannerPosition.BOTTOM: Specify the position of the banner (options: TOP, CENTER, BOTTOM).

3. Listen for Banner Events

Subscribe to banner events to track loading, errors, and clicks:

RtbStackSDK.onBannerAdLoadedEvent += onBannerAdLoaded;
RtbStackSDK.onBannerAdFailedToLoadEvent += onBannerAdFailedToLoad;
RtbStackSDK.onBannerAdClickedEvent += onBannerAdClicked;

void onBannerAdLoaded(string tagID) {
    // Handle banner loaded
}

void onBannerAdFailedToLoad(string tagID, string error) {
    // Handle banner load failure
}

void onBannerAdClicked(string tagID, string url) {
    // Handle banner click
}

4. Destroy the Banner

When the banner ad is no longer needed, destroy it to free up resources:

RtbStackSDK.DestroyBanner("TAG_ID");

5. Banner Options

The RTB-Stack SDK allows you to configure the following banner options:

Click Action

Set the click action for the banner:

RtbStackSDK.SetBannerClickThroughAction("TAG_ID", RtbStackSDK.ClickThroughAction.OPEN_DEVICE_BROWSER);

The available click actions are:

  • OPEN_SDK_BROWSER
  • OPEN_DEVICE_BROWSER
  • RETURN_URL
Enable or Disable Ad Auto-Refresh

You can enable or disable auto-refresh for the banner:

// Enable auto-refresh
RtbStackSDK.SetBannerAutoRefreshEnabled("TAG_ID", true);

// Disable auto-refresh
RtbStackSDK.SetBannerAutoRefreshEnabled("TAG_ID", false);

Updated on March 15, 2025