Integrating Chartboost with Mediation

This guide is intended for publishers who want to use the Google Mobile Ads SDK to load and display ads from Chartboost via mediation. It covers how to add Chartboost to an ad unit's mediation configuration, how to set up Ad Network Optimization (ANO), and how to integrate the Chartboost SDK and adapter into a Unity app.

Supported ad formats and features

The AdMob mediation adapter for Chartboost has the following capabilities:

Formats
Banners
Interstitials
Rewarded Video
Features
Smart Banners
Ad Network Optimization (ANO)

Requirements

  • Unity 4 or higher
  • To deploy on Android
    • Android SDK 4.0 (API level 14) or later
    • Google Play services 8.3 or later
  • To deploy on iOS
    • Xcode 6.0 or higher
    • iOS Deployment target of 8.0 or higher
    • Minimum required Google Mobile Ads SDK 7.10.1 or higher
  • A working Unity project configured with Google Mobile Ads SDK. See the Quick Start Guide for details.

Step 1: Set up Chartboost

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

Create a new campaign to enable ads for your app by navigating to Campaigns > Publishing 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.

Then, add your app to the Apps Publishing this Campaign. Click Save to finish adding the campaign.

Android

Chartboost campaign

iOS

Chartboost campaign

You'll now obtain all the parameters that will be used in setting up the ad unit ID in the next section. 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.

Android

Chartboost api explorer

iOS

Chartboost api explorer

Step 2: Configure mediation settings for your AdMob 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 ANO for Chartboost. Then enter an eCPM value for Chartboost and click Continue.

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

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. See the Chartboost's Named Locations guide for more details.

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

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 ANO for Chartboost. Then enter an eCPM value for Chartboost and click Continue.

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.

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. Please see Chartboost's Named Locations guide for more details.

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

Using rewarded video ads

In the settings for your rewarded video ad unit, check the Apply to all networks in Mediation groups box so that you provide the same reward to the user no matter which ad network is served.

Mediation override reward

If you don't check this setting, the Chartboost adapter passes back the reward specified in the Chartboost UI.

For more information on setting reward values for AdMob ad units, see Create an ad unit.

Step 3: Import the Chartboost SDK and adapter

Android

  1. Download the latest version of the Chartboost SDK and extract the chartboost.jar file under the lib/ directory.
  2. Download the latest Chartboost adapter (chartboost-x.y.z.p.aar) from Bintray.
  3. Add both the Chartboost Adapter and the SDK files to the Assets/Plugins/Android directory in your Unity project.

iOS

  1. Download the latest version of the Chartboost SDK.
  2. Download the latest version of the Chartboost adapter.
  3. Add both the .framework bundles in your Unity project under the Assets/Plugins/iOS directory.

Step 4: Additional code required

Android

Modify AndroidManifest

Include the following Activity in your AndroidManifest.xml under the application tag:

<activity android:name="com.chartboost.sdk.CBImpressionActivity"
          android:excludeFromRecents="true"
          android:hardwareAccelerated="true"
          android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
          android:configChanges="keyboardHidden|orientation|screenSize" />

iOS

No additional code is required for Chartboost integration.

Step 5: Test your implementation

Test ads can be enabled for your app from Chartboost's dashboard under the APP SETTINGS > Basic Settings, as shown below.

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.

That's it! You now have a working mediation integration with Chartboost.

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.

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 section below shows you how to enable or disable personalized ads for Chartboost.

The Google Mobile Ads mediation plugin for Chartboost version 1.1.0 includes the Chartboost.RestrictDataCollection() method. The following sample code restricts data collection for Chartboost. 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.RestrictDataCollection(true);

See Chartboost's GDPR article for more details.

Send feedback about...

Google Mobile Ads SDK for Unity
Google Mobile Ads SDK for Unity
Need help? Visit our support page.