This guide shows you how to use the Google Mobile Ads SDK to load and display ads from AdColony using mediation, covering both bidding and waterfall integrations. It covers how to add AdColony to an ad unit's mediation configuration, and how to integrate the AdColony SDK and adapter into a Unity app.
Supported integrations and ad formats
The AdMob mediation adapter for AdColony has the following capabilities:
Integration | |
---|---|
Bidding | |
Waterfall | |
Formats | |
Banner | |
Interstitial | |
Rewarded |
Requirements
- Unity 5.6 or higher
- Latest Google Mobile Ads SDK
- [For bidding]: Google Mobile Ads mediation plugin for AdColony 1.0.5 or higher (latest version recommended)
- To deploy on Android
- Android API level 19 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.
Step 1: Set up AdColony
Sign up or log in to your AdColony account. Add your app to the AdColony publisher dashboard by clicking the Setup New App button.
If your app supports both Android and iOS platforms, you need to set up each one of them separately.
Fill out the form and click Create at the bottom of the page to add your app to AdColony.
Android
iOS
Once your app is created you can obtain your App ID by navigating to Monetization > Apps under your app's Basic App Information section.
Android
iOS
Next, create a new Ad Zone to be used with AdMob mediation. We recommend creating a new Ad Zone for mediation with AdMob even if you already have one. To create a new Ad Zone click the Setup New Ad Zone button in the Ad Zones section of your app's page.
Android
iOS
For additional instructions on creating an ad placement, select the tab corresponding to your preferred ad format.
Banner
- Set Zone is Active? to Yes.
Enter a Name for your Ad Zone.
Choose Banner as the Ad Zone Size.
Enter a value for the Daily play cap.
Interstitial
- Set Zone is Active? to Yes.
Enter a Name for your Ad Zone.
Choose Preroll/Interstitial as the Zone Type.
Enter a value for the Daily play cap.
Rewarded
- Set Zone is Active? to Yes.
Enter a Name for your Ad Zone.
Choose Value Exchange/V4VC as the Zone Type.
Set Client Side Only? to Yes and enter a Virtual Currency Name, Daily Max Videos per User and Reward Amount.
Enter a value for the Daily play cap.
When finished, click the Create button 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.
[Waterfall only] Locate your AdColony API Key
For waterfall only, 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.
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 the AdMob UI.
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 AdColony as an ad source.
To create a new mediation group, select Create Mediation Group.
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.
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.
Add AdColony as an ad source
Bidding
Under the Bidding card in the Ad Sources section, select Add Ad Source. Then select AdColony.
Click How to sign a partnership agreement and set up a bidding partnership with AdColony.
Click Acknowledge & agree, then click Continue.
If you already have a mapping for AdColony, you can simply select it. Otherwise, click Add mapping.
Next, enter a Mapping name, the App ID and the Zone ID obtained in the previous section. Then click Done.
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 ad source optimization for AdColony. Then enter an eCPM value for AdColony and click Continue.
If you already have a mapping for AdColony, you can simply select it. Otherwise, click Add mapping.
Next, enter a Mapping name, App ID and Zone ID obtained in the previous section. Then click Done.
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 AdColony as an ad source.
To create a new mediation group, select Create Mediation Group.
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.
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.
Add AdColony as an ad source
Bidding
Under the Bidding card in the Ad Sources section, select Add Ad Source. Then select AdColony.
Click How to sign a partnership agreement and set up a bidding partnership with AdColony.
Click Acknowledge & agree, then click Continue.
If you already have a mapping for AdColony, you can simply select it. Otherwise, click Add mapping.
Next, enter a Mapping name, the App ID and the Zone ID obtained in the previous section. Then click Done.
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 ad source optimization for AdColony. Then enter an eCPM value for AdColony and click Continue.
If you already have a mapping for AdColony, you can simply select it. Otherwise, click Add mapping.
Next, enter a Mapping name, App ID and Zone ID obtained in the previous section. Then click Done.
Rewarded ads
In the settings for your rewarded 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 (recommended approach).
If you don't check 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
Download the latest version of Google Mobile Ads mediation plugin for AdColony
from the download link in the
Changelog and extract the
GoogleMobileAdsAdColonyMediation.unitypackage
from the zip file.
In your Unity project editor, select Assets > Import Package > Custom
Package and find the GoogleMobileAdsAdColonyMediation.unitypackage
file you
downloaded. Make sure all the files are selected and click Import.
Then, select Assets > Play Services Resolver > Android Resolver >
Force Resolve. The External Dependency Manager library will perform
dependency resolution from scratch and copy the declared dependencies into the
Assets/Plugins/Android
directory of your Unity app.
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 the 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.
Optional steps
Android
Permissions
For optimal performance, AdColony recommends adding the following
optional permissions
into the AndroidManifest.xml
file located under the
Assets/Plugins/Android/GoogleMobileAdsPlugin
directory of your Unity
project.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
iOS
No additional steps are required for iOS integration.
Network-specific parameters
The AdColony mediation package supports additional configuration and request
parameters, which can be passed to the adapter using the
AdColonyMediationExtras
and AdColonyAppOptions
classes.
The AdColonyMediationExtras
class includes the following methods:
SetShowPrePopup(bool)
- Sets whether or not to show a popup before showing an ad. Set to false if you don't want to show a popup before ads display.
SetShowPostPopup(bool)
- Sets whether or not to show a popup after showing an ad. Set to false if you don't want to show a popup after ads display.
The AdColonyAppOptions
class includes the following methods:
SetUserId(string)
- Sets the User ID for the AdColony SDK that provides further analytics to the AdColony Ad Server.
SetTestMode(bool)
- Sets whether or not to enable test mode for the AdColony SDK.
Here's a code example of how to set these configurations and ad request parameters:
// Set app-level configurations
AdColonyAppOptions.SetUserId("myUser");
AdColonyAppOptions.SetTestMode(true);
// Set ad request parameters
AdColonyMediationExtras extras = new AdColonyMediationExtras();
extras.SetShowPrePopup(true);
extras.SetShowPostPopup(true);
AdRequest request = new AdRequest.Builder()
.AddMediationExtras(extras)
.Build();
EU consent and GDPR
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 AdColony version 2.6.1 added the
AdColonyAppOptions
class with the SetPrivacyFrameworkRequired()
and
SetPrivacyConsentString()
methods, to let you to pass consent to the
AdColony SDK. The following sample code demonstrates how to pass consent
information to the AdColony adapter, which are then used in AdColony’s
initialization method. These options must be set before you
initialize the Google Mobile Ads SDK
to ensure they get forwarded properly to AdColony's SDK.
using GoogleMobileAds.Api.Mediation.AdColony;
// ...
AdColonyAppOptions.SetPrivacyFrameworkRequired(AdColonyPrivacyFramework.GDPR, true);
AdColonyAppOptions.SetPrivacyConsentString(AdColonyPrivacyFramework.GDPR, "myPrivacyConsentString");
See AdColony's Consumer Privacy article and Privacy Laws implementation guide for more details and the values that can be provided in the method.
Add AdColony to GDPR ad partners list
Follow the steps in GDPR settings to add AdColony to the GDPR ad partners list in the AdMob UI.
CCPA
The California Consumer Privacy Act (CCPA) requires giving California state residents 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 CCPA preparation 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 with CCPA.
The Google Mobile Ads mediation plugin for AdColony version 2.6.1 added the
AdColonyAppOptions
class with the SetPrivacyFrameworkRequired()
and
SetPrivacyConsentString()
methods, to let you to pass consent to the
AdColony SDK. The following sample code demonstrates how to pass consent
information to the AdColony adapter, which are then used in AdColony’s
initialization method. These options must be set before you
initialize the Google Mobile Ads SDK
to ensure they get forwarded properly to AdColony's SDK.
using GoogleMobileAds.Api.Mediation.AdColony;
// ...
AdColonyAppOptions.SetPrivacyFrameworkRequired(AdColonyPrivacyFramework.CCPA, true);
AdColonyAppOptions.SetPrivacyConsentString(AdColonyPrivacyFramework.CCPA, "myPrivacyConsentString");
See AdColony's Consumer Privacy article and Privacy Laws implementation guide for more details and the values that can be provided in the method.
Add AdColony to CCPA ad partners list
Follow the steps in CCPA settings to add AdColony to the CCPA ad partners list in the AdMob UI.
Error codes
If the adapter fails to receive an ad from AdColony, publishers can check the
underlying error from the ad response using
ResponseInfo
under the following classes:
Android
com.jirbo.adcolony.AdColonyAdapter
com.google.ads.mediation.adcolony.AdColonyMediationAdapter
iOS
GADMAdapterAdColony
GADMediationAdapterAdColony
Here are the codes and accompanying messages thrown by the AdColony adapter when an ad fails to load:
Android
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. |
iOS
Error code | Reason |
---|---|
0 - 3 | AdColony SDK returned an error. See documentation for more details. |
101 | Invalid server parameters (e.g. missing Zone ID). |
102 | Root view controller presenting the ad is nil . |
103 | The AdColony SDK returned an initialization error. |
104 | The AdColony SDK does not support being configured twice within a five second period. |
105 | Failed to show ad. |
106 | Zone used for rewarded is not a rewarded zone on AdColony portal. |
AdColony Unity Mediation Plugin Changelog
Version 2.6.2
- Moved adapter content to
GoogleMobileAds/Mediation/AdColony/
. - Refactored adapter namespace to use
GoogleMobileAds.Mediation.AdColony
. - Supports AdColony Android adapter version 4.8.0.2.
- Supports AdColony iOS adapter version 4.9.0.2.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.1.0.
Version 2.6.1
- Updated the privacy APIs from the
AdColonyAppOptions
class to the following methods to support GDPR and CCPA:SetGDPRRequired(bool)
->SetPrivacyFrameworkRequired(AdColonyPrivacyFramework, bool)
IsGDPRRequired()
->GetPrivacyFrameworkRequired(AdColonyPrivacyFramework)
SetGDPRConsentString(string)
->SetPrivacyConsentString(AdColonyPrivacyFramework, string)
GetGDPRConsentString()
->GetPrivacyConsentString(AdColonyPrivacyFramework)
- Supports AdColony Android adapter version 4.8.0.1.
- Supports AdColony iOS adapter version 4.9.0.2.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.4.1.
Version 2.6.0
- Supports AdColony Android adapter version 4.8.0.0.
- Supports AdColony iOS adapter version 4.9.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.1.0.
Version 2.5.0
- Supports AdColony Android adapter version 4.7.0.0.
- Supports AdColony iOS adapter version 4.8.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 2.4.1
- Supports AdColony Android adapter version 4.6.5.0.
- Supports AdColony iOS adapter version 4.7.2.2.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 2.4.0
- Supports AdColony Android adapter version 4.6.5.0.
- Supports AdColony iOS adapter version 4.7.2.0.
Version 2.3.0
- Supports AdColony Android adapter version 4.5.0.0.
- Supports AdColony iOS adapter version 4.6.1.0.
Version 2.2.0
- Supports AdColony Android adapter version 4.2.4.0.
- Supports AdColony iOS adapter version 4.4.1.0.
Version 2.1.0
- Supports AdColony Android adapter version 4.2.0.0.
- Supports AdColony iOS adapter version 4.3.0.0.
Version 2.0.3
- Repackaged
adcolony-extras-library.jar
toadcolony-unity-android-library.aar
, using a.aar
build to support Unity 2020.- When upgrading to this version, please remove
adcolony-extras-library.jar
from your project.
- When upgrading to this version, please remove
- Supports AdColony Android adapter version 4.1.4.1.
- Supports AdColony iOS adapter version 4.1.5.0.
Version 2.0.2
- Supports AdColony Android adapter version 4.1.4.1.
- Supports AdColony iOS adapter version 4.1.4.1.
Version 2.0.1
- Supports AdColony Android adapter version 4.1.4.0.
- Supports AdColony iOS adapter version 4.1.4.0.
Version 2.0.0
- Supports AdColony Android adapter version 4.1.0.0.
- Supports AdColony iOS adapter version 4.1.2.0.
Version 1.0.6
- Supports AdColony Android adapter version 3.3.11.0.
- Supports AdColony iOS adapter version 3.3.8.1.0.
Version 1.0.5
- Moved the following methods from the
AdColonyMediationExtras
Builder class to theAdColonyAppOptions
class:SetGDPRRequired()
SetGDPRConsentString()
SetUserId()
SetTestMode()
- Added the following methods to the
AdColonyAppOptions
class:IsGDPRRequired()
GetGDPRConsentString()
GetUserId()
IsTestMode()
- Removed the
SetZoneId()
method from theAdColonyMediationExtras
Builder class. - Supports AdColony Android adapter version 3.3.10.1.
- Supports AdColony iOS adapter version 3.3.7.2.
Version 1.0.4
- Updated the plugin to support the new open-beta Rewarded API.
- Supports AdColony Android adapter version 3.3.8.1.
- Supports AdColony iOS adapter version 3.3.6.1.
Version 1.0.3
- Supports AdColony Android adapter version 3.3.5.1.
- Supports AdColony iOS adapter version 3.3.5.0.
Version 1.0.2
- Supports AdColony Android SDK version 3.3.4.
- Supports AdColony iOS SDK version 3.3.4.
SetTestMode()
from theAdColonyMediationExtras
Builder class is now ignored for Android. Publishers can now request test ads from AdColony for Android by specifying a test device viaAddTestDevice()
from theAdRequest
Builder class.- Added the following methods to the
AdColonyMediationExtras
Builder class:SetGDPRRequired()
SetGDPRConsentString()
Version 1.0.1
- Supports AdColony Android SDK version 3.3.0-unity.
- Supports AdColony iOS SDK version 3.3.0.
Version 1.0.0
- First release!
- Supports AdColony Android SDK version 3.3.0.
- Supports AdColony iOS SDK version 3.3.0.