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 through bidding and waterfall mediation. It covers how to add AdColony ads to an ad unit's mediation configuration, and how to integrate the AdColony SDK and adapter into an Android app.

Supported ad formats and features

The AdMob mediation adapter for AdColony has the following capabilities:

Formats
Banner
Interstitial
Rewarded
Native
Features
Adaptive banner
Ad network optimization (ANO)
Bidding

Requirements

  • Android API level 16 or higher
  • [For bidding]: AdColony adapter 3.3.10.1 or higher (latest version recommended)
  • Latest Google Mobile Ads SDK

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 AdMob even if you already have one.

AdColony set up zone

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

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

  3. Choose Banner as the Ad Zone Size.

  4. Enter a value for the Daily play cap.

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

  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. The Zone ID will be used in the next step.

AdColony zone id

[Waterfall only] Locate your AdColony API Key

You will need your AdColony API Key for setting up your AdMob 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 AdMob ad unit

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

Next, 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 AdColony as an ad source.

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

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

Select ad unit

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

Mediation group ad units

Add AdColony as an ad source

Bidding

Under the Bidding card in the Ad Sources section, select Add Ad Source. Then select AdColony.

Next, enter the App ID and Zone ID obtained in the previous section. Then click Done. AdColony Configure Ad Units

Finally, click Save.

Waterfall

Under the Waterfall card in the Ad Sources section, select Add Ad Source. Then select AdColony.

Enable the Optimize switch. Enter your API Key obtained in the previous section to set up ANO for AdColony. Then enter an eCPM value for AdColony and click Continue.

Next, enter the App ID and Zone ID obtained in the previous section. Then click Done.

Configure AdColony ad unit

Finally, click Save.

Using rewarded ads

In the settings for your rewarded ad unit, provide values for the reward amount and reward type. Then, to ensure you provide the same reward to the user no matter which ad network is served, check the Apply to all networks in Mediation groups box.

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

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

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 {
    google()
    mavenCentral()
}

...
dependencies {
    implementation 'com.google.android.gms:play-services-ads:20.3.0'
    implementation 'com.google.ads.mediation:adcolony:4.6.0.0'
}
...

Migrate project to AndroidX

The AdColony SDK depends on Android support libraries but the latest Google Mobile Ads SDK uses Jetpack libraries.

To ensure the AdColony SDK and the Google Mobile Ads SDK are compatible, create a gradle.properties file in the top-level of your project, and add the following code:

android.useAndroidX=true
android.enableJetifier=true

This will rewrite the AdColony SDK binary to use use Jetpack libraries. See AndroidX migration guide for more information about these settings.

Manual integration

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

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

  3. Navigate to the AdColony adapter artifacts on Google's Maven Repository. Select the latest version, download the AdColony adapter's .aar file, and add it to your project.

Step 4: Additional code required

No additional code is required for AdColony integration.

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.

The AdColony adapter provides the AdColonyMediationAdapter.getAppOptions() method to customize parameters to be sent to AdColony's SDK. Two methods relevant to GDPR on these options are setPrivacyFrameworkRequired() and setPrivacyConsentString(), added in AdColony SDK 4.2.0. The following sample code demonstrates how to pass these parameters to the AdColony adapter, which are then used in AdColony’s initialization method. These options must be set before you initialize mobile ads to ensure they get forwarded properly to AdColony's SDK:

import com.google.ads.mediation.adcolony.AdColonyMediationAdapter;
//...

AdColonyAppOptions appOptions = AdColonyMediationAdapter.getAppOptions();
appOptions.setPrivacyFrameworkRequired(AdColonyAppOptions.GDPR, true);
appOptions.setPrivacyConsentString(AdColonyAppOptions.GDPR, "1");

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

  • 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.setShowPrePopup(true);
AdColonyBundleBuilder.setShowPostPopup(true);
AdRequest request = new AdRequest.Builder()
   .addNetworkExtrasBundle(AdColonyAdapter.class, AdColonyBundleBuilder.build())
   .build();
rewardedInterstitialAd.loadAd(request);

KOTLIN

AdColonyBundleBuilder.setShowPrePopup(true)
AdColonyBundleBuilder.setShowPostPopup(true)
val request = AdRequest.Builder()
   .addNetworkExtrasBundle(AdColonyAdapter::class.java, AdColonyBundleBuilder.build())
   .build()
rewardedInterstitialAd.loadAd(request)

Verify your adapter and SDK versions

To log the adapter and SDK versions, use the following code snippet:

AdColonyMediationAdapter adapter = new AdColonyMediationAdapter();
VersionInfo adapterVersion = adapter.getVersionInfo();
VersionInfo sdkVersion = adapter.getSDKVersionInfo();
// Log the adapter patch version to 3 digits to represent the x.x.x.x versioning
// used by adapters.
Log.d("TAG", String.format(
    "Adapter version: %d.%d.%03d",
    adapterVersion.getMajorVersion(),
    adapterVersion.getMinorVersion(),
    adapterVersion.getMicroVersion()));
Log.d("TAG", String.format(
    "SDK version: %d.%d.%d",
    sdkVersion.getMajorVersion(),
    sdkVersion.getMinorVersion(),
    sdkVersion.getMicroVersion()));

Error codes

If the adapter fails to receive an ad from AdColony, publishers can check the underlying error from the ad response using ResponseInfo.getAdapterResponse() under the following classes:

com.jirbo.adcolony.AdColonyAdapter
com.google.ads.mediation.adcolony.AdColonyMediationAdapter

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

Error code Reason
100 The AdColony SDK returned an error.
101 Invalid server parameters (e.g. missing Zone ID).
102 An ad was already requested for the same Zone ID.
103 The AdColony SDK returned an initialization error.
104 The requested banner size does not map to a valid AdColony ad size.
105 Presentation error due to ad not loaded.
106 Context used to initialize the AdColony SDK was not an Activity instance.

AdColony Android Mediation Adapter Changelog

Version 4.6.2.0 (in progress)

  • Verified compatibility with AdColony SDK version 4.6.2.

Built and tested with:

  • Google Mobile Ads SDK version 20.3.0.
  • AdColony SDK version 4.6.2.

Version 4.6.0.0

  • Verified compatibility with AdColony SDK version 4.6.0.
  • Updated the minimum required Google Mobile Ads SDK version to 20.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.3.0.
  • AdColony SDK version 4.6.0.

Version 4.5.0.0

  • Added support for banners advanced bidding.
  • Verified compatibility with AdColony SDK version 4.5.0.
  • Updated the minimum required Google Mobile Ads SDK version to 20.0.0.

Built and tested with:

  • Google Mobile Ads SDK version 20.0.0.
  • AdColony SDK version 4.5.0.

Version 4.4.1.0

  • Verified compatibility with AdColony SDK version 4.4.1.

Built and tested with:

  • Google Mobile Ads SDK version 19.7.0.
  • AdColony SDK version 4.4.1.

Version 4.4.0.0

  • Verified compatibility with AdColony SDK version 4.4.0.
  • Added support of AdColony's collectSignals() method for bidding.
  • Updated the minimum required Google Mobile Ads SDK version to 19.7.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.7.0.
  • AdColony SDK version 4.4.0.

Version 4.3.0.0

  • Verified compatibility with AdColony SDK version 4.3.0.
  • Updated the minimum required Google Mobile Ads SDK version to 19.5.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.5.0.
  • AdColony SDK version 4.3.0.

Version 4.2.4.0

  • Fixed a bug where onUserEarnedReward() was not forwarded for rewarded ads.
  • Added additional error codes for AdColony SDK initialization errors.
  • Updated the minimum required Google Mobile Ads SDK version to 19.4.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.4.0.
  • AdColony SDK version 4.2.4.

Version 4.2.0.0

  • Verified compatibility with AdColony SDK version 4.2.0.
  • Updated the adapter to support inline adaptive banner requests.
  • Updated the minimum required Google Mobile Ads SDK version to 19.2.0.

Built and tested with:

  • Google Mobile Ads SDK version 19.2.0.
  • AdColony SDK version 4.2.0.

Version 4.1.4.1

  • Added descriptive error codes and reasons for adapter load/show failures.
  • Updated the minimum required Google Mobile Ads SDK version to 19.0.1.

Built and tested with:

  • Google Mobile Ads SDK version 19.0.1.
  • AdColony SDK version 4.1.4.

Version 4.1.4.0

  • Verified compatibility with AdColony SDK version 4.1.4.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • AdColony SDK version 4.1.4.

Version 4.1.3.1

  • Fixed an issue where the onRewardedAdLoaded() callback is not being forwarded by the adapter.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • AdColony SDK version 4.1.3.

Version 4.1.3.0

  • Verified compatibility with AdColony SDK version 4.1.3.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • AdColony SDK version 4.1.3.

Version 4.1.2.0

  • Verified compatibility with AdColony SDK version 4.1.2.
  • Updated the minimum required Google Mobile Ads SDK version to 18.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • AdColony SDK version 4.1.2.

Version 4.1.0.0

  • Verified compatibility with AdColony SDK version 4.1.0.
  • Added support for banner ads.
  • Updated the minimum required Google Mobile Ads SDK version to 18.2.0.

Built and tested with:

  • Google Mobile Ads SDK version 18.2.0.
  • AdColony SDK version 4.1.0.

Version 3.3.11.0

  • Verified compatibility with AdColony SDK version 3.3.11.
  • Updated the minimum required Google Mobile Ads SDK version to 18.1.1.

Version 3.3.10.1

  • Added bidding capability to the adapter for interstitial and rewarded ads.

Version 3.3.10.0

  • Verified compatibility with AdColony SDK version 3.3.10.

Version 3.3.9.0

  • Verified compatibility with AdColony SDK version 3.3.9.
  • Removed setGdprRequired() and setGdprConsentString() methods on AdColonyBundleBuilder.
  • Added the AdColonyMediationAdapter.getAppOptions() method. Publishers must now pass GDPR information to AdColony's SDK through these options. See the developer documentation for more details.

Version 3.3.8.1

  • Updated adapter to support new open-beta Rewarded API.
  • Updated the minimum required Google Mobile Ads SDK version to 17.2.0.

Version 3.3.8.0

  • Verified compatibility with AdColony SDK version 3.3.8.

Version 3.3.7.0

  • Verified compatibility with AdColony SDK version 3.3.7.

Version 3.3.6.0

  • Verified compatibility with AdColony SDK version 3.3.6.

Version 3.3.5.1

  • Updated the adapter to invoke the onRewardedVideoComplete() ad event.

Version 3.3.5.0

  • Verified compatibility with AdColony SDK version 3.3.5.

Version 3.3.4.0

  • Verified compatibility with AdColony SDK version 3.3.4.
  • Updated the adapter with GDPR.

Version 3.3.3.0

  • Verified compatibility with AdColony SDK version 3.3.3.
  • Removed the setTestModeEnabled method from the Bundle builder class. Publishers can now request test ads from AdColony by specifying a test device via addTestDevice() method from the AdRequest builder class.

Version 3.3.2.0

  • Verified compatibility with AdColony SDK version 3.3.2.

Version 3.3.0.1

  • Fixed an issue where the adapter fails to fill when the adapter is reinitialized.
  • Fixed an issue where reward callback is sent incorrectly.

Version 3.3.0.0

  • Verified compatibility with AdColony SDK version 3.3.0.
  • Updated the Adapter project for Android Studio 3.0.

Version 3.2.1.1

  • Added setTestModeEnabled method to the Bundle builder class. Publishers can use this method to mark AdColony requests as test requests.

Version 3.2.1.0

  • Verified compatibility with AdColony SDK version 3.2.1.

Version 3.2.0.0

  • Verified compatibility with AdColony SDK version 3.2.0.

Version 3.1.2.0

  • Fixed possible NullPointerExceptions.
  • Verified compatibility with AdColony SDK version 3.1.2.

Version 3.1.1.0

  • Verified compatibility with AdColony SDK version 3.1.1.

Version 3.1.0.0

  • Verified compatibility with AdColony SDK version 3.1.0.

Version 3.0.6.0

  • Changed the version naming system to [AdColony SDK version].[adapter patch version].
  • Updated the minimum required AdColony SDK to v3.0.6.

Earlier Versions

  • Supports rewarded video and interstitial ads.