Page tree


Interstitial ads are full-screen ads displayed at transition points in an app; for example, when the app launches, when moving between screens, and so on. Interstitial ads exhibit the following behavior:

  • Always includes a Close button; either immediately, or shortly after, the ad displays.
  • One-time ad; once the ad is closed the same PMInterstitialAd object cannot display it again.

You'll need to follow the instructions in Getting started before proceeding with the following integration steps. You'll also find a useful example integration in SampleApp included in the SDK download bundle.

Once you've downloaded and installed the PubMatic iOS SDK, use the following sections to implement and configure Interstitial ads:

Display Interstitial Ad

Use the following steps to include Interstitial ads into your application:


Step 1: Import PMInterstitialAd.h header file 

Import PMInterstitialAd.h
#import "PMInterstitialAd.h"
The import statements may differ for different integration methods.


Step 2: Setup Interstitial Ad

  1. Create an instance of PMInterstitialAd.
  2. Set the delegate property of PMInterstitialAd's instance to PMInterstitialAdDelegatein your view controller.
  3. Implement delegate callbacks:
Setup Interstitial Ad
#import <InterstitialViewController.h>
    #import "PMInterstitialAd.h"

    // InterstitialViewController.m

    @interface InterstitialViewController ()<PMInterstitialAdDelegate>
    @property (nonatomic, retain) PMInterstitialAd * interstitialAd;
    @end

    @implementation InterstitialViewController
    - (void)viewDidLoad{

        self.interstitialAd = [[ PMInterstitialAd  alloc] init];
        self.interstitialAd.delegate = self;
    }
    @end


Step 3: Create an Interstitial Ad Request

After you have set up a InterstitialAd object, create an instance of PMInterstitialAdRequest

Create Intersitial Ad Request
PMInterstitialAdRequest * adRequest = [[PMInterstitialAdRequest alloc] initWithPublisherId:@"<#PUB_ID#>" 
                                                                       siteId:@"<#SITE_ID#>" 
                                                                       adId:@"<#AD_ID#>"];


Step 4: Request Ad

Request an Interstitial ad from PubMatic: 

Request Ad
// Make the ad request to PubMatic  
[self.interstitialAd loadRequest:adRequest];


Step 5: Receive PMInterstitialAdDelegate callbacks, then present the Interstitial ad

PubMatic SDK provides PMInterstitialAdDelegate through which your app can receive ad event callbacks: 

Receive Interstitial Ad Delegate Callbacks
// PMInterstitialAdDelegate methods
- (void)interstitialAd:( PMInterstitialAd  *)interstitialAd didFailToReceiveAdWithError:(PMError *)error{
    NSLog(@"Error - %@", error.localizedDescription);
}

- (void)interstitialAdDidRecieveAd:(PMInterstitialAd *)interstitialAd{
    if ([interstitialAd isReady]) {
        [interstitialAd show];
    }
}

@end

See PubMatic SDK Error Codes for a detailed description of the PMError object used in the interstitialAd:didFailToReceiveAdWithError: callback.


Best Practices

  • Determine whether the Interstitial ad is ready using the isReady method of the PMInterstitialAd object, as shown in step 5 above before displaying it.
  • Call the show or showForDuration: method of the PMInterstitialAd object to display the ad in full-screen. The ad displays only after it successfully loads.
  • Remember that an Interstitial ad is a one-time ad; your app can show it only once. To request another ad, call loadRequest: again or create a new PMInterstitialAd instance to request a new ad.


To fully support all MRAID events please follow the steps in Rich Media (MRAID 2.0) Support.


⇧ Top