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
注册并登录您的 AdColony 帐号。点击设置新应用按钮,将您的应用添加到 AdColony 发布商信息中心。
填写表单,然后点击页面底部的 Create(创建),以将您的应用添加到 AdColony。
Android
iOS
创建应用后,您可以依次转到应用的基本应用信息部分下的创收 > 应用来获取应用 ID。
Android
iOS
接下来,在应用页面的广告区域部分点击设置新的广告区域按钮,创建新的广告区域。我们建议您为中介创建一个新的广告区域 AdMob (即使您已有广告区域)。
Android
iOS
如需了解有关创建广告展示位置的其他说明,请选择与首选广告格式对应的标签页。
横幅
- 将区域是否有效?设置为是。
为您的广告区域输入名称。
选择横幅作为广告区域尺寸。
输入“每日播放上限”的值。
插页式广告
- 将区域是否有效?设置为是。
为您的广告区域输入名称。
选择前贴片广告/插页式广告作为区域类型。
输入“每日播放上限”的值。
已奖励
- 将区域是否有效?设置为是。
为您的广告区域输入名称。
选择值交换/V4VC 作为区域类型。
将 Client Side Only? 设为 Yes,然后输入虚拟货币名称、每日最大视频数和奖励金额。
输入“每日播放上限”的值。
完成创建广告区域后,点击创建按钮。
创建广告区域后,您可以在广告区域的集成部分下找到区域 ID。该区域 ID 将在下一步中使用。
找到您的 AdColony API 密钥
出价
出价集成不需要执行此步骤。
瀑布
您需要使用 AdColony API 密钥来设置您的AdMob 广告单元 ID。前往 AdColony 发布商信息中心中的帐号设置,找到您的 API 密钥。
开启测试模式
如需在 AdColony 上启用测试广告,请转到 AdColony 信息中心,然后依次转到创收 > 应用。在应用的广告区域部分下,选择您要启用测试广告的区域。在开发部分下,选中是以只显示测试广告?即可启用测试广告。
Step 2: Set up AdColony demand in AdMob UI
为广告单元配置中介设置
Add AdColony to GDPR and US state regulations ad partners list
按照 GDPR 设置 和 美国州级法规设置 中的步骤,将 AdColony 添加到 AdMob 界面中的 GDPR 和美国州级法规广告合作伙伴列表中。
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
启用测试广告
请务必为AdMob 注册您的测试设备,并在 AdColony 界面中启用测试模式。
验证测试广告
如需验证您收到的是来自AdColony的测试广告,请使用相应广告来源在广告检查器中启用单一广告来源测试。 AdColony (Bidding) and AdColony (Waterfall)
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.