Interstitial Ads

Interstitial ads are full-screen ads that cover the interface of an app until closed by the user. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app.

This guide shows you how to integrate interstitials from AdMob into an iOS app.

Prerequisites

Create a GADInterstitial object

AdMob interstitials are requested and shown by GADInterstitial objects. The first step in using one is to instantiate it and set its ad unit ID. For example, here's how to create an GADInterstitial in the viewDidLoad: method of a UIViewController:

Swift

import GoogleMobileAds
import UIKit

class ViewController: UIViewController {

  var interstitial: GADInterstitial!

  override func viewDidLoad() {
    super.viewDidLoad()
    interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910")
  }
}

Objective-C

@import GoogleMobileAds;
@import UIKit;

@interface ViewController ()

@property(nonatomic, strong) GADInterstitial *interstitial;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  self.interstitial = [[GADInterstitial alloc]
      initWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"];
}

GADInterstitial is a single-use object that will load and display one interstitial ad. To display multiple interstitial ads, an app needs to create a GADInterstitial for each one.

Always test with test ads

The sample code above contains an ad unit ID and you're free to request ads with it. It's been specially configured to return test ads rather than production ads for every request, which makes it safe to use.

However, once you register an app in the AdMob UI and create your own ad unit IDs for use in your app, you'll need to explicitly configure your device as a test device when you're developing. This is extremely important. Testing with real ads (even if you never tap on them) is against AdMob policy and can cause your account to be suspended. See Test Ads for information on how you can make sure you always get test ads when developing.

Load an ad

To load an interstitial, call the GADInterstitial object's loadRequest: method. This method accepts a GADRequest object as its single argument:

Swift

import GoogleMobileAds
import UIKit

class ViewController: UIViewController {

  var interstitial: GADInterstitial!

  override func viewDidLoad() {
    super.viewDidLoad()
    interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910")
    let request = GADRequest()
    interstitial.load(request)
  }
}

Objective-C

@import GoogleMobileAds;
@import UIKit;

@interface ViewController ()

@property(nonatomic, strong) GADInterstitial *interstitial;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  self.interstitial = [[GADInterstitial alloc]
      initWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"];
  GADRequest *request = [GADRequest request];
  [self.interstitial loadRequest:request];
}

Show the ad

Interstitials should be displayed during natural pauses in the flow of an app. Between levels of a game is a good example, or after the user completes a task. To show an interstitial, check the isReady property on GADInterstitial to verify that it's done loading, then call presentFromRootViewController:. Here's an example of how to do this in one of the action methods in a UIViewController:

Swift

@IBAction func doSomething(_ sender: AnyObject) {
  ...
  if interstitial.isReady {
    interstitial.present(fromRootViewController: self)
  } else {
    print("Ad wasn't ready")
  }
}

Objective-C

- (IBAction)doSomething:(id)sender {
  ...
  if (self.interstitial.isReady) {
    [self.interstitial presentFromRootViewController:self];
  } else {
    NSLog(@"Ad wasn't ready");
  }
}

Use GADInterstitialDelegate to reload

GADInterstitial is a one time use object. That means once an interstitial is shown, hasBeenUsed returns true and the interstitial can't be used to load another ad. To request another interstitial, you'll need to create a new GADInterstitial object.

The best place to allocate another interstitial is in the interstitialDidDismissScreen: method on GADInterstitialDelegate so that the next interstitial starts loading as soon as the previous one is dismissed. You may even consider breaking out interstitial initialization into its own helper method:

Swift

override func viewDidLoad() {
  super.viewDidLoad()
  interstitial = createAndLoadInterstitial()
}

func createAndLoadInterstitial() -> GADInterstitial {
  var interstitial = GADInterstitial(adUnitID: "ca-app-pub-3940256099942544/4411468910")
  interstitial.delegate = self
  interstitial.load(GADRequest())
  return interstitial
}

func interstitialDidDismissScreen(_ ad: GADInterstitial) {
  interstitial = createAndLoadInterstitial()
}

Objective-C

- (void)viewDidLoad {
  [super viewDidLoad];
  self.interstitial = [self createAndLoadInterstitial];
}

- (GADInterstitial *)createAndLoadInterstitial {
  GADInterstitial *interstitial =
      [[GADInterstitial alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"];
  interstitial.delegate = self;
  [interstitial loadRequest:[GADRequest request]];
  return interstitial;
}

- (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial {
  self.interstitial = [self createAndLoadInterstitial];
}

By preloading another interstitial immediately after the previous one is dismissed, your app is prepared to show an interstitial again at the next logical break point.

Some best practices

Consider whether interstitial ads are the right type of ad for your app.
Interstitial ads work best in apps with natural transition points. The conclusion of a task within an app, like sharing an image or completing a game level, creates such a point. Because the user is expecting a break in the action, it's easy to present an interstitial ad without disrupting their experience. Make sure you consider at which points in your app's workflow you'll display interstitial ads and how the user is likely to respond.
Remember to pause the action when displaying an interstitial ad.
There are a number of different types of interstitial ads: text, image, video, and more. It's important to make sure that when your app displays an interstitial ad, it also suspends its use of some resources to allow the ad to take advantage of them. For example, when you make the call to display an interstitial ad, be sure to pause any audio output being produced by your app. You can resume playing sounds in the interstitialDidDismissScreen: event handler, which will be invoked when the user has finished interacting with the ad. In addition, consider temporarily halting any intense computation tasks (such as a game loop) while the ad is being displayed. This will make sure the user doesn't experience slow or unresponsive graphics or stuttered video.
Allow for adequate loading time.
Just as it's important to make sure you display interstitial ads at an appropriate time, it's also important to make sure the user doesn't have to wait for them to load. Loading the ad in advance by calling loadRequest: before you intend to call presentFromRootViewController: can ensure that your app has a fully loaded interstitial ad at the ready when the time comes to display one.
Don't flood the user with ads.
While increasing the frequency of interstitial ads in your app might seem like a great way to increase revenue, it can also degrade the user experience and lower clickthrough rates. Make sure that users aren't so frequently interrupted that they're no longer able to enjoy the use of your app.

Additional resources

Samples

Mobile Ads Garage video tutorials

Next steps

Send feedback about...

AdMob for iOS
AdMob for iOS
Need help? Visit our support page.