iOS Guidelines | Interstitial Ads

Interstitial ads are full page ads placed at natural break points in the app flow. With 10 times the real estate as compared to banner ads, Interstitials are guaranteed to catch your users' eyes and drive higher revenue for your mobile business.

Follow these steps to start monetizing with Interstitial ads:

Setting up an Interstitial Ad

After adding your app, select INTERSTITIAL to create a placement for ad type Interstitial.

Once you create the Interstitial placement, you will have the placement id.

Creating an Interstitial Ad

The IMInterstitial is simply a UIViewController subclass displaying full screen ads that respond to user touch.

Follow these steps to create the interstitial ad unit programmatically:

  1. Import the headers and declare an interstitial instance in your ViewController.swift file. Your ViewController header file should look like this:
    import UIKit
    import InMobiSDK
    class ViewController: UIViewController, IMInterstitialDelegate {
        var interstitial: IMInterstitial?
    }
    		
  2. Instantiate the interstitial object. Your viewDidLoad method in ViewController.swift file should look like this:
    override func viewDidLoad() {
            super.viewDidLoad()
            interstitial = IMInterstitial.init(placementId: 1446377525790)
            interstitial?.delegate = self
            interstitial?.load()
    }
    		
  3. For ad status callbacks, implement the delegate property of IMInterstitial. The following callbacks are supported:
     /**
         * Notifies the delegate that the ad server has returned an ad. Assets are not yet available.
         * Please use interstitialDidFinishLoading: to receive a callback when assets are also available.
         */
        public func interstitialDidReceiveAd(_ interstitial: IMInterstitial!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the interstitial has finished loading and can be shown instantly.
         */
        public func interstitialDidFinishLoading(_ interstitial: IMInterstitial!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the interstitial has failed to load with some error.
         */
        public func interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) {
            NSLog("[ViewController %@]", #function)
            NSLog("Interstitial ad failed to load with error %@", error)
        }
        /**
         * Notifies the delegate that the interstitial would be presented.
         */
        public func interstitialWillPresent(_ interstitial: IMInterstitial!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the interstitial has been presented.
         */
        public func interstitialDidPresent(_ interstitial: IMInterstitial!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the interstitial has failed to present with some error.
         */
        public func interstitial(_ interstitial: IMInterstitial!, didFailToPresentWithError error: IMRequestStatus!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the interstitial will be dismissed.
         */
        public func interstitialWillDismiss(_ interstitial: IMInterstitial!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the interstitial has been dismissed.
         */
        public func interstitialDidDismiss(_ interstitial: IMInterstitial!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the interstitial has been interacted with.
         */
        public func interstitial(_ interstitial: IMInterstitial!, didInteractWithParams params: [AnyHashable : Any]!) {
            NSLog("[ViewController %@]", #function)
        }
        /**
         * Notifies the delegate that the user will leave application context.
         */
        public func userWillLeaveApplication(from interstitial: IMInterstitial!){
            NSLog("[ViewController %@]", #function)
        }
    		
  4. To show the Interstitial Ad, use the following code:
    interstitial?.show(from: self)
    //interstitial?.show(from: self, with:.coverVertical)
    		

    Here are the possible animation types:

    • coverVertical
    • flipHorizontal
    • none

Important:

  • Make sure that interstitialDidFinishLoading delegate is fired before making a call to show(from viewController: UIViewController!). Otherwise, the error callback interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) will be fired.
  • Every time an interstitial ad is shown and subsequently dismissed, you will need to invoke interstitial?.load() again. Without this, you won't be able to call show(from viewController: UIViewController!) again.

Retrieving CreativeID

At times, there are rogue advertisers who escape all the ad quality checks and end up compromising the user experience on the app by showcasing either an irrelevant, distasteful or disrupting creative to the user. To combat such situations, you can retrieve the creativeID of the ad instance and report back to your InMobi point of contact with the encrypted creativeID.

		public func interstitialDidFinishLoading(_ interstitial: IMInterstitial!) {
        interstitial.creativeId
    }
	

Testing the Integration

  1. Configure the test mode on InMobi portal.

    Go to Tools - Diagnostics and switch Test Mode to either Global ON or Selective ON.

    If you are integrating an ad unit for the first time Set Test Mode to Global ON.
    If you want to selectively turn on test traffic for a set of devices·

    You already have a prior version of the SDK integrated for this particular ad unit and therefore you should restrict your testing to only few devices
    Set Test Mode to Selective ON.

    In the device section:

    1. In the Device ID box, type the device ID.
    2. In the Device Name box, set any name.
    3. Click Add Device to add the test device.

    If you already have a device configured, you can select the device and test mode will be enabled.

    Note: You MUST turn off the test mode before going live or else your app will fail to monetize.

    Now you are all set to get test ads.

    Getting the Device ID

    import AdSupport
    let deviceId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
    		

    You can enter this device id in the Device ID box.

  2. You will also get feedback on the diagnostics tab on the ad unit and ad request and this can be particularly helpful during integration.

  3. You should also see these key InMobi SDK logs in console when a interstitial ad is successfully loaded:

    [InMobi] InMobi SDK initialized with account id: <your account id here>

    [InMobi] Fetching interstitial ad for placement id: <your placement id here>

    [InMobi] Publisher device id is <device id here>

    [InMobi] Interstitial ad successfully fetched for placement id: <your placement id here>

  4. Now you would also see the InMobi test ads on your application.
  5. If the SDK is not initialised correctly before creating an ad, you would typically see these logs :

    ** ERROR ** [InMobi] ___ Please initialize the SDK before creating a <ad format> ad.

    ** ERROR ** [InMobi] ___ Account id cannot be null or empty. Please provide a valid Account id.

    [InMobi] Invalid account id passed to init. Please provide a valid account id.

The complete set of key logs are documented in the following tables.

SDK Initialization

Scenario Log Level Logs
Publisher passed null or empty account id Error Account id cannot be null or empty. Please provide a valid Account id.
Publisher passed a valid account id Debug InMobi SDK initialized with account id: <account id>
Publisher passed an invalid account Id Error Invalid account id passed to init. Please provide a valid account id.
Newer version of SDK is available Debug A newer version (ver. 9.0.0) of the InMobi SDK is available! You are currently on an older version (ver. 5.3.1). Download the latest InMobi SDK from http://www.inmobi.com/products/sdk/#downloads

Ads Common

Scenario Log Level Logs
Ad requested when no network available Error Network not reachable currently. Please try again.
Ad requested when ad state is loading or available Error An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id :<placement id> ).
Ad requested when ad is viewed by user Error An ad is currently being viewed by the user. Please wait for the user to close the ad before requesting for another ad (Placement id : <placement id> ).

Interstitial Ads

Scenario Log Level Logs
Publisher created a interstitial without initializing the SDK Error Please initialize the SDK before creating a interstitial ad
Publisher created a interstitial with an invalid placement id Error Please provide a valid placement id to create a interstitial ad
Publisher called load on an interstitial Debug Fetching an interstitial ad for placement id: <placement id>
Successfully fetched ad Debug Interstitial ad successfully fetched for placement id: <placement id>
Failed to fetch the ad Error Failed to fetch Interstitial ad for placement id:<Placement id> with error:<Status code / message>
Started loading the interstitial in a webview Debug Started loading Interstitial ad markup in the webview for placement id: <Placement id>
Interstitial successfully loaded in the webview Debug Successfully loaded Interstitial ad markup in the webview for placement id: <placement id>
Failed to load interstitial in the webview Error Failed to load the Interstitial markup in the webview for placement id: <placement id>
Interstitial Ad displayed Debug Successfully displayed Interstitial for placement id:<placement id>
Interstitial Ad dismissed Debug Interstitial ad dismissed for placement id:<placement id>
Ad show before ready Show ad before it's ready Error Ad Load is not complete. Please wait for the Ad to be in a ready state before calling show
Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad. Error Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad.

Advanced: InMobi Custom Frames

Supercharge the full-screen experience by making the most of your in-game assets like characters, themes, and interactions to introduce interstitial ads which look like an extension of your game design.

Getting Started with Custom Frames

In order to activate Custom Frames on your interstitial ads, integrate with InMobi Interstitial ads and activate “Custom Frames” while creating the Interstitial placement.

  1. Specify the device you want to target the ad, and then select the orientation of your interstitial ad.
  2. Upload a frame, or select one of the preset frames. Ensure that you comply with the “Custom Frame Specification” mentioned in the section below.
  3. Upload a close button, or select one of the preset close buttons. You can choose the placement of the close button at either the top left or top right corner.
  4. Change the creative size to fit the interstitial ad and modify the placement of the creative using the “Creative Ad Position” to fit the interstitial ad perfectly. Ensure that the creative fits into the inner container of the frame and does not spill out.

More Details

Understanding Device Size and Orientation

InMobi Custom Frames are tied to a particular device size and orientation. This is important because you upload, or select, a specific frame to go with the device size and orientation combination.

Notes:

  • If you have an app that is usable in both landscape and portrait modes, and you make interstitial ad calls in both modes, you must create two custom frame ad units, one for each landscape and portrait. InMobi will automatically pick the right template based on the ad request orientation.
  • If you use the same placement Id for phones and tablets, you must create separate custom frame ad units for phones and tablets to make sure you can serve interstitial units with custom frames across all devices.
Understanding InMobi Default Templates

If you have at least one InMobi Custom Frame, you will see a listing page containing different custom frames, along with their performance metrics. The first item is called InMobi Default. You cannot edit this template, nor can you pause or delete this unit.

InMobi Default templates are used in two cases:

  • When an incoming ad request and ad combination does not match any custom frame unit created.
  • When InMobi, through its optimization logic, detects that not using a custom frame might actually give better performance. For example, there are certain creatives that will not work with custom frames. In this case, the InMobi Default template is used to make sure that InMobi can render these high eCPM creatives in your ad slot.

Note: You cannot turn off the InMobi Default template.

Custom Frame Specification

Please keep in mind the following when designing custom frames for your interstitial ads:

  • The ad will appear in a transparent area (called the 'inner container') inside the frame.

  • In the image above, the inner container is the section in blue.
    • The inner container must be a rectangular figure with the same aspect ratio as the interstitial ad slot. That is, 2:3 for a 320x480 slot, 8:5 for a 1280x800 slot, and so on.
    • The inner container must be a transparent area.
    • The inner container cannot be less than 70% of the interstitial size. This means that for a 320x480 interstitial slot, the inner container should not be less than 224x336.
    • The inner edges of the frame must not be cluttered. That is, it should not disrupt the inner ad area. Strict rectangular corners, or very slightly rounded corners are allowed.
    • Refer the table below for the sizes supported:
    Device Orientaton Frame Size Inner Container Size

    Smartphone 1

    Portrait

    320x480 (RGB, 72ppi)

    240x360

    Landscape

    480x320 (RGB, 72ppi)

    360x240

    Smartphone 2

    Portrait

    320x568 (RGB, 72ppi)

    250x444

    Landscape

    568x320 (RGB, 72ppi)

    444x250

    Tablet 1

    Portrait

    768x1024 (RGB, 72ppi)

    576x768

    Landscape

    1024x768 (RGB, 72ppi)

    768x576

    Tablet 2

    Portrait

    800x1280 (RGB, 72ppi)

    600x960

    Landscape

    1280x800 (RGB, 72ppi)

    960x600

  • Create the close button on a transparent area with an aspect ratio of 1:1. The allowed sizes are 15x15 px or 40x40 px.

Notes:

  • Frames and Close buttons must be uploaded in PNG format.
  • Background color and translucency are added by the SDK.

A/B Testing

Experiment with custom frames for the same interstitial placement by creating multiple concepts (for example, different colors, different characters, with and without animation, and so on) and distributing exposure across these concepts.

  • When testing new concepts, limit exposure to them to ensure that the monetization potential of your property is not affected. To limit the number of ad impressions served on the new concepts, you can select the Limit Exposure check box.
  • Once you are sure of the performance of the concept, you can uncheck the Limit Exposure check box.