Interstitial ads are full-screen ads that cover the interface of their host app. They are typically displayed at natural transition points in the flow of an app, such as between activities or during a pause between levels in a game. The RTB-Stack SDK makes it easy to integrate and manage interstitial ads in Unity.
Follow these steps to load and display interstitial ads when necessary:
First, import the SDK into your Unity class:
using Plugins.RtbStackSDK;
To load an interstitial ad, call the following method:
RtbStackSDK.LoadInterstitial("ENDPOINT_REQUEST_URL", "TAG_ID");
Details:
Subscribe to interstitial ad events to track loading, errors, and clicks:
RtbStackSDK.onInterstitialAdLoadedEvent += onInterstitialAdLoaded;
RtbStackSDK.onInterstitialAdFailedToLoadEvent += onInterstitialAdFailedToLoad;
RtbStackSDK.onInterstitialAdClickedEvent += onInterstitialAdClicked;
void onInterstitialAdLoaded() {
// Handle interstitial loaded
}
void onInterstitialAdFailedToLoad(string error) {
// Handle interstitial load failure
}
void onInterstitialAdClicked(string url) {
// Handle interstitial click
}
Once the interstitial ad is loaded, you can display it using the following method:
RtbStackSDK.ShowInterstitial();
After the ad is closed, destroy the interstitial to free up resources:
RtbStackSDK.DestroyInterstitial();
You can configure the following interstitial options:
Set the click action for the interstitial ad:
RtbStackSDK.SetInterstitialClickThroughAction(RtbStackSDK.ClickThroughAction.OPEN_DEVICE_BROWSER);
The available click actions are:
OPEN_SDK_BROWSER
OPEN_DEVICE_BROWSER
RETURN_URL