Integrating AdColony with Mediation

This guide is intended for publishers who want to use the Google Mobile Ads SDK to load and display ads from AdColony via mediation. It covers how to add AdColony to an ad unit's mediation configuration, how to set up Automatic data collection, and how to integrate the AdColony SDK and adapter into an Android app.

Supported ad formats and features

The Ad Manager mediation adapter for AdColony has the following capabilities:

Formats
Banners
Interstitials
Rewarded Video
Native Ads - Custom Rendering
Features
Smart Banners
Automatic data collection

Requirements

  • Android SDK 4.0 (API level 14) or later
  • Google Play services 9.8.0 or later

Step 1: Set up AdColony

Sign up and log in to your AdColony account. Add your app to the AdColony publisher dashboard by clicking the Setup New App button.

AdColony setup new app

Fill out the form and click Create at the bottom of the page to add your app to AdColony.

AdColony create app

Once your app is created you can obtain your App ID by navigating to Monetization > Apps under your app's Basic App Information section.

AdColony app id

Next, create a new Ad Zone by clicking the Setup New Ad Zone button in the Ad Zones section of your App's page. We recommend creating a new Ad Zone for mediation with Ad Manager even if you already have one.

AdColony setup zone

For additional instructions on creating an ad placement, select the tab corresponding to your preferred ad format.

Interstitial

  1. Set Zone is Active? to Yes.
  2. Enter a Name for your Ad Zone.

  3. Choose Preroll/Interstitial as the Zone Type.

  4. Enter a value for the Daily play cap.

Rewarded Video

  1. Set Zone is Active? to Yes.
  2. Enter a Name for your Ad Zone.

  3. Choose Value Exchange/V4VC as the Zone Type.

  4. Set Client Side Only? to Yes and enter a Virtual Currency Name, Daily Max Videos per User and Reward Amount.

  5. Enter a value for the Daily play cap.

Click the Create button when finished to create the Ad Zone.

Once the Ad Zone is created, you can locate your Zone ID under the Integration section of the Ad Zone.

AdColony zone id

In addition to the App ID and the Zone ID you will also need your AdColony API Key for setting up your Ad Manager Ad Unit ID. Navigate to Account Settings in your AdColony publisher dashboard to locate your API Key.

AdColony settings

Step 2: Configure mediation settings for your Ad Manager ad unit

Sign in to your Google Ad Manager account. Navigate to Delivery > Yield Groups and click the Create Yield Group button.

Ad Manager create yield group button

Enter a Yield Group Name, select your Ad Format, and set the Environment to Mobile App. Under the Targeting section, select the ad unit ID to which you want to add mediation.

Ad Manager create yield group

Next, click the Add Another Yield Partner button.

If you already have a Yield Partner for AdColony, you can simply select it. Otherwise, select Create a new Yield Partner.

Select AdColony as the Yield partner and enter a unique Name. Check the checkbox for Enable automatic data collection of estimated CPM to optimize Mediation to enable ANO, and enter the API Key obtained in the previous section. No need to enter a username and password. API key is all that's required. Click Save when done.

Once the Yield partner is chosen, select Mobile SDK mediation as the Integration type and Android as the Operating system. Enter the App ID and Zone ID obtained in the previous section. Enter a Default CPM value.

Click Save and Activate at the bottom of the page when done.

Using rewarded video ads

In the settings for your rewarded video ad unit, check the Override reward settings from third-party ad networks when using mediation so that you provide the same reward to the user no matter which ad network is served.

If you don't override the reward, the AdColony adapter passes back the reward specified in the AdColony dashboard.

Step 3: Import the AdColony SDK and adapter

Add the following maven repository and the implementation dependency with the latest version of the AdColony SDK and adapter in the app-level build.gradle file:

repositories {
    jcenter()

    maven {
      url  "https://adcolony.bintray.com/AdColony"
    }
}

...
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:xx.x.x'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation 'com.adcolony:sdk:3.3.5'
    implementation 'com.android.support:support-annotations:xx.x.x'
    implementation 'com.google.ads.mediation:adcolony:3.3.5.1'
}
...

Manual integration

Download the AdColony Android SDK and extract the adcolony.jar under the Library folder and add it to your project.

The AdColony SDK depends on the Annotations Support Library. See Improve Code Inspection with Annotations for details on how to add the Annotations Support Library to your project.

Download the latest AdColony adapter from Bintray located under the Files tab add it to your project.

Step 4: Additional code required

Modify Android manifest

Activities

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

<activity android:name="com.adcolony.sdk.AdColonyInterstitialActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:hardwareAccelerated="true"/>

<activity android:name="com.adcolony.sdk.AdColonyAdViewActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:hardwareAccelerated="true"/>

Step 5: Test your implementation

To enable test ads on AdColony, go to your AdColony dashboard and navigate to Monetization > Apps. Select your Zone for which you would like to enable test ads under the Ad Zones section of your app. Test ads can be enabled by checking Yes to Show test ads only? under the Development section.

AdColony test

Optional steps

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

In version 3.3.4.0, the AdColony adapter added the setGdprRequired() and setGdprConsentString() methods to the AdColonyBundleBuilder class. The following sample code demonstrates how to pass these parameters to the AdColony adapter, which are then used in AdColony’s initialization method.

import com.jirbo.adcolony.AdColonyBundleBuilder;
//...


AdColonyBundleBuilder.setGdprConsentString("1");
AdColonyBundleBuilder.setGdprRequired(true);

PublisherAdRequest request = new PublisherAdRequest.Builder()
   .addNetworkExtrasBundle(AdColonyAdapter.class,AdColonyBundleBuilder.build())
   .build();

See AdColony’s GDPR implementation details for more information about what values may be provided in these methods.

Permissions

For optimal performance, AdColony 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.VIBRATE" />

Using interstitial and rewarded video ads

Network-specific parameters

The AdColony adapter supports additional request parameters which can be passed to the adapter using the AdColonyBundleBuilder class. The AdColonyBundleBuilder includes the following methods:

  • setUserId(String) - Sets the User ID to the AdColony SDK that provides further analytics to the AdColony Ad Server.
  • setShowPrePopup(boolean) - Sets whether or not to show a popup before showing an ad. Set to false for no popup before ad shows.
  • setShowPostPopup(boolean) - Sets whether or not to show a popup after showing an ad. Set to false for no popups after ad shows.

Here's a code example of how to set these ad request parameters:

JAVA

AdColonyBundleBuilder.setUserId("USER_ID");
AdColonyBundleBuilder.setShowPrePopup(true);
AdColonyBundleBuilder.setShowPostPopup(true);
PublisherAdRequest request = new PublisherAdRequest.Builder()
   .addNetworkExtrasBundle(AdColonyAdapter.class, AdColonyBundleBuilder.build())
   .build();
rewardedInterstitialAd.loadAd(request);

KOTLIN

AdColonyBundleBuilder.setUserId("USER_ID")
AdColonyBundleBuilder.setShowPrePopup(true)
AdColonyBundleBuilder.setShowPostPopup(true)
val request = PublisherAdRequest.Builder()
   .addNetworkExtrasBundle(AdColonyAdapter::class.java, AdColonyBundleBuilder.build())
   .build()
rewardedInterstitialAd!!.loadAd(request)

Optimizations

To ensure AdColony video ads are available as early as possible, you can optionally initialize the AdColony SDK at the beginning of the application lifecycle. To do so, insert the following code into your main Activity's onCreate method:

JAVA

AdColony.configure(this,           // activity context
        "YOUR_ADCOLONY_APP_ID",
        "ZONE_ID_1", "ZONE_ID_2"); // list of all your zones set up on the AdColony Dashboard

KOTLIN

AdColony.configure(this,           // activity context
        "YOUR_ADCOLONY_APP_ID",
        "ZONE_ID_1", "ZONE_ID_2")  // list of all your zones set up on the AdColony Dashboard

Send feedback about...

Google Mobile Ads SDK for Ad Manager - Android
Google Mobile Ads SDK for Ad Manager - Android
Need help? Visit our support page.