Page Summary
-
Rewarded interstitial is an incentivized ad format providing rewards for ads appearing automatically during app transitions without requiring user opt-in.
-
Before loading ads, initialize the Google Mobile Ads SDK once at app launch.
-
The main steps to integrate rewarded interstitial ads include loading, showing, listening to events, cleaning up, and preloading the next ad.
-
Rewarded interstitial ads are one-time-use objects and you should preload the next ad after the current one is closed or fails to open.
-
Always test with test ads and configure your device as a test device during development to avoid impacting production data.
Rewarded interstitial is a type of incentivized ad format that lets you offer rewards for ads that appear automatically during natural app transitions. Unlike rewarded ads, users aren't required to opt-in to view a rewarded interstitial.
Prerequisites
Before you continue, set up Google Mobile Ads Unity Plugin.
Always test with test ads
The following sample code contains an ad unit ID which you can use to request test ads. It's been specially configured to return test ads rather than production ads for every request, making it safe to use.
However, after you've registered an app in the Ad Manager web interface and created your own ad unit IDs for use in your app, explicitly configure your device as a test device during development.
/21775744923/example/interstitial
Initialize Google Mobile Ads Unity Plugin
Before loading ads, have your app initialize Google Mobile Ads Unity Plugin by calling
MobileAds.Initialize(). This needs to be done only once, ideally at app launch.
using GoogleMobileAds;
using GoogleMobileAds.Api;
public class GoogleMobileAdsDemoScript : MonoBehaviour
{
public void Start()
{
// Initialize Google Mobile Ads Unity Plugin.
MobileAds.Initialize((InitializationStatus initStatus) =>
{
// This callback is called once the MobileAds SDK is initialized.
});
}
}
If you're using mediation, wait until the callback occurs before loading ads as this will ensure that all mediation adapters are initialized.
Implementation
The main steps to integrate rewarded interstitial ads are:
- Load the rewarded interstitial ad
- [Optional] Validate server-side verification (SSV) callbacks
- Show the rewarded interstitial ad with reward callback
- Listen to rewarded interstitial ad events
- Clean up the rewarded interstitial ad
- Preload the next rewarded interstitial ad
Load the rewarded interstitial ad
Loading a rewarded interstitial ad is accomplished using the static Load()
method on the RewardedInterstitialAd class. The load method requires an ad
unit ID, an AdManagerAdRequest object, and a completion
handler which gets called when ad loading succeeds or fails. The loaded
RewardedInterstitialAd object is provided as a parameter in the completion
handler. The example below shows how to load a RewardedInterstitialAd.
// This ad unit is configured to always serve test ads.
private string _adUnitId =