Interstitial Ads

To integrate Interstitial ads, ensure you have integrated the IASDKCore Libraries. Configure the ad placement and its controllers, create an Ad Request, and then fetch and display the ad.

Importing the SDK

Import the following IASDKCore module into your desired view controller:

Objective-C
#import <IASDKCore/IASDKCore.h>

Adding Properties

Retain each IASDK module on the client side, and declare properties for:

  • adSpot (placement)

  • UnitController

  • videoContentController

  • mraidConentController

Objective-C
@property (nonatomic, strong) IAAdSpot *adSpot;
@property (nonatomic, strong) IAFullscreenUnitController *unitController;
@property (nonatomic, strong) IAVideoContentController *videoContentController;
@property (nonatomic, strong) IAMRAIDContentController *mraidContentController;

Optionally, create an IAUserData object for better ad targeting:

Objective-C
IAUserData *userData =
[IAUserData build:^(id  _Nonnull builder) { 
    builder.age = 34;     
    builder.gender = IAUserGenderTypeMale;    
    builder.zipCode = @"90210";
}];
IASDKCore.sharedInstance.userData = userData;
circle-info

The build: method is synchronous and runs on the same thread that it is invoked from, similar to iOS's enumerateObjectsUsingBlock. As a result, memory management like weak references are not needed inside the block.

Set global variables for SDK bidding provided in IASDKCore shared instance:

  • userData

  • muteAudio

  • mediationType

  • debugger

Example:

Creating the Ad Request Object

circle-info

This step is not mandatory for SDK Bidding mediation.

Initialize an IAAdRequest and provide the spotID and a timeout value:

Optionally, you can opt to mute non-rewarded interstitial ads by adding:

Initializing the Video Content Controller

Initialize the videoContentController:

Declaring Your View Controller

Declare your view controller conforms to the IAVideoContentDelegate protocol:

For more information, see Video Content Delegate Protocols.

Initializing the MRAID Content Controller

Initialize the IAMRAIDContentController:

Declaring Your View Controller

Declare your view controller conforms to the IAMRAIDContentDelegate Protocol:

For more information, see HTML/MRAID Delegate Protocols.

Initializing the Full-Screen Unit Controller

Initialize the IAFullscreenUnitController:

Declaring Your View Controller

Declare your view controller conforms to IAUnitDelegate Protocol:

For more information, see Unit Content Delegate Protocols.

Initializing the Placement

Initialize the IAAdSpot (placement) and pass your adRequest object:

Fetching the Ad

The way in which the ad is fetched depends on the mediation type — Waterfall or SDK Bidding.

Fetching the Ad for Waterfall

In Waterfall mediation, use fetchAdWithCompletion: and showAdAnimated: to fetch the ad:

Fetching the Ad for SDK Bidding

In SDK Bidding, DT Exchange must first generate a token for the Mediation SDK to use when sending the request to server.

Generating the Token

The token can be generated upon SDK initialization.

Return type: NSString *

If an error occurs, the returned value is nil.

Loading the Ad

If DT Exchange wins the auction, load the ad with the signaldata (adm) that was received from the server:

Last updated