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
PMInterstitialAdobject 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
importstatements may differ for different integration methods.
Step 2: Setup Interstitial Ad
- Create an instance of
- Set the delegate property of
PMInterstitialAd's instance to
PMInterstitialAdDelegatein your view controller.
- Implement delegate callbacks:
Step 3: Create an Interstitial Ad Request
After you have set up a
InterstitialAd object, create an instance of
Step 4: Request Ad
Request an Interstitial ad from PubMatic:
Step 5: Receive
PMInterstitialAdDelegate callbacks, then present the Interstitial ad
PubMatic SDK provides
PMInterstitialAdDelegate through which your app can receive ad event callbacks:
See PubMatic SDK Error Codes for a detailed description of the
PMError object used in the
- Determine whether the Interstitial ad is ready using the
isReadymethod of the
PMInterstitialAdobject, as shown in step 5 above before displaying it.
- Call the
showForDuration:method of the
PMInterstitialAdobject 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
PMInterstitialAdinstance to request a new ad.
To fully support all MRAID events please follow the steps in Rich Media (MRAID 2.0) Support.