Integrate Chartboost with AdMob Mediation

This guide shows you how to use Google Mobile Ads SDK for React Native 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 React Native app.

Supported integrations and ad formats

The AdMob mediation adapter for Chartboost has the following capabilities:

Integration
Bidding
Waterfall
Formats
App Open
Banner
Interstitial
Rewarded
Rewarded Interstitial
Native

Prerequisites

Before you continue, verify the following:

Step 1: Set up configurations in Chartboost UI

Sign up for a Chartboost account and log in once your account is verified. Then, navigate to the Apps management tab.

Chartboost apps dashboard

Click the Add new app button to create your app.

Apps Management

Fill out the rest of the form and click the Add App button to finalize your app.

New app form

After your app is created, you will be directed to its dashboard. Take note of the App ID and App Signature of your app.

Android

App settings

iOS

App settings

AdMob requires the Chartboost User ID and User Signature for setting up your AdMob ad unit ID. You can find these parameters by clicking Chartboost mediation on the Chartboost UI.

Chartboost mediation dashboard

Navigate to the Resources > API Explorer tab and take note of your User ID and User Signature located under the Authentication section.

Chartboost api explorer

Update your app-ads.txt

Authorized Sellers for Apps app-ads.txt is an IAB Tech Lab initiative that helps ensure your app ad inventory is only sold through channels you've identified as authorized. To prevent a significant loss in ad revenue, you'll need to implement an app-ads.txt file. If you haven't done so already, set up an app-ads.txt file for your app.

To implement app-ads.txt for Chartboost, see app-ads.txt.

Turn on test mode

You can enable test mode on your app by navigating to the Apps management tab from the Chartboost UI, selecting your app from the list and clicking on Edit app settings.

Android

Edit app settings

iOS

Edit app settings

From your app's settings, you can toggle Test mode on your app.

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.

After you are able to receive Chartboost test ads, your app will be placed on Chartboost's Publisher App Review. In order for monetization on Chartboost to work, the publisher app review will need to be approved by Chartboost.

Step 2: Set up Chartboost demand in AdMob UI

Configure mediation settings for your ad unit

Android

For instructions, see step 2 in the guide for Android.

iOS

For instructions, see step 2 in the guide for iOS.

Add Chartboost to GDPR and US state regulations ad partners list

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

Step 3: Import the Chartboost SDK and adapter

In your project's root directory, install the Google Mobile Ads SDK for React Native mediation adapter for Chartboost. Complete the following:

  1. Copy the Google Mobile Ads SDK for React Native adapter tar file from the gma-sdk-react-native/adapters/chartboost/ directory into your project's local_packages/ directory. If you don't have the adapters folder, see Prerequisites.

    mkdir -p local_packages
    cp EXTRACT_DIR/gma-sdk-react-native/adapters/chartboost/gma-mediation-chartboost-0.1.0.tgz local_packages/
    

    Replace EXTRACT_DIR with the path to the directory where you extracted the archive.

  2. Install the adapter package using your preferred package manager:

    npm

    npm install ./local_packages/gma-mediation-chartboost-0.1.0.tgz
    

    yarn

    yarn add ./local_packages/gma-mediation-chartboost-0.1.0.tgz
    

  3. If you're building for Android, add the following repository to the build.gradle file in your project's android directory:

    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/")
        }
    }
    

Step 4: Implement privacy settings on Chartboost SDK

To comply with the Google EU User Consent Policy, you must make certain disclosures to your users in the European Economic Area (EEA), the UK, and Switzerland, and obtain their consent for the use of cookies or other local storage where legally required, and for the collection, sharing, and use of personal data for ads personalization. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). You are responsible for verifying that consent is propagated to each ad source in your mediation chain.

Chartboost React Native adapter version 0.1.0 and later supports passing GDPR consent signals from UMP SDK and consent management platforms that integrate with Google's Additional Consent specification to Chartboost SDK. For more information, see SDK Privacy methods for Android and iOS.

US states privacy laws

US 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 through a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The US 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 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 using Google Mobile Ads SDK for React Native.

import {
  ChartboostCCPAConsent,
  ChartboostMediation,
} from '@google/gma-mediation-chartboost';
// ...

ChartboostMediation.addCCPADataUseConsent(ChartboostCCPAConsent.OPT_IN_SALE);

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).

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.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.

Version 0.1.0

  • Initial release.