Banner/MREC Ads

To integrate Banner/MREC 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 example:

Objective-C
@property (nonatomic, strong) IAAdSpot *adSpot;
@property (nonatomic, strong) IAViewUnitController*viewUnitController;
@property (nonatomic, strong) IAMRAIDContentController*mraidContentController;

Optionally, create the 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:

Initializing the MRAID Content Controller

Initialize the IAMRAIDContentController:

Declaring Your View Controller

Declare that your view controller conforms to the IAMRAIDContentDelegate protocol:

For more information, see HTML/MRAID Delegate Protocols.

Initializing the View Unit Controller

Initialize the IAViewUnitController:

Declaring Your View Controller

Declare that your view controller conforms to the IAUnitDelegate protocol:

For more information, see Unit Content Delegate Protocols.

Initializing the Placement

Initialize the IAAdSpot 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 showAdInParentView: 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 the 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