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 following method to true after starting the Mediation SDK. Remember to remove it or set the method to false before releasing your app.

ChartboostMediation.setTestMode(context, true)
ChartboostMediation.setTestMode(context, false)

Keywords πŸ”—

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

Set Keywords πŸ”—

To set keywords, you will need to first create a Mediation ad object. Then, use the set() method to add key-value keywords pair. The set method returns a boolean indicating whether or not the keyword has been successfully set.

For ChartboostMediationFullscreenAd

// Adding Keywords to the Keywords object
val keywords = Keywords().set("keyword1", "value1")

// Passing keywords to the fullscreen load request.
val request = ChartboostMediationFullscreenAdLoadRequest(
    placement = "placement",
    keywords = keywords,
    emptyMap(),
)

val result =
    ChartboostMediationFullscreenAd.loadFullscreenAd(
        context,
        request,
        listener,
    )

// Adding Keywords from the ad result.
result.ad?.request?.keywords?.set()"keyword1", "value1"

For Banners

// Adding Keywords to the Keywords object.
val keywords = Keywords().set("banner1", "value1")

val bannerRequest = ChartboostMediationBannerAdLoadRequest(
    "placement",
    keywords,
    bannerSize,
)

// Adding Keywords to banner request.
bannerRequest.keywords["banner2"] = "value2"

Remove Keywords πŸ”—

To remove keywords that have been set, simply use the remove() method and pass in the key whose value you would like to remove. The remove method returns the value of the key removed.

For ChartboostMediationFullscreenAd

// Removing Keywords.
keywords.remove("keyword1")

For Banners

val bannerAdView = ChartboostMediationBannerAdView(
    context,
    "placement",
    size,
    listener,
)
// Removing a keyword from the banner ad view
bannerAdView.keywords.remove("key1")

// It is also possible to remove the keyword from the banner load request
val keywords = Keywords()
keywords.add("key1")
keywords.remove("key1")
val loadRequest = ChartboostMediationBannerAdLoadRequest("placement", keywords, size)
// Can then load the banner with the keywords
bannerAdView.load(loadRequest)

Impression Level Revenue Data (ILRD) πŸ”—

Impression Level Revenue Data (ILRD) is data we already collect on the server side and store in our database today. This feature allows publishers to get 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
- banner
"precision" String One of the following:
- estimated
- exact
- publisher_defined
- undisclosed

Bid Specific ILRD πŸ”—

{
 "network_name": "chartboost",
 "network_type": "bidding",
 "precision": "exact",
 "ad_revenue": 0.099,
 "network_placement_id": "CBRewarded"
}

Ad Response ILRD πŸ”—

{
 "impression_id": "7e4c99a9492c75f3b5fcbb4da8cd8e040794c4fe",
 "currency_type": "USD",
 "country": "USA",
 "placement_name": "CBRewarded",
 "placement_type": "rewarded"
}

Combined ILRD Response πŸ”—

{
 "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 can receive ILRD data in two ways:

  1. On Android, 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 can 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 can use ILRD data in several ways:

  • You can listen to the data via SDK notifications in real-time and ship it to your own servers or to other MMPs such as AppsFlyer or Adjust.
  • You can manually request a report via the API endpoint and analyze it at your convenience.

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.setPlayerIdentifier("player_id")

Setting Custom Data πŸ”—

The custom data property is found on the ChartboostMediationFullscreenAd 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 null.

Custom data may be set at any time before calling show().

It is recommended to base 64 encode the custom data!

// Load an ad
val result =
    ChartboostMediationFullscreenAd.loadFullscreenAd(
        context,
        request,
        listener,
    )

// Set Custom Data
result.ad?.customData = "Y3VzdG9tIGRhdGE="

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

Implementation πŸ”—

Create a ChartboostMediationIlrdObserver object and implement its onImpression method. Then, pass the object to the ChartboostMediationSdk.subscribeIlrd and ChartboostMediationSdk.unsubscribeIlrd methods.

val chartboostMediationIlrdObserver = object: ChartboostMediationIlrdObserver {
  override fun onImpression(impData: ChartboostMediationImpressionData) {
      // Placement name
      val placement = impData.placementId
      // JSON
      val json = impData.ilrdInfo
  }
}

override fun onCreate(savedInstanceState: Bundle?) {
  ...
  // Subscribe to ILRD on app startup, e.g. in onCreate()
  ChartboostMediationSdk.subscribeIlrd(chartboostMediationIlrdObserver)
  ...
}

override fun onDestroy() {
  ...
  // Unsubscribe from ILRD on app terminations, e.g. in onDestroy()
  ChartboostMediationSdk.unsubscribeIlrd(chartboostMediationIlrdObserver)
  ...
}