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 an iOS app.
Supported integrations and ad formats
The AdMob mediation adapter for AdColony has the following capabilities:
Integration | |
---|---|
Bidding | |
Waterfall | |
Formats | |
Banner | |
Interstitial | < |
Rewarded | |
Native |
Requirements
- iOS deployment target of 10.0 or higher
- [For bidding]: AdColony adapter 3.3.7.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.
Fill out the form and click Create at the bottom of the page to add your app to AdColony.
Once your app is created you can obtain your App ID by navigating to Monetization > Apps under your app's Basic App Information section.
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.
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.
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.
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.
Next, enter the App ID and Zone ID obtained in the previous section. Then click Done.
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 ad source optimization 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.
Finally, click Save.
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
Using CocoaPods (recommended)
Add the following line to your project's Podfile:
pod 'GoogleMobileAdsMediationAdColony'
From the command line run:
pod install --repo-update
Manual integration
- Download the latest version of the
AdColony SDK, and link
AdColony.framework
in your project. - Download the latest AdColony adapter from the download link in
Changelog, and link
AdColonyAdapter.framework
in your project. - Add the following libraries and frameworks to Target > Build Phases > Link
Binary With Libraries:
libz.1.2.5.tbd
AdSupport
AudioToolbox
AVFoundation
CoreMedia
CoreTelephony
JavaScriptCore
MessageUI
MobileCoreServices
SystemConfiguration
EventKit (OPTIONAL)
Social (OPTIONAL)
StoreKit (OPTIONAL)
WatchConnectivity (OPTIONAL)
WebKit (OPTIONAL)
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.
Optional steps
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 AdColony adapter exposes an appOptions
property to customize parameters to
be sent to AdColony's SDK. Two methods relevant to GDPR on these options are
-setPrivacyFrameworkOfType:isRequired:
and
-setPrivacyConsentString:forType:
. 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.
Swift
import AdColonyAdapter
//...
let appOptions = GADMediationAdapterAdColony.appOptions
appOptions?.setPrivacyFrameworkOfType(ADC_GDPR, isRequired: true)
appOptions?.setPrivacyConsentString("1", forType: ADC_GDPR)
Objective-C
#import <AdColonyAdapter/AdColonyAdapter.h>
//...
AdColonyAppOptions *options = GADMediationAdapterAdColony.appOptions;
[options setPrivacyFrameworkOfType:ADC_GDPR isRequired:YES];
[options setPrivacyConsentString:@"1" forType:ADC_GDPR];
See AdColony's GDPR implementation details for more details about what values may be provided in these methods.
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 AdColony adapter exposes an appOptions
property to customize parameters to
be sent to AdColony's SDK. Two methods relevant to CCPA on these options are
-setPrivacyFrameworkOfType:isRequired:
and
-setPrivacyConsentString:forType:
. 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.
Swift
import AdColonyAdapter
//...
let appOptions = GADMediationAdapterAdColony.appOptions
appOptions?.setPrivacyFrameworkOfType(ADC_CCPA, isRequired: true)
appOptions?.setPrivacyConsentString("1", forType: ADC_CCPA)
Objective-C
#import <AdColonyAdapter/AdColonyAdapter.h>
//...
AdColonyAppOptions *options = GADMediationAdapterAdColony.appOptions;
[options setPrivacyFrameworkOfType:ADC_CCPA isRequired:YES];
[options setPrivacyConsentString:@"1" forType:ADC_CCPA];
See AdColony's CCPA implementation details for more details about what values may be provided in these methods.
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.
Using interstitial and rewarded ads
The AdColony adapter supports additional request parameters which can be passed
to the adapter using the GADMAdapterAdColonyExtras
class. The
GADMAdapterAdColonyExtras
includes the following properties:
showPrePopup
- Enable a reward dialog before showing the ad for a specific ad request in your app.
showPostPopup
- Enable a reward dialog after showing the ad for a specific ad request in your app.
Here's a code example of how to set these parameters on the ad request:
Swift
let request = GADRequest()
let extras = GADMAdapterAdColonyExtras()
extras.showPrePopup = true
extras.showPostPopup = true
request.registerAdNetworkExtras(extras)
Objective-C
GADRequest *request = [GADRequest request];
GADMAdapterAdColonyExtras *extras = [[GADMAdapterAdColonyExtras alloc] init];
extras.showPrePopup = YES;
extras.showPostPopup = YES;
[request registerAdNetworkExtras:extras];
Verify your adapter and SDK versions
To log the adapter and SDK versions, use the following code snippet:
Class<GADMediationAdapter> adapterClass = NSClassFromString(@"GADMediationAdapterAdColony");
if (adapterClass != nil) {
GADVersionNumber adapterVersion = [adapterClass version];
GADVersionNumber sdkVersion = [adapterClass adSDKVersion];
// Log the adapter patch version to 3 digits to represent the x.x.x.x versioning
// used by adapters.
NSLog(@"Adapter version: %zd.%zd.%03zd",
adapterVersion.majorVersion,
adapterVersion.minorVersion,
adapterVersion.patchVersion);
NSLog(@"SDK version: %zd.%zd.%zd",
sdkVersion.majorVersion,
sdkVersion.minorVersion,
sdkVersion.patchVersion);
}
Logging the adapter version in Swift is not possible since the dynamic runtime feature does not exist in Swift, making it infeasible to dynamically create the class from the class name. If this is needed in Swift, it needs to be written in Objective-C and imported using a bridging header.
Error codes
If the adapter fails to receive an ad from AdColony, publishers can check the
underlying error from the ad response using
GADResponseInfo.adNetworkInfoArray
under the following classes:
GADMAdapterAdColony
GADMediationAdapterAdColony
Here are the codes and accompanying messages thrown by the AdColony adapter when an ad fails to load:
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 iOS Mediation Adapter Changelog
Version 4.9.0.2
- Updated the adapter to pass
childDirectedTreatment
information to the AdColony SDK.
Built and tested with
- Google Mobile Ads SDK version 10.1.0.
- AdColony SDK version 4.9.0.
Version 4.9.0.1
- Updated the adapter to use the
didRewardUser
API. - Fixed an issue where UI related API methods are being called on a background thread.
- Removed use of deprecated gender, birthday and location mediation APIs.
- Now requires Google Mobile Ads SDK version 10.0.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 10.0.0.
- AdColony SDK version 4.9.0.
Version 4.9.0.0
- Verified compatibility with AdColony SDK 4.9.0.
Built and tested with
- Google Mobile Ads SDK version 9.5.0.
- AdColony SDK version 4.9.0.
Version 4.8.0.0
- Verified compatibility with AdColony SDK 4.8.0.
Built and tested with
- Google Mobile Ads SDK version 9.1.0.
- AdColony SDK version 4.8.0.
Version 4.7.2.2
- Added support for the arm64 simulator architecture.
Built and tested with
- Google Mobile Ads SDK version 9.0.0.
- AdColony SDK version 4.7.2.
Version 4.7.2.1
- Verified compatibility with Google Mobile Ads SDK version 9.0.0.
- Now requires Google Mobile Ads SDK version 9.0.0 or higher.
- Now requires minimum iOS version of 10.0.
Built and tested with
- Google Mobile Ads SDK version 9.0.0.
- AdColony SDK version 4.7.2.
Version 4.7.2.0
- Verified compatibility with AdColony SDK 4.7.2.
Built and tested with
- Google Mobile Ads SDK version 8.10.0.
- AdColony SDK version 4.7.2.
Version 4.7.1.0
- Verified compatibility with AdColony SDK 4.7.1.
Built and tested with
- Google Mobile Ads SDK version 8.9.0.
- AdColony SDK version 4.7.1.
Version 4.7.0.0
- Verified compatibility with AdColony SDK 4.7.0.
- Relaxed dependency to Google Mobile Ads SDK version 8.0.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 8.8.0.
- AdColony SDK version 4.7.0.
Version 4.6.1.0
- Verified compatibility with AdColony SDK 4.6.1.
- Now requires Google Mobile Ads SDK version 8.4.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 8.4.0.
- AdColony SDK version 4.6.1.
Version 4.6.0.0
- Updated the adapter to use the
.xcframework
format. - Added bidding capability for banner ads.
- Verified compatibility with AdColony SDK 4.6.0.
- Now requires Google Mobile Ads SDK version 8.3.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 8.3.0.
- AdColony SDK version 4.6.0.
Version 4.5.0.0
- Verified compatibility with AdColony SDK 4.5.0.
- Now requires Google Mobile Ads SDK version 7.69.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.69.0.
- AdColony SDK version 4.5.0.
Version 4.4.1.0
- Verified compatibility with AdColony SDK 4.4.1.
- Now requires Google Mobile Ads SDK version 7.66.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.66.0.
- AdColony SDK version 4.4.1.
Version 4.4.0.0
- Verified compatibility with AdColony SDK 4.4.0.
- Now requires Google Mobile Ads SDK version 7.65.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.65.0.
- AdColony SDK version 4.4.0.
Version 4.3.1.0
- Verified compatibility with AdColony SDK 4.3.1.
Built and tested with
- Google Mobile Ads SDK version 7.64.0.
- AdColony SDK version 4.3.1.
Version 4.3.0.0
- Verified compatibility with AdColony SDK 4.3.0.
- Now requires Google Mobile Ads SDK version 7.64.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.64.0.
- AdColony SDK version 4.3.0.
Version 4.1.5.0
- Verified compatibility with AdColony SDK 4.1.5.
- Updated the minimum required Google Mobile Ads SDK version to 7.60.0.
Built and tested with
- Google Mobile Ads SDK version 7.60.0.
- AdColony SDK version 4.1.5.
Version 4.1.4.1
- Added standardized adapter error codes and messages.
- Removed support for the i386 architecture.
Built and tested with
- Google Mobile Ads SDK version 7.57.0.
- AdColony SDK version 4.1.4.
Version 4.1.4.0
- Verified compatibility with AdColony SDK 4.1.4.
Built and tested with
- Google Mobile Ads SDK version 7.56.0.
- AdColony SDK version 4.1.4.
Version 4.1.3.1
- Fixed AdColony mediation network adapter version string.
Built and tested with
- Google Mobile Ads SDK version 7.55.0.
- AdColony SDK version 4.1.3.
Version 4.1.3.0 (Deprecated)
- Known issue: Incorrectly reports the mediation adapter version as 4.1.2.0. Please use version 4.1.3.1 or higher.
- Verified compatibility with AdColony SDK 4.1.3.
- Adding code to re-request ads for OB requests when the AdColony ad expires.
Built and tested with
- Google Mobile Ads SDK version 7.55.0.
- AdColony SDK version 4.1.3.
Version 4.1.2.0
- Verified compatibility with AdColony SDK 4.1.2.
- Added support for banner ads.
Built and tested with
- Google Mobile Ads SDK version 7.52.0.
- AdColony SDK version 4.1.2.
Version 4.1.1.0
- Verified compatibility with AdColony SDK 4.1.1.
- Added support for banner ads.
Built and tested with
- Google Mobile Ads SDK version 7.52.0.
- AdColony SDK version 4.1.1.
Version 3.3.8.1.0
- Updating AdColony adapter to version 3.3.8.1.
- Linting the code to follow Google's Objective-C code-style and guard against potential crashes.
Built and tested with
- Google Mobile Ads SDK version 7.51.0
- AdColony SDK version 3.3.8.1
Version 3.3.7.3
- Added checks to the credentials before initializing the AdColony SDK.
Version 3.3.7.2
- Fixed an issue where the
GADMediationAdapterAdColony
header was not made public.
Version 3.3.7.1
- Added bidding capability to the adapter for interstitial and rewarded ads.
Version 3.3.7.0
- Verified compatibility with AdColony SDK 3.3.7.
- Fixed a crash in case of failed to fetch rewarded ad.
Version 3.3.6.1
- Updated the adapter to use the new rewarded API.
- Now requires Google Mobile Ads SDK version 7.41.0 or higher.
Version 3.3.6.0
- Verified compatibility with AdColony SDK 3.3.6.
Version 3.3.5.0
- Verified compatibility with AdColony SDK 3.3.5.
- Added
adapterDidCompletePlayingRewardBasedVideoAd:
callback to the adapter.
Version 3.3.4.0
- Verified compatibility with AdColony SDK 3.3.4.
Version 3.3.0.0
- Verified compatibility with AdColony SDK 3.3.0.
Version 3.2.1.1
- Added
testMode
to extras. Publishers can use this property to mark AdColony requests as test requests.
Version 3.2.1.0
- Verified compatibility with AdColony SDK 3.2.1.
Version 3.2.0.0
- Verified compatibility with AdColony SDK 3.2.0.
Version 3.1.1.1
- Removed support for the
armv7s
architecture. - Fixed an issue that caused the adapter to incorrectly invoke the rewarded callback when used with recent versions of the AdColony SDK.
Version 3.1.1.0
- Verified compatibility with AdColony SDK 3.1.1.
Version 3.1.0.0
- Verified compatibility with AdColony SDK 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.