Mediation

Configure Mediation

Test Mode πŸ”—

The Mediation SDK includes a Test Mode method that will allow you to test your partner integrations and get their test ads. To enable Test Mode, simply set the isTestModeEnabled method to true/TRUE after starting the Mediation SDK. Remember to remove it or set the method to false/FALSE before releasing your app.

  • // set to true or false
    ChartboostMediation.isTestModeEnabled = true
    
  • // set to 'TRUE'/'FALSE' or 'YES'/'NO'
    ChartboostMediation.isTestModeEnabled = TRUE;
    

Keywords πŸ”—

Keywords are key-value pairs to enable real-time targeting of line items.

Set Keywords πŸ”—

To set keywords, use the keywords method to add key-value keywords pair.

  • // Banner Ads
    let banner = BannerAdView()
    banner.keywords = ["keyword1": "value1"]
    
    // Fullscreen Ads
    FullscreenAd.load(
        with: .init(
            placement: "placement",
            keywords: ["keyword1": "value1"], // set the whole dictionary
            partnerSettings: nil
        )
    ) { result in
        // handle result
    }
    
  • // Banner Ads
    CBMBannerAdView *banner = [[CBMBannerAdView alloc] init];
    banner.keywords = @{@"keyword1": @"value1"};
    
    // Fullscreen Ads
    CBMFullscreenAdLoadRequest *request
        = [[CBMFullscreenAdLoadRequest alloc] initWithPlacement:@"placement"
                                                       keywords:@{@"keyword1": @"value1"}
                                                partnerSettings:nil];
    [CBMFullscreenAd loadWith:request completion:^(CBMFullscreenAdLoadResult * _Nonnull result) { }];
    

Remove Keywords πŸ”—

To remove keywords, set keywords to nil.

  • let banner = BannerAdView()
    banner.keywords = nil // remove the whole dictionary
    
  • CBMBannerAdView *banner = [[CBMBannerAdView alloc] init];
    banner.keywords = nil;
    

Impression Level Revenue Data (ILRD) πŸ”—

Impression Level Revenue Data (ILRD) is data we collect on the server side and store in our database today. This feature allows publishers access to this data.

An ILRD event occurs every time an impression is tracked. The fields that a publisher is interested in are broken down as follows:

ILRD Key Value ILRD Description
"ad_revenue" Double Double-precision floating point
"currency_type" String Always USD
"country" String Three-letter country code ISO_3166-1_alpha-3 (ex.: USA)
"impression_id" String ID
"line_item_name" String Mediation line item name
"line_item_id" String Mediation line item id
"network_name" String Network Name
"network_placement_id" String Partner placement name
"network_type" String Either bidding or mediation
"placement_name" String Mediation placement name
"placement_type" String Ad type:
- interstitial
- rewarded</br>- banner
"precision" String One of the following:
- estimated
- exact
- publisher_defined
- undisclosed

Bid Specific ILRD πŸ”—

{
 "network_name": "mintegral",
 "network_type": "bidding",
 "precision": "exact",
 "ad_revenue": 0.02375,
 "network_placement_id": "vz6a00690d16ec4b5ba9"
}

Ad Response ILRD πŸ”—

{
 "impression_id": "2a3a70a8d161ce2942d73436123e7fba04983bd1",
 "currency_type": "USD",
 "country": "USA",
 "placement_name": "ACRewarded",
 "placement_type": "rewarded"
 }

Combined ILRD πŸ”—

{
 "ad_revenue": 0.055,
 "currency_type": "USD",
 "country": "USA",
 "impression_id": "ae112f3dccf90c705f2d3b1324605e9d16687725",
 "line_item_name": "helium_rv_T1_mintegral_high",
 "line_item_id": "33f6b0ca-1b3c-4e69-80dd-b57db13db159",
 "network_name": "mintegral",
 "network_placement_id": "mintegral_RV_0_25",
 "network_type": "mediation",
 "placement_name": "heliumMintegralTest",
 "placement_type": "rewarded",
 "precision": "publisher_defined"
}

Publishers will have two ways of receiving this data:

  1. On iOS, we provide a global notification that gives publishers access to ILRD data on each impression event shown in real time.
  2. For API access, we will provide an ILRD reporting API where publishers can request a custom report (CSV) of all their ILRD data filtered by appId, min_date, max_date.

Publishers will use ILRD data in several ways:

  • They can listen to the data via SDK notifications in real time and ship it to their own servers, or to other MMPs such as AppsFlyer & Adjust.
  • They can manually request a report via the API endpoint and analyze it whenever they wish to do so.

Rewarded Callbacks πŸ”—

Setting the User ID and Custom Data through the SDK

Setting User Identifier πŸ”—

The user identifier property is configured with the Chartboost Core SDK.

  • ChartboostCore.publisherMetadata.setPlayerID("player_id")
    
  • [ChartboostCore.publisherMetadata setPlayerID:@"player_id"];
    

Setting Custom Data πŸ”—

The custom data property is found on the FullscreenAd instance, and has a maximum character limit of 1000 characters. In the event that the limit is exceeded, the customData property will be set to nil.

Custom data may be set at any time before calling showAdWithViewController:.

It is recommended to base 64 encode the custom data!

  • let fullscreenAd: FullscreenAd = ... // obtain the ad with a load request
    fullscreenAd.customData = "Y3VzdG9tIGRhdGE=" // base 64 encoded string
    
  • CBMFullscreenAd *ad = ...; // obtain the ad with a load request
    fullscreenAd.customData = @"Y3VzdG9tIGRhdGE=" // base 64 encoded string
    

See: Mediation SDK: Manage Placement’s Rewarded Callbacks for configuration setup

Implementation πŸ”—

The iOS SDK will provide a new NSNotification event that will be broadcast to all listeners via NSNotificationCenter.

The ImpressionData class will be specified as follows:

public class ImpressionData: NSObject {
  // The placement associated with Impression Level Revenue Data.
  let placement: String

  // The Impression Level Revenue Data JSON.
  let jsonData: [String : Any]
}

Usage Example

NotificationCenter.default.addObserver(
    self,
    selector: #selector(didReceiveILRDNotification),
    name: .chartboostMediationDidReceiveILRD,
    object: nil
)

@objc func didReceiveILRDNotification(notification: Notification) {
    // Extract the ILRD payload.
    guard let ilrd = notification.object as? ImpressionData else {
        return
    }

    // Placement name
    let placement = ilrd.placement

    // JSON
    let json = ilrd.jsonData
}