Integrate Chartboost with mediation

This guide shows you how to use the Google Mobile Ads SDK to load and display ads from Chartboost using mediation, covering waterfall integrations. It covers how to add Chartboost to an ad unit's mediation configuration, and how to integrate the Chartboost SDK and adapter into a Unity app.

Supported integrations and ad formats

The AdMob mediation adapter for Chartboost has the following capabilities:

Integration
Bidding
Waterfall
Formats
Banner
Interstitial
Rewarded

Requirements

  • Unity 4 or higher
  • Latest Google Mobile Ads SDK
  • To deploy on Android
    • Android API level 21 or higher
  • To deploy on iOS
    • iOS deployment target of 11.0 or higher
  • A working Unity project configured with Google Mobile Ads SDK. See Get Started for details.
  • Complete the mediation Get started guide

Step 1: Set up configurations in Chartboost UI

Sign up for a Chartboost account and log in once your account is verified. Click the + APP button on the left sidebar. Fill out the form and click Save to add your app to Chartboost. If your app supports both Android and iOS platforms, you need to add each of them separately.

Android

Chartboost add app

iOS

Chartboost add app

Then, in your Chartboost dashboard for your app, navigate to App Settings > Basic Settings to locate your App ID and App Signature.

Android

Chartboost app settings

iOS

Chartboost app settings

AdMob requires the Chartboost User ID and User Signature for setting up your AdMob ad unit ID. You can find these parameters on your Chartboost dashboard by navigating to Tools > API Explorer. Your User ID and User Signature are located under the Authentication section.

Chartboost api explorer

Turn on test mode

Test ads can be enabled for your app from Chartboost's dashboard under the App Settings > Basic Settings.

Android

Chartboost test mode

iOS

Chartboost test mode

Once test mode is enabled, you can request ads using the ad unit ID created earlier and receive a Chartboost test ad.

Step 2: Set up Chartboost demand in AdMob UI

Configure mediation settings for your ad unit

You need to add Chartboost to the mediation configuration for your ad unit. First sign in to your AdMob account.

If you're deploying your Unity app to both Android and iOS, you need two AdMob ad units, one for each platform.

Android

Navigate to the Mediation tab. If you have an existing mediation group you'd like to modify, click the name of that mediation group to edit it, and skip ahead to Add Chartboost as an ad source.

To create a new mediation group, select Create Mediation Group.

AdMob mediation tab

Enter your ad format and platform, then click Continue.

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled. Then click Add Ad Units, which will open up the ad unit selection overlay.

New mediation group 2

Associate this mediation group with your existing AdMob ad unit. Then click Done.

You should now see the ad units card populated with the ad units you selected.

Mediation group ad units

Add Chartboost as an ad source

In the Ad Sources card, select Add Ad Network. Then select Chartboost.

Enable the Optimize switch. Enter your User ID and User Signature obtained in the previous section to set up ad source optimization for Chartboost. Then enter an eCPM value for Chartboost and click Continue.

If you already have a mapping for Chartboost, you can simply select it. Otherwise, click Add mapping.

Next, enter the App ID and the App Signature obtained in the previous section. Also, enter an Ad Location (e.g. "Game Over Screen") that uniquely identifies this placement in your app. Then click Done.

Chartboost Ad Locations (Named Locations) are simple names representing a place in your app where you want to show an ad. AdMob sends requests to the location specified in the settings. Once requests are sent, Chartboost will add the location to its dashboard for reporting purposes.

In the Chartboost dashboard, your Ad Locations can be revealed in the Basic Settings page by clicking Advanced Settings.

Finally, click Done to add Chartboost as an ad source, and then click Save.

iOS

Navigate to the Mediation tab. If you have an existing mediation group you'd like to modify, click the name of that mediation group to edit it, and skip ahead to Add Chartboost as an ad source.

To create a new mediation group, select Create Mediation Group.

AdMob mediation tab

Enter your ad format and platform, then click Continue.

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled. Then click Add Ad Units.

New mediation group 2

Associate this mediation group with your existing AdMob ad unit. Then click Done.

You should now see the ad units card populated with the ad units you selected.

Mediation group ad units

Add Chartboost as an ad source

Enable the Optimize switch. Enter your User ID and User Signature obtained in the previous section to set up ad source optimization for Chartboost. Then enter an eCPM value for Chartboost and click Continue.

If you already have a mapping for Chartboost, you can simply select it. Otherwise, click Add mapping.

Next, enter the App ID and the App Signature obtained in the previous section. Also, enter an Ad Location (e.g. "Game Over Screen") that uniquely identifies this placement in your app. Then click Done.

Chartboost Ad Locations (Named Locations) are simple names representing a place in your app where you want to show an ad. AdMob sends requests to the location specified in the settings. Once requests are sent, Chartboost will add the location to its dashboard for reporting purposes.

In the Chartboost dashboard, your Ad Locations can be revealed in the Basic Settings page by clicking on Advanced Settings.

Finally, click Done to add Chartboost as an ad source, and click Save.

Add Chartboost to GDPR and US state regulations ad partners list

Follow the steps in GDPR settings and US state regulations settings to add Chartboost to the GDPR and US state regulations ad partners list in the AdMob UI.

Step 3: Import the Chartboost SDK and adapter

Download the latest version of Google Mobile Ads mediation plugin for Chartboost from the download link in the Changelog and extract GoogleMobileAdsChartboostMediation.unitypackage from the zip file.

In your Unity project editor, select Assets > Import Package > Custom Package and find the GoogleMobileAdsChartboostMediation.unitypackage file you downloaded. Make sure that all the files are selected and click Import.

Then, select Assets > Play Services Resolver > Android Resolver > Force Resolve. The Unity Play Services Resolver library will perform dependency resolution from scratch and copy the declared dependencies into the Assets/Plugins/Android directory of your Unity app.

Step 4: Implement privacy settings on Chartboost SDK

Under the Google EU User Consent Policy, you must ensure that certain disclosures are given to, and consents obtained from, users in the European Economic Area (EEA) regarding the use of device identifiers and personal data. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). When seeking consent, you must identify each ad network in your mediation chain that may collect, receive, or use personal data and provide information about each network's use. Google currently is unable to pass the user's consent choice to such networks automatically.

The Google Mobile Ads mediation plugin for Chartboost version 3.1.0 includes the Chartboost.AddDataUseConsent() method. The following sample code sets data use consent to NonBehavioral. If you choose to call this method, it is recommended that you do so prior to requesting ads via the Google Mobile Ads SDK.

using GoogleMobileAds.Api.Mediation.Chartboost;
// ...

Chartboost.AddDataUseConsent(CBGDPRDataUseConsent.NonBehavioral);

US states privacy laws

U.S. states privacy laws require giving users the right to opt out of the "sale" of their "personal information" (as the law defines those terms), with the opt-out offered via a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The U.S. states privacy laws compliance guide offers the ability to enable restricted data processing for Google ad serving, but Google is unable to apply this setting to each ad network in your mediation chain. Therefore, you must identify each ad network in your mediation chain that may participate in the sale of personal information and follow guidance from each of those networks to ensure compliance.

The Google Mobile Ads mediation plugin for Chartboost version 3.1.0 includes the Chartboost.AddDataUseConsent() method. The following sample code sets data use consent to OptInSale. If you choose to call this method, it is recommended that you do so prior to requesting ads via the Google Mobile Ads SDK.

using GoogleMobileAds.Api.Mediation.Chartboost;
// ...

Chartboost.AddDataUseConsent(CBCCPADataUseConsent.OptInSale);

Step 5: Add required code

Android

No additional code is required for Chartboost integration.

iOS

SKAdNetwork integration

Follow Chartboost's documentation to add the SKAdNetwork identifiers to your project's Info.plist file.

Step 6: Test your implementation

Enable test ads

Make sure you register your test device for AdMob and enable test mode in Chartboost UI.

Verify test ads

To verify that you are receiving test ads from Chartboost, enable single ad source testing in ad inspector using the Chartboost (Waterfall) ad source(s).

Step 7: Prepare app for production

After you are able to receive Chartboost test ads, your app will be placed on Chartboost's Publisher App Review. Once your app is approved, you can then create your Publishing Campaign to configure your app for live Chartboost ads.

Navigate to Monetization > Publishing Campaigns from the left-side menu and click Add a Campaign (or + Add Campaign at the top right corner of your dashboard if you already have other campaigns) and choose Network Publishing when prompted.

Android

Chartboost add campaign

iOS

Chartboost add campaign

Enter a Name for your publishing campaign. Select the Platform that your app supports. If your app supports both platforms, you need two Campaigns, one for each.

If your app has been approved by Chartboost, you'll be able to select your app and apply it to this campaign. Fill out the rest of the form and click Save to finish adding the campaign.

Android

Chartboost campaign

iOS

Chartboost campaign

Optional Steps

Android

Permissions

For optimal performance, Chartboost recommends adding the following optional permissions to your app's AndroidManifest.xml file:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

iOS

No additional steps are required for iOS integration.

Error codes

If the adapter fails to receive an ad from Chartboost, publishers can check the underlying error from the ad response using ResponseInfo under the following classes:

Android

com.google.ads.mediation.chartboost.ChartboostAdapter
com.google.ads.mediation.chartboost.ChartboostMediationAdapter

iOS

GADMAdapterChartboost
GADMediationAdapterChartboost

Here are the codes and accompanying messages thrown by the Chartboost adapter when an ad fails to load:

Android

Error code Reason
0-99 Chartboost SDK returned an error.
101 The requested ad size does not match a Chartboost supported banner size.
102 Chartboost can only load 1 ad per location at a time.
103 Chartboost server parameters configured in the AdMob UI are missing/invalid.
104 The Chartboost interstitial or rewarded ad is not ready to be shown.

iOS

Error code Reason
101 Chartboost server parameters configured in the AdMob UI are missing/invalid.
102 The Chartboost SDK returned an initialization error.
103 The Chartboost ad is not cached at show time.
104 The requested ad size does not match a Chartboost supported banner size.
105 Device's OS version is lower than Chartboost SDK's minimum supported OS version.
200-299 Chartboost SDK cache errors. See code for more details.
300-399 Chartboost SDK show errors. See code for more details.
400-499 Chartboost SDK click errors. See code for more details.

Chartboost Unity Mediation Plugin Changelog

Version 4.4.0

Version 4.3.0

Version 4.2.0

Version 4.1.1

Version 4.1.0

Version 4.0.0

Version 3.5.1

Version 3.5.0

Version 3.4.1

Version 3.4.0

Version 3.3.1

Version 3.3.0

Version 3.2.0

Version 3.1.0

Version 3.0.1

Version 3.0.0

Version 2.0.1

Version 2.0.0

  • Supports Chartboost Android adapter version 7.5.0.0.
  • Supports Chartboost iOS adapter version 8.0.1.1.

Version 1.3.0

  • Updated the plugin to support the new Rewarded API.
  • Supports Chartboost Android adapter version 7.3.1.1.
  • Supports Chartboost iOS adapter version 7.5.0.0.

Version 1.2.0

  • Supports Chartboost Android adapter version 7.3.0.0.
  • Supports Chartboost iOS adapter version 7.3.0.0.

Version 1.1.1

  • Supports Chartboost Android adapter version 7.2.0.1.
  • Supports Chartboost iOS adapter version 7.2.0.1.

Version 1.1.0

  • Supports Chartboost Android SDK version 7.2.0.
  • Supports Chartboost iOS SDK version 7.2.0.
  • Added Chartboost.RestrictDataCollection() method to enable GDPR data collection restrictions for the Chartboost SDK.

Version 1.0.0

  • First release!
  • Supports Chartboost Android SDK version 7.0.1.
  • Supports Chartboost iOS SDK version 7.1.2.