This guide is intended for publishers who want to use the Google Mobile Ads SDK to load and display ads from myTarget via mediation. It covers how to add myTarget to an ad unit's mediation configuration, and how to integrate the myTarget SDK and adapter into an iOS app.
Supported formats and features
The Ad Manager mediation adapter for myTarget has the following capabilities:
|Rewarded Video (new APIs)|
|Native Ad - Custom Rendering|
|Automatic Data Collection|
- Xcode 9.2 or higher
- iOS Deployment target of 8.0 or higher
- Google Mobile Ads SDK 7.42.2 or higher
Step 1: Set up the myTarget network
Next, provide the iTunes URL for your app.
When adding an app, myTarget requires you to create an ad unit before you can complete the process.
Select BANNER from the available ad formats, and then click the ADD AD UNIT button.
Select INTERSTITIAL from the available ad formats, and then click the ADD AD UNIT button.
Select REWARDED VIDEO from the available ad formats, and then click the ADD AD UNIT button.
Select NATIVE from the available ad formats, and then click on ADD AD UNIT.
In your ad unit's details page, make a note of your slot ID which can be found under the ad unit settings as slot_id. This slot ID will be used to set up your Ad Manager ad unit in the next section.
In addition to the slot_id, you'll also need your MyTarget Permanent Access Token to set up your AdMob ad unit ID. Navigate to the Profile tab and select Access Tokens. Click Create Token or Show Token to view your MyTarget Permanent Access Token.
Step 2: Configure mediation settings for your Ad Manager ad unit
Sign in to your Ad Manager account. Navigate to Delivery > Yield groups and click the New yield group button.
Enter a unique Name for your yield group, set the Status to Active, select your Ad Format, and set the Inventory type to Mobile App. Under the Targeting > Inventory section, select the Ad Unit ID to which you want to add mediation.
Next, click the Add yield partner button.
If you already have a Yield partner for myTarget, you can simply select it. Otherwise, select Create a new yield partner.
Select myTarget as the Ad network and enter a unique Name. Enable Mediation and turn on Automatic data collection, and enter the Permanent Access Token obtained in the previous section. You don't need to enter a Username and Password. Click Save when done.
Once the Yield partner is selected, choose Mobile SDK mediation as the Integration type, iOS as the Platform, and Active as the Status. Enter the Slot ID obtained in the previous section and a Default CPM value.
Click Save at the bottom of the page when done.
Using rewarded video ads
In the settings for your rewarded video 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 Override reward settings from third-party ad networks when using mediation box.
If you don't apply this setting, the myTarget adapter defaults to a reward of
"" (empty string) with a value of
Step 3: Import the myTarget SDK and adapter
Using CocoaPods (recommended)
Add the following line to your project's Podfile:
From the command line run:
pod install --repo-update
- Download the latest version of the myTarget SDK.
- Download the latest version of the
MyTargetAdapter.frameworkin your project.
- Add the following frameworks to your project:
Step 4: Additional code required
No Additional code is required for myTarget Integration.
Step 5: Test your implementation
When testing, myTarget recommends using the slot IDs from its open source example app to request ads. These can be entered as the slot ID for your Ad Manager ad units for testing purposes, and then replaced with an actual slot ID when your app is ready for production.
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 section below shows you how to enable or disable personalized ads for myTarget.
In myTarget SDK version 4.7.9,
myTarget added a user consent
The following sample code sets user consent to
YES on the myTarget SDK. If you choose
to call this method, it is recommended that you do so prior to
requesting ads via the Google Mobile Ads SDK.
#import <MyTargetSDK/MyTargetSDK.h> // ... [MTRGPrivacy setUserConsent:YES];
Additionally, if the user is known to be in an age-restricted category, you can
See myTarget’s GDPR Guide for more information.
The myTarget adapter supports
isDebugMode, an optional extra to enable logging which has a default value of
YES. This parameter can be passed to the adapter using the
GADMAdapterMyTargetExtras class and must be set on every ad request.
Here's how to set it:
let request = () let extras = GADMAdapterMyTargetExtras() extras.isDebugMode = false adRequest.register(extras)
*request = [ request]; GADMAdapterMyTargetExtras * extras = [[GADMAdapterMyTargetExtras alloc] init]; extras.isDebugMode = NO; [request registerAdNetworkExtras:extras];
Using native ads
The myTarget adapter returns its native ads as
|Field||Populated by myTarget adapter|
|Call to action||Always|
|Star rating||Not guaranteed|
Impression and click tracking
The Google Mobile Ads SDK uses the myTarget SDK's callbacks for impression and click tracking, so the reports from both sources should match up with few to no discrepancies.
myTarget iOS Mediation Adapter Changelog
- Verified compatibility with myTarget SDK version 5.4.5
Build and tested With:
- Google Mobile Ads SDK version 7.53.1.
- MyTarget SDK version 5.4.5.
- Verified compatibility with myTarget SDK version 5.4.2
- Adapter now returns a non-zero
Build and tested With:
- Google Mobile Ads SDK version 7.53.1.
- MyTarget SDK version 5.4.2.
- Verified compatibility with myTarget SDK version 5.3.3
- Removed support for Native Content and App Install ad requests. Apps must use the Unified Native Ads API to request native ads.
- Now requires Google Mobile Ads SDK version 7.46.0 or higher.
- Verified compatibility with myTarget SDK version 5.0.4.
- Updated the adapter to use the new rewarded API.
- Now requires Google Mobile Ads SDK version 7.41.0 or higher.
- Verified compatibility with myTarget SDK version 5.0.1.
- Verified compatibility with myTarget SDK version 4.8.9.
- Verified compatibility with myTarget SDK version 4.8.5.
- Verified compatibility with myTarget SDK version 4.8.0.
- Verified compatibility with myTarget SDK version 4.7.11.
- Verified compatibility with myTarget SDK version 4.7.10.
adapterDidCompletePlayingRewardBasedVideoAd:callback to the adapter.
- Added support for Unified native ad.
- Verified compatibility with myTarget SDK version 4.7.9.
- Added support for unified native ad.
- Verified compatibility with myTarget SDK version 4.7.8.
- Verified compatibility with myTarget SDK version 4.7.7.
- Verified compatibility with myTarget SDK version 4.7.6.
- Verified compatibility with myTarget SDK version 4.7.5.
- Verified compatibility with myTarget SDK version 4.7.4.
- Verified compatibility with myTarget SDK version 4.7.3.
- Added support for native video ads.
- Verified compatibility with myTarget SDK version 4.6.25.
- First release!
- Added support for banner, interstitial, rewarded, and native ads.