Rewarded Interstitial

Rewarded interstitial is a type of incentivized ad format that allows 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

  • Google Mobile Ads SDK 7.60.0 or higher.
  • Follow the Get Started guide to import the Google Mobile Ads SDK.
  • Reach out to your account manager to get access to rewarded interstitial.

Implementation

The main steps to integrate rewarded interstitial ads are:

  1. Load an ad.
  2. Register for callbacks.
  3. Display the ad and handle the reward event.

Load an ad

Loading an ad is accomplished using the static loadWithAdUnitID:request:completionHandler: method on the GADRewardedInterstitialAd class. The load method requires your ad unit ID, a DFPRequest object, and a completion handler which gets called when ad loading succeeds or fails. The loaded GADRewardedInterstitialAd object is provided as a parameter in the completion handler. The below example shows how to load a GADRewardedInterstitialAd in your ViewController class.

#import "ViewController.h"

@interface ViewController ()
@property(nonatomic, strong) GADRewardedInterstitialAd* rewardedInterstitialAd;
@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  [GADRewardedInterstitialAd
       loadWithAdUnitID:@"ad unit ID"
                request:[DFPRequest request]
      completionHandler:^(
          GADRewardedInterstitialAd* _Nullable rewardedInterstitialAd,
          NSError* _Nullable error) {
        if (!error) {
          self.rewardedInterstitialAd = rewardedInterstitialAd;
        }
      }
  ];
}

Register for callbacks

In order to receive notifications for presentation events, you must implement the GADFullScreenContentDelegate protocol and assign it to the fullScreenContentDelegate property of the returned ad. The GADFullScreenContentDelegate protocol handles callbacks for when the ad presents successfully or unsuccessfully, and when it is dismissed. The following code shows how to implement the protocol and assign it to the ad:

@interface ViewController ()<GADFullScreenContentDelegate>
@property(nonatomic, strong) GADRewardedInterstitialAd *rewardedInterstitialAd;
@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view.

  [GADRewardedInterstitialAd
       loadWithAdUnitID:@"ca-app-pub-3940256099942544/4806952744"
                request:[DFPRequest request]
      completionHandler:^(
          GADRewardedInterstitialAd *_Nullable rewardedInterstitialAd,
          NSError *_Nullable error) {
        if (!error) {
          self.rewardedInterstitialAd = rewardedInterstitialAd;
          self.rewardedInterstitialAd.fullScreenContentDelegate = self;
        }
      }];
}

/// Tells the delegate that the ad failed to present full screen content.
- (void)ad:(nonnull id<GADFullScreenPresentingAd>)ad
didFailToPresentFullScreenContentWithError:(nonnull NSError *)error {
    NSLog(@"Ad did fail to present full screen content.");
}

/// Tells the delegate that the ad presented full screen content.
- (void)adDidPresentFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {

    NSLog(@"Ad did present full screen content.");
}

/// Tells the delegate that the ad dismissed full screen content.
- (void)adDidDismissFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {
   NSLog(@"Ad did dismiss full screen content.");
}

Display the ad and handle the reward event

When presenting your ad, you must provide a GADUserDidEarnRewardHandler object to handle the reward for the user.

The following code presents the best method for displaying a rewarded interstitial ad.

- (void)show {
  [_rewardedInterstitialAd presentFromRootViewController:self
                                userDidEarnRewardHandler:^{

                                  GADAdReward *reward =
                                      self.rewardedInterstitialAd.adReward;
                                  // TODO: Reward the user!
                                }];
}