Skip to main content
Table of contents

App Bidding - Other Ad Servers

This guide explains how to integrate Criteo Direct Bidding for App solution to your iOS app for all other supported ad servers.

Prerequisites

App Bidding - Other Ad Servers - SDK Initialization

Criteo SDK is designed to be used as a singleton. We have provided access to the singleton instance via the sharedCriteo property of the Criteo class.

Initialize Criteo SDK, ideally in your AppDelegate, with registerCriteoPublisherId:withAdUnits:. This needs to be done only once.

Parameter

Type

Description

criteoPublisherId

NSString

Your Criteo Publisher ID

adUnits

NSArray<CRAdUnit>

List of AdUnits you'd like Criteo to monetize

App Bidding - Other Ad Servers - Banner - Load Criteo Bids

Load Criteo bids using loadBidForAdUnit:responseHandler: method that takes 2 parameters:

Parameter

Type

Description

adUnit

CRBannerAdUnit

CRBannerAdUnit object for this request

responseHandler

(void (^)(CRBid *bid))

A handler that will be executed when a response is received, or timed out. The handler passes a CRBid object, or nil if no bid.

App Bidding - Other Ad Servers - Banner - Set Criteo Bids

Set Criteo bids on Ad Server object

On the response handler, check if the CRBid object is not nil, then call enrichAdObject:withBid: to set the bid on a NSMutableDictionary object.

Parameter

Type

Description

dictionary

NSMutableDictionary

An empty dictionary

bid

CRBid

CRBid object returned by the response handler

Then, you can set the bid into your Ad Server object, and load the Banner ad.

If Criteo has bids for the current impression, Criteo SDK will update the dictionary and it will contain the following keys:

Key

Value Type

Description

crt_cpm

String

CPM bid in numerical string format

crt_displayUrl

String

Display URL to be added into a <script> tag
if you choose to display Criteo ads.

crt_size

String

Size of banner in [width]x[height], e.g. 320x50

You will then be able to use crt_cpm to let Criteo participates in your bidding ad server, crt_displayUrl and crt_size to render the banner when Criteo wins the auction. In a standard ad server setup, these 3 values are set as keyvalue targeting.

App Bidding - Other Ad Servers - Interstitial - Load Criteo Bids

Load Criteo bids using loadBidForAdUnit:responseHandler: method that takes 2 parameters:

Parameter

Type

Description

adUnit

CRInterstitialAdUnit

CRInterstitialAdUnit object for this request

responseHandler

(void (^)(CRBid *bid))

A handler that will be executed when a response is received, or timed out. The handler passes a CRBid object, or nil if no bid.

App Bidding - Other Ad Servers - Interstitial - Set Criteo Bids

Set Criteo bids on Ad Server object

On the response handler, check if the CRBid object is not nil, then call enrichAdObject:withBid: to set the bid on a NSMutableDictionary object.

Parameter

Type

Description

dictionary

NSMutableDictionary

An empty dictionary

bid

CRBid

CRBid object returned by the response handler

Then, you can set the bid into your Ad Server object, and load the Banner ad.

If Criteo has bids for the current impression, Criteo SDK will update the dictionary and it will contain the following keys:

Key

Value Type

Description

crt_cpm

String

CPM bid in numerical string format

crt_displayUrl

String

Display URL to be added into a <script> tag
if you choose to display Criteo ads.

You will then be able to use crt_cpm to let Criteo participates in your bidding ad server, and crt_displayUrl to render the banner when Criteo wins the auction. In a standard ad server setup, these 2 values are set as keyvalue/keyword targeting.

App Bidding - Other Ad Servers - Ad Server Setup - Line Items

Criteo App Bidding solution works best with high density price granularity line item setup. You will need to create the first line item as a base template, and duplicate the line item for all other price granularity.

For each price granularity, your line items should have matching CPM rate and keyword targeting. For example, a $1 line item would have a $1 CPM rate as well as 1.00 keyword targeting. Please note that keyword targeting is always defined in two decimal places.

App Bidding - Other Ad Servers - Ad Server Setup - Creative

Assuming that your ad server will handle the presentation of the ad and create an appropriate webview in order to render the ad, below is an example of a creative you can set in your ad server.

With the macro available from your ad server, retrieve crt_displayUrl as src property of a <script> tag.

App Bidding - In-House bidding - SDK Initialization

Criteo SDK is designed to be used as a singleton. We have provided access to the singleton instance via the sharedCriteo property of the Criteo class.

Initialize Criteo SDK, ideally in your AppDelegate, with registerCriteoPublisherId:withAdUnits:. This needs to be done only once.

Parameter

Type

Description

criteoPublisherId

NSString

Your Criteo Publisher ID.
Contact your Criteo representative to get your Criteo Publisher ID.

adUnits

NSArray<CRAdUnit>

List of AdUnits you'd like Criteo to monetize

storeId

NSString

Your app’s unique identifier that is used in the Apple App Store.

App Bidding - In-House bidding - Banner - Load Criteo Bids

Load Criteo bids using loadBidForAdUnit:responseHandler: method that takes 2 parameters:

Parameter

Type

Description

adUnit

CRBannerAdUnit

CRBannerAdUnit object for this request

responseHandler

(void (^)(CRBid *bid))

A handler that will be executed when a response is received, or timed out. The handler passes a CRBid object, or nil if no bid.

On the response handler, non-null Bid object indicates bid availability from Criteo. Retrieve Criteo's CPM bid price with price property.

App Bidding - In-House bidding - Banner - Displaying Banner

When Criteo wins your auction, create a CRBannerView object and call loadAdWithBid: method by passing the previously obtained CRBid object to display Criteo banner.

Finally, add the CRBannerView object to a view with the correct frame.

App Bidding - In-House bidding - Banner - Banner Delegate Methods

You can optionally add delegate methods to your ViewController in order to get notified when the banner view has loaded, failed to load, or there's a click resulting in the user leaving the application, by implementing CRBannerViewDelegate protocol on your ViewController.

Assign your CRBannerView object's delegate to self, and you can implement bannerDidReceiveAd:, banner:didFailToReceiveAdWithError: and bannerWillLeaveApplication: methods.

App Bidding - In-House bidding - Interstitial - Load Criteo Bids

Load Criteo bids using loadBidForAdUnit:responseHandler: method that takes 2 parameters:

Parameter

Type

Description

adUnit

CRInterstitialAdUnit

CRInterstitialAdUnit object for this request

responseHandler

(void (^)(CRBid *bid))

A handler that will be executed when a response is received, or timed out. The handler passes a CRBid object, or nil if no bid.

On the response handler, non-null Bid object indicates bid availability from Criteo. Retrieve Criteo's CPM bid price with price property.

App Bidding - In-House bidding - Interstitial - Loading Interstitial Ads

When Criteo wins your auction, create a CRInterstitial object and call loadAdWithBid: method by passing the previously obtained CRBid object to prefetch Interstitial ad that you can display later in your app.

App Bidding - In-House bidding - Interstitial - Displaying Interstitial Ads

Display previously-loaded Interstitial ad by presenting the view from RootViewController with calling presentFromRootViewController: method. Make sure to always check whether the Interstitial ad has been loaded using isAdLoaded before presenting Criteo Interstitial ad to the user. You can alternatively listen to interstitialDidReceiveAd: delegate method to make sure that the Interstitial ad is ready to be displayed.

App Bidding - In-House bidding - Interstitial - Interstitial Delegate Methods

You can optionally add delegate methods to your ViewController in order to get notified before/after the Interstitial ad has loaded, failed to load, appear, disappear, or there's a click resulting in the user leaving the application, by implementing CRInterstitialDelegate protocol on your ViewController.

Assign your CRInterstitial object's delegate to self, and you can implement Interstitial delegate methods like the code example.

App Bidding - In-House bidding - Advanced Native

Advanced Native enables you to render your native ads using UI components that are native to the platform.

Prerequisites

This guide assumes that you have initialized Criteo SDK according to the In-House Bidding integration guide.

App Bidding - In-House bidding - Advanced Native with a Simple Layout - Load Criteo Bids

Load Criteo bids using loadBidForAdUnit:responseHandler: method that takes 2 parameters:

Parameter

Type

Description

adUnit

CRNativeAdUnit

CRNativeAdUnit object for this request

responseHandler

(void (^)(CRBid *bid))

A handler that will be executed when a response is received, or timed out. The handler passes a CRBid object, or nil if no bid.

On the response handler, non-null Bid object indicates bid availability from Criteo. Retrieve Criteo's CPM bid price with price property.

App Bidding - In-House bidding - Advanced Native with a Simple Layout - Native Loader

When Criteo wins your auction, create a CRNativeLoader object that will be an entry point and responsible for loading Criteo Native ads. Then set the native loader's delegate to your ViewController that conforms to CRNativeLoaderDelegate protocol.

Finally, invoke loadAdWithBid: on your native loader object with the previously obtained CRBid object to load your native ad.

App Bidding - In-House bidding - Advanced Native with a Simple Layout - Native Ad View

Create a custom class for your Native Ad View. In this guide, we'll create CriteoNativeAdView class that extends CRNativeAdView.

Then, create an .xib file with the same name as your custom class name. You can define your native views in this interface builder file. Set the view's custom class name.

Criteo uses CRMediaView in order to display images. Please use CRMediaView custom view instead of UIImageView in your .xib file.

Make sure to create an outlet for every views in your custom class.

You will find attached the code showing how CriteoNativeAdView class might look like.

Finally, on your Storyboard, define a View as a placeholder for your native ad view, and create an outlet on the ViewController.

Native_iOS_xib_class.png
128.7 KB
Native_iOS_xib_outlets.png
162.2 KB

App Bidding - In-House bidding - Advanced Native with a Simple Layout - Native Loader Delegate

Implement CRNativeLoaderDelegate methods in your ViewController. At a minimum, you will need to implement nativeLoader:didReceiveAd: method in order to initialize and fill your native view.

In the sample code below, we are loading the .xib file called CriteoNativeAdView created on the previous step, set the nativeAd property, fill every elements with native assets, and finally add the native ad view into the placeholder.

The following native assets are available on CRNativeAd object:

Native Asset

Property

Type

Recommended View

Ad Title

title

NSString

UILabel

Ad Description

body

NSString

UILabel

Ad Price

price

NSString

UILabel

Ad Image

productMedia

CRMediaContent

CRMediaView

Call To Action

callToAction

NSString

UILabel or UIButton

Advertiser Domain

advertiserDomain

NSString

UILabel

Advertiser Name

advertiserDescription

NSString

UILabel

Advertiser Logo

advertiserLogoMedia

CRMediaContent

CRMediaView

Legal Text

legalText

NSString

UILabel

App Bidding - In-House bidding - Advanced Native with a Simple Layout - AdChoices Logo

An AdChoices logo will be automatically added to the ad view by Criteo SDK. Please leave a space in the top-right corner of your native ad view for the automatically inserted AdChoices logo. The rendered AdChoices logo will take up 19x15 points on the screen.

App Bidding - Standalone SDK

This guide explains how to integrate Criteo Direct Bidding for App solution to your iOS app as a Standalone Ads SDK.

Prerequisites

App Bidding - Standalone SDK - SDK Initialization

Criteo SDK is designed to be used as a singleton. We have provided access to the singleton instance via the sharedCriteo property of the Criteo class.

Initialize Criteo SDK, ideally in your AppDelegate, with registerCriteoPublisherId:withAdUnits:. This needs to be done only once.

Parameter

Type

Description

criteoPublisherId

NSString

Your Criteo Publisher ID.
Contact your Criteo representative to get your Criteo Publisher ID.

adUnits

NSArray<CRAdUnit>

List of AdUnits you'd like Criteo to monetize.