Interstitial Integration

Interstitial ads provide full screen experiences, you can preload an interstitial ad and show it during the normal flow in your app. You can use the InstalInterstitial object and its associated listeners to fetch and display interstitial ads in your app.

Prerequisites:

Before integrating interstitial ads in your app, you’ll need to go through the steps in our Getting Started Guide to integrate the SDK into your project.

Basic integration

  1. In your view controller's header file:
    • Import the INInterstitialAdController.h header file and declare an INInterstitialAdController *interstitial property.
    • Declare that your view controller implements the INInterstitialAdControllerDelegate protocol.
  2. In your view controller's implementation file, instantiate an INInterstitialAdController using the class convenience method +interstitialAdControllerForAdUnitId:, passing in your ad unit ID.
  3. Register your view controller as the interstitial's delegate. (e.g. self.interstitial.delegate = self;)
  4. Pre-fetch the interstitial ad by calling -loadAd on the interstitial.
  5. When you'd like to display the ad, check the ad's ready property.
  6. If the ad is ready to be shown, call -showFromViewController: on the interstitial, passing in your view controller.

Sample Code

// MyViewController.h

#import "INInterstitialAdController.h"

@interface MyViewController : UIViewController <INInterstitialAdControllerDelegate>
@property (nonatomic, retain) MPInterstitialAdController *interstitial;
@end
// MyViewController.h
#import "MyViewController.h"
@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.interstitial = [INInterstitialAdController
                         interstitialAdControllerForAdUnitId:@"YOUR_ADUNIT_ID"];
    self.interstitial.delegate = self;

    [self.interstitial loadAd];
}


// Present the ad only after it is ready.
- (void)levelDidEnd {
    if (self.interstitial.ready){
        [self.interstitial showFromViewController:self];
    } else {
        // The interstitial wasn't ready, so continue as usual.
    }
}

Delegates

You can recieve various delegagates call about interstitial status

Detecting When an Interstitial Ad is Loaded:

- (void)interstitialDidLoadAd:(INInterstitialAdController *)interstitial;
- (void)interstitialDidFailToLoadAd:(INInterstitialAdController *)interstitial;

Detecting When an Interstitial Ad is Presented

- (void)interstitialWillAppear:(INInterstitialAdController *)interstitial;
- (void)interstitialDidAppear:(INInterstitialAdController *)interstitial;

Detecting When an Interstitial Ad is Dismissed

- (void)interstitialWillDisappear:(INInterstitialAdController *)interstitial;
- (void)interstitialDidDisappear:(INInterstitialAdController *)interstitial;
- (void)interstitialDidReceiveTapEvent:(INInterstitialAdController *)interstitial;

A complete ViewController is available in sample app.