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 21 or higher
- To deploy on iOS
- iOS deployment target of 12.0 or higher
- A working Unity project configured with Google Mobile Ads SDK. See Get Started for details.
- Complete the mediation Get started guide
Step 1: Set up configurations in AdColony UI
Sign up and log in to your AdColony account. Add your app to the AdColony publisher dashboard by clicking the Setup New App button.
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 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.
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.
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.
Locate your AdColony API Key
Bidding
This step isn't required for bidding integrations.
Waterfall
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.
Turn on test mode
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.
Step 2: Set up AdColony 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 AdColony to GDPR and US state regulations ad partners list
Follow the steps in GDPR settings and US state regulations settings to add AdColony to the GDPR and US state regulations ad partners list in the AdMob UI.
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: Implement privacy settings on AdColony SDK
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.
US states privacy laws
U.S. 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 via a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The U.S. 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 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.
Step 5: Add required code
Android
No additional code is required for AdColony integration.
iOS
SKAdNetwork integration
Follow AdColony'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 AdColony UI.
Verify test ads
To verify that you are receiving test ads from AdColony, enable single ad source testing in ad inspector using the AdColony (Bidding) and AdColony (Waterfall) ad source(s).
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();
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.3 (In Progress)
- Fixed a duplicate definition warning for
MediationExtras
.
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.