A rewarded ad is a full-screen video ad that users can choose to watch in full to receive an in-app reward. Rewards typically come in the form of in-game currency, such as lives or coins. The RTB-Stack SDK makes it easy to integrate and manage rewarded video ads in Unity.
Follow these steps to load and display rewarded video ads when necessary:
First, import the SDK into your Unity class:
using Plugins.RtbStackSDK;
To load a rewarded video ad, call the following method:
RtbStackSDK.LoadRewarded("ENDPOINT_REQUEST_URL", "TAG_ID");
Details:
Subscribe to rewarded video ad events to track loading, errors, clicks, and rewards:
RtbStackSDK.onRewardedAdLoadedEvent += onRewardedAdLoaded;
RtbStackSDK.onRewardedAdFailedToLoadEvent += onRewardedAdFailedToLoad;
RtbStackSDK.onRewardedAdClickedEvent += onRewardedAdClicked;
RtbStackSDK.onUserEarnedRewardEvent += onUserEarnedReward;
void onRewardedAdLoaded() {
// Handle rewarded ad loaded
}
void onRewardedAdFailedToLoad(string error) {
// Handle rewarded ad load failure
}
void onRewardedAdClicked(string url) {
// Handle rewarded ad click
}
void onUserEarnedReward(RtbStackSDK.RewardItem item) {
// Handle user reward
}
Once the rewarded video ad is loaded, you can display it using the following method:
RtbStackSDK.ShowRewarded();
After the ad is closed, destroy the rewarded video ad to free up resources:
RtbStackSDK.DestroyRewarded();
You can configure the following rewarded video options:
Set the click action for the rewarded video ad:
RtbStackSDK.SetRewardedClickThroughAction(RtbStackSDK.ClickThroughAction.OPEN_DEVICE_BROWSER);
The available click actions are:
OPEN_SDK_BROWSER
OPEN_DEVICE_BROWSER
RETURN_URL