Integrate myTarget with mediation

This guide shows you how to use the Google Mobile Ads SDK to load and display ads from myTarget using mediation, covering waterfall integrations. 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 integrations and ad formats

The AdMob mediation adapter for myTarget has the following capabilities:

Integration
Bidding
Waterfall
Formats
Banner
Interstitial
Rewarded
Native

Requirements

  • iOS deployment target of 12.0 or higher

Step 1: Set up configurations in myTarget UI

首先,注册登录您的 myTarget 帐号。点击标题上的应用以转到“应用”页面。点击添加应用以添加应用。

接下来,提供您应用的 iTunes 网址

添加应用时,myTarget 会要求您先创建一个广告单元,然后才能完成此流程。

从可用的广告格式中选择BANNER,然后点击BANNER按钮。

插页式广告

从可用的广告格式中选择插页式广告,然后点击添加广告单元按钮。

已奖励

从可用的广告格式中选择激励视频,然后点击添加广告单元按钮。

原生

从可用的广告格式中选择原生,然后点击添加广告单元

在广告单元的详情页面中,记下您的广告位 ID(您可以在广告单元设置下找到 slot_id)。在下一部分中,此广告位 ID 将用于设置您的 AdMob 广告单元。

除了 slot_id 之外,您还需要使用 myTarget 永久访问令牌来设置 AdMob 广告单元 ID。前往 Profile 标签页,然后选择 Access Tokens。点击创建令牌显示令牌以查看 myTarget 永久访问令牌

开启测试模式

按照 myTarget 文档中的说明在 myTarget 界面中添加和配置测试设备。

Step 2: Set up myTarget demand in AdMob UI

Configure mediation settings for your ad unit

You need to add myTarget 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 myTarget 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, and then click Add Ad Units.

Associate this mediation group with one or more of your existing AdMob ad units. Then click Done.

You should now see the ad units card populated with the ad units you selected:

Add myTarget as an ad source

Under the Waterfall card in the Ad Sources section, select Add Ad Source. Then select myTarget.

Select myTarget and enable the Optimize switch. Enter the Permanent Access Token obtained in the previous section to set up ad source optimization for myTarget. Then enter an eCPM value for myTarget and click Continue.

If you already have a mapping for myTarget, you can select it. Otherwise, click Add mapping.

Next, enter the Slot ID obtained in the previous section. Then click Done.

Add Mail.ru to GDPR and US state regulations ad partners list

Follow the steps in GDPR settings and US state regulations settings to add Mail.ru to the GDPR and US state regulations ad partners list in the AdMob UI.

Step 3: Import the myTarget SDK and adapter

  • Add the following line to your project's Podfile:

    pod 'GoogleMobileAdsMediationMyTarget'
    
  • From the command line run:

    pod install --repo-update

Manual integration

  • Download the latest version of the myTarget SDK.
  • Download the latest version of the myTarget adapter from the download link in the Changelog and link MyTargetAdapter.framework in your project.
  • Add the following frameworks to your project:
    • CoreLocation
    • CoreTelephony
    • CoreMedia
    • SystemConfiguration
    • StoreKit
    • AdSupport
    • SafariServices
    • AVFoundation

Step 4: Implement privacy settings on myTarget SDK

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.

In SDK version 4.7.9, myTarget added a user consent API to support privacy requirements. The following sample code shows how to pass this consent information to the myTarget SDK. If you choose to call this method, it is recommended that you do so prior to requesting ads through the Google Mobile Ads SDK.

Swift

import MyTargetSDK
// ...

MTRGPrivacy.setUserConsent(true)

Objective-C

#import <MyTargetSDK/MyTargetSDK.h>
// ...

[MTRGPrivacy setUserConsent:YES];

Additionally, if the user is known to be in an age-restricted category, you can use the following code to pass this consent information to the myTarget SDK.

Swift

import MyTargetSDK
// ...

MTRGPrivacy.setUserAgeRestricted(true)

Objective-C

#import <MyTargetSDK/MyTargetSDK.h>
// ...

[MTRGPrivacy setUserAgeRestricted:YES];

See myTarget's Privacy and GDPR guide for more information 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.

In SDK version 5.7.0, myTarget added a user consent API to support privacy requirements. The following sample code shows how to pass this consent information to the myTarget SDK. If you choose to call this method, it is recommended that you do so prior to requesting ads through the Google Mobile Ads SDK.

Swift

import MyTargetSDK
// ...

MTRGPrivacy.setCcpaUserConsent(true)

Objective-C

#import <MyTargetSDK/MyTargetSDK.h>
// ...

[MTRGPrivacy setCcpaUserConsent:YES];

Contact myTarget support for more information and the values that can be provided in the method.

Step 5: Add required code

SKAdNetwork integration

Follow myTarget'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 myTarget UI.

Verify test ads

To verify that you are receiving test ads from myTarget, enable single ad source testing in ad inspector using the myTarget (Waterfall) ad source(s).

Optional steps

Network-specific parameters

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:

Swift

let request = GADRequest()
let extras = GADMAdapterMyTargetExtras()
extras.isDebugMode = false
adRequest.register(extras)

Objective-C

GADRequest *request = [GADRequest request];
GADMAdapterMyTargetExtras * extras = [[GADMAdapterMyTargetExtras alloc] init];
extras.isDebugMode = NO;
[request registerAdNetworkExtras:extras];

Using native ads

Ad rendering

The myTarget adapter returns its native ads as GADNativeAd objects. It populates the following native ads field descriptions for a GADNativeAd.

Field Populated by myTarget adapter
Headline Always
Image Always
Body Always
App icon Always
Call to action Always
Star rating Not guaranteed
Store Not guaranteed
Price Not guaranteed
Logo Not guaranteed
Advertiser Always

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.

Error codes

If the adapter fails to receive an ad from myTarget, you can check the underlying error from the ad response using GADResponseInfo.adNetworkInfoArray under the following classes:

GADMAdapterMyTarget
GADMediationAdapterMyTargetNative
GADMediationAdapterMyTargetRewarded

Here are the codes and accompanying messages thrown by the myTarget adapter when an ad fails to load:

Error code Reason
100 myTarget SDK does not yet have an ad available.
101 myTarget server parameters configured in the AdMob UI are missing/invalid.
102 myTarget Adapter does not support the ad format being requested.
103 Tried to show a myTarget ad that is not loaded.
104 The requested ad size does not match a myTarget supported banner size.
105 Missing required native ad assets.

myTarget iOS Mediation Adapter Changelog

Version 5.21.2.0

  • Verified compatibility with myTarget SDK version 5.21.2.

Built and tested with:

  • Google Mobile Ads SDK version 11.3.0.
  • MyTarget SDK version 5.21.2.

Version 5.21.1.0

  • Verified compatibility with myTarget SDK version 5.21.1.

Built and tested with:

  • Google Mobile Ads SDK version 11.2.0.
  • MyTarget SDK version 5.21.1.

Version 5.21.0.1

  • Now requires minimum iOS version 12.0.
  • Now requires Google Mobile Ads SDK version 11.0 or higher.
  • Included Info.plist in the frameworks within MyTargetAdapter.xcframework.

Built and tested with:

  • Google Mobile Ads SDK version 11.0.1.
  • MyTarget SDK version 5.21.0.

Version 5.21.0.0

  • Verified compatibility with myTarget SDK version 5.21.0.

Built and tested with:

  • Google Mobile Ads SDK version 11.0.1.
  • MyTarget SDK version 5.21.0.

Version 5.20.2.0

  • Verified compatibility with myTarget SDK version 5.20.2.

Built and tested with:

  • Google Mobile Ads SDK version 11.0.0.
  • MyTarget SDK version 5.20.2.

Version 5.20.1.0

  • Verified compatibility with myTarget SDK version 5.20.1.

Built and tested with:

  • Google Mobile Ads SDK version 10.14.0.
  • MyTarget SDK version 5.20.1.

Version 5.19.0.0

  • Verified compatibility with myTarget SDK version 5.19.0.
  • Now requires minimum iOS version 12.4.

Built and tested with:

  • Google Mobile Ads SDK version 10.8.0.
  • MyTarget SDK version 5.19.0.

Version 5.18.0.0

  • Verified compatibility with myTarget SDK version 5.18.0.

Built and tested with:

  • Google Mobile Ads SDK version 10.7.0.
  • MyTarget SDK version 5.18.0.

Version 5.17.5.0

  • Verified compatibility with myTarget SDK version 5.17.5.
  • Removed support of the armv7 architecture.
  • Now requires minimum iOS version 11.0.
  • Now requires Google Mobile Ads SDK version 10.4.0 or higher.

Built and tested with:

  • Google Mobile Ads SDK version 10.5.0.
  • MyTarget SDK version 5.17.5.

Version 5.17.4.0

  • Verified compatibility with myTarget SDK version 5.17.4.
  • Now requires Google Mobile Ads SDK version 10.0.0 or higher.

Built and tested with:

  • Google Mobile Ads SDK version 10.2.0.
  • MyTarget SDK version 5.17.4.

Version 5.16.0.0

  • Updated the adapter to use the didRewardUser API.
  • Now requires Google Mobile Ads SDK version 9.8.0 or higher.
  • Verified compatibility with myTarget SDK version 5.16.0.

Built and tested with:

  • Google Mobile Ads SDK version 9.10.0.
  • MyTarget SDK version 5.16.0.

Version 5.15.2.0

  • Verified compatibility with myTarget SDK version 5.15.2.

Built and tested with:

  • Google Mobile Ads SDK version 9.5.0.
  • MyTarget SDK version 5.15.2.

Version 5.15.1.0

  • Verified compatibility with myTarget SDK version 5.15.1.

Built and tested with:

  • Google Mobile Ads SDK version 9.2.0.
  • MyTarget SDK version 5.15.1.

Version 5.15.0.1

  • Added support for the arm64 simulator architecture.

Built and tested with:

  • Google Mobile Ads SDK version 9.0.0.
  • MyTarget SDK version 5.15.0.

Version 5.15.0.0

  • Verified compatibility with myTarget SDK version 5.15.0.
  • Verified compatibility with Google Mobile Ads SDK version 9.0.0.
  • Now requires Google Mobile Ads SDK version 9.0.0 or higher.

Built and tested with:

  • Google Mobile Ads SDK version 9.0.0.
  • MyTarget SDK version 5.15.0.

Version 5.14.4.0

  • Verified compatibility with myTarget SDK version 5.14.4.

Built and tested With:

  • Google Mobile Ads SDK version 8.13.0.
  • MyTarget SDK version 5.14.4.

Version 5.14.3.0

  • Verified compatibility with myTarget SDK version 5.14.3.
  • Added support for setting parameters in GADMAdapterMyTargetExtras.
  • Added support for passing extras in rewarded ads.

Built and tested With:

  • Google Mobile Ads SDK version 8.13.0.
  • MyTarget SDK version 5.14.3.

Version 5.14.2.0

  • Verified compatibility with myTarget SDK version 5.14.2.

Built and tested With:

  • Google Mobile Ads SDK version 8.12.0.
  • MyTarget SDK version 5.14.2.

Version 5.14.1.0

  • Verified compatibility with myTarget SDK version 5.14.1.

Built and tested With:

  • Google Mobile Ads SDK version 8.11.0.
  • MyTarget SDK version 5.14.1.

Version 5.14.0.0

  • Verified compatibility with myTarget SDK version 5.14.0.
  • Now requires minimum iOS version 10.0.

Built and tested With:

  • Google Mobile Ads SDK version 8.11.0.
  • MyTarget SDK version 5.14.0.

Version 5.13.1.0

  • Verified compatibility with myTarget SDK version 5.13.1.

Built and tested With:

  • Google Mobile Ads SDK version 8.10.0.
  • MyTarget SDK version 5.13.1.

Version 5.13.0.0

  • Verified compatibility with myTarget SDK version 5.13.0.

Built and tested With:

  • Google Mobile Ads SDK version 8.9.0.
  • MyTarget SDK version 5.13.0.

Version 5.12.1.0

  • Verified compatibility with myTarget SDK version 5.12.1.

Built and tested With:

  • Google Mobile Ads SDK version 8.8.0.
  • MyTarget SDK version 5.12.1.

Version 5.12.0.0

  • Verified compatibility with myTarget SDK version 5.12.0.

Built and tested With:

  • Google Mobile Ads SDK version 8.7.0.
  • MyTarget SDK version 5.12.0.

Version 5.11.2.0

  • Verified compatibility with myTarget SDK version 5.11.2.

Built and tested With:

  • Google Mobile Ads SDK version 8.5.0.
  • MyTarget SDK version 5.11.2.

Version 5.11.1.0

  • Verified compatibility with myTarget SDK version 5.11.1.
  • Relaxed dependency to Google Mobile Ads SDK version 8.0.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 8.5.0.
  • MyTarget SDK version 5.11.1.

Version 5.11.0.0

  • Verified compatibility with myTarget SDK version 5.11.0.
  • Now requires Google Mobile Ads SDK version 8.4.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 8.4.0.
  • MyTarget SDK version 5.11.0.

Version 5.10.3.0

  • Verified compatibility with myTarget SDK version 5.10.3.
  • Now requires Google Mobile Ads SDK version 8.3.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 8.3.0.
  • MyTarget SDK version 5.10.3.

Version 5.10.1.0

  • Verified compatibility with myTarget SDK version 5.10.1.

Built and tested With:

  • Google Mobile Ads SDK version 8.1.0.
  • MyTarget SDK version 5.10.1.

Version 5.10.0.0

  • Verified compatibility with myTarget SDK version 5.10.0.
  • Now requires Google Mobile Ads SDK version 8.1.0 or higher.
  • Updated the adapter to use the .xcframework format.

Built and tested With:

  • Google Mobile Ads SDK version 8.1.0.
  • MyTarget SDK version 5.10.0.

Version 5.9.11.0

  • Verified compatibility with myTarget SDK version 5.9.10.

Built and tested With:

  • Google Mobile Ads SDK version 7.69.0.
  • MyTarget SDK version 5.9.11.

Version 5.9.10.0

  • Verified compatibility with myTarget SDK version 5.9.10.

Built and tested With:

  • Google Mobile Ads SDK version 7.69.0.
  • MyTarget SDK version 5.9.10.

Version 5.9.9.1

  • Fixed an issue where banner ads sometimes load with a larger size than requested.

Built and tested With:

  • Google Mobile Ads SDK version 7.69.0.
  • MyTarget SDK version 5.9.9.

Version 5.9.9.0

  • Verified compatibility with myTarget SDK version 5.9.9.

Built and tested With:

  • Google Mobile Ads SDK version 7.69.0.
  • MyTarget SDK version 5.9.9.

Version 5.9.8.0

  • Verified compatibility with myTarget SDK version 5.9.8.

Built and tested With:

  • Google Mobile Ads SDK version 7.69.0.
  • MyTarget SDK version 5.9.8.

Version 5.9.7.0

  • Verified compatibility with myTarget SDK version 5.9.7.
  • Now requires Google Mobile Ads SDK version 7.69.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.69.0.
  • MyTarget SDK version 5.9.7.

Version 5.9.6.0

  • Verified compatibility with myTarget SDK version 5.9.6.
  • Added standardized adapter error codes and messages.

Built and tested With:

  • Google Mobile Ads SDK version 7.68.0.
  • MyTarget SDK version 5.9.6.

Version 5.9.5.0

  • Verified compatibility with myTarget SDK version 5.9.5.

Built and tested With:

  • Google Mobile Ads SDK version 7.68.0.
  • MyTarget SDK version 5.9.5.

Version 5.9.4.0

  • Verified compatibility with myTarget SDK version 5.9.4.

Built and tested With:

  • Google Mobile Ads SDK version 7.68.0.
  • MyTarget SDK version 5.9.4.

Version 5.9.3.0

  • Verified compatibility with myTarget SDK version 5.9.3.
  • Now requires Google Mobile Ads SDK version 7.68.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.68.0.
  • MyTarget SDK version 5.9.3.

Version 5.9.2.0

  • Added support for myTarget's adaptive banner ad size.
  • Verified compatibility with myTarget SDK version 5.9.2.
  • Now requires Google Mobile Ads SDK version 7.67.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.67.0.
  • MyTarget SDK version 5.9.2.

Version 5.7.5.0

  • Verified compatibility with myTarget SDK version 5.7.5.

Built and tested With:

  • Google Mobile Ads SDK version 7.64.0.
  • MyTarget SDK version 5.7.5.

Version 5.7.4.0

  • Verified compatibility with myTarget SDK version 5.7.4.
  • Now requires Google Mobile Ads SDK version 7.64.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.64.0.
  • MyTarget SDK version 5.7.4.

Version 5.7.3.0

  • Verified compatibility with myTarget SDK version 5.7.3.
  • Now requires Google Mobile Ads SDK version 7.63.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.63.0.
  • MyTarget SDK version 5.7.3.

Version 5.7.2.0

  • Verified compatibility with myTarget SDK version 5.7.2.

Built and tested With:

  • Google Mobile Ads SDK version 7.62.0.
  • MyTarget SDK version 5.7.2.

Version 5.7.1.0

  • Verified compatibility with myTarget SDK version 5.7.1.

Built and tested With:

  • Google Mobile Ads SDK version 7.61.0.
  • MyTarget SDK version 5.7.1.

Version 5.7.0.0

  • Verified compatibility with myTarget SDK version 5.7.0.

Built and tested With:

  • Google Mobile Ads SDK version 7.61.0.
  • MyTarget SDK version 5.7.0.

Version 5.6.3.0

  • Verified compatibility with myTarget SDK version 5.6.3.
  • Now requires Google Mobile Ads SDK version 7.61.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.61.0.
  • MyTarget SDK version 5.6.3.

Version 5.6.2.0

  • Verified compatibility with myTarget SDK version 5.6.2.

Built and tested With:

  • Google Mobile Ads SDK version 7.60.0.
  • MyTarget SDK version 5.6.2.

Version 5.6.1.0

  • Verified compatibility with myTarget SDK version 5.6.1.

Built and tested With:

  • Google Mobile Ads SDK version 7.60.0.
  • MyTarget SDK version 5.6.1.

Version 5.6.0.0

  • Verified compatibility with myTarget SDK version 5.6.0.
  • Now requires Google Mobile Ads SDK version 7.60.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.60.0.
  • MyTarget SDK version 5.6.0.

Version 5.5.2.0

  • Verified compatibility with myTarget SDK version 5.5.2.
  • Now requires Google Mobile Ads SDK version 7.59.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.59.0.
  • MyTarget SDK version 5.5.2.

Version 5.5.1.0

  • Verified compatibility with myTarget SDK version 5.5.1.
  • Now requires Google Mobile Ads SDK version 7.58.0 or higher.

Built and tested With:

  • Google Mobile Ads SDK version 7.58.0.
  • MyTarget SDK version 5.5.1.

Version 5.4.9.0

  • Verified compatibility with myTarget SDK version 5.4.9.
  • Removed support for the i386 architecture.

Built and tested With:

  • Google Mobile Ads SDK version 7.57.0.
  • MyTarget SDK version 5.4.9.

Version 5.4.7.0

  • Verified compatibility with myTarget SDK version 5.4.7.
  • Now requires minimum iOS version 9.0.

Built and tested With:

  • Google Mobile Ads SDK version 7.55.1.
  • MyTarget SDK version 5.4.7.

Version 5.4.5.0

  • Verified compatibility with myTarget SDK version 5.4.5.

Built and tested With:

  • Google Mobile Ads SDK version 7.53.1.
  • MyTarget SDK version 5.4.5.

Version 5.4.2.0

  • Verified compatibility with myTarget SDK version 5.4.2.
  • Adapter now returns a non-zero mediaContent aspect ratio.

Built and tested With:

  • Google Mobile Ads SDK version 7.53.1.
  • MyTarget SDK version 5.4.2.

Version 5.3.3.0

  • 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.

Version 5.0.4.0

  • 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.

Version 5.0.1.0

  • Verified compatibility with myTarget SDK version 5.0.1.

Version 4.8.9.0

  • Verified compatibility with myTarget SDK version 4.8.9.

Version 4.8.5.0

  • Verified compatibility with myTarget SDK version 4.8.5.

Version 4.8.0.0

  • Verified compatibility with myTarget SDK version 4.8.0.

Version 4.7.11.0

  • Verified compatibility with myTarget SDK version 4.7.11.

Version 4.7.10.0

  • Verified compatibility with myTarget SDK version 4.7.10.
  • Added adapterDidCompletePlayingRewardBasedVideoAd: callback to the adapter.

Version 4.7.9.1

  • Added support for Unified native ad.

Version 4.7.9.0

  • Verified compatibility with myTarget SDK version 4.7.9.
  • Added support for unified native ad.

Version 4.7.8.0

  • Verified compatibility with myTarget SDK version 4.7.8.

Version 4.7.7.0

  • Verified compatibility with myTarget SDK version 4.7.7.

Version 4.7.6.0

  • Verified compatibility with myTarget SDK version 4.7.6.

Version 4.7.5.0

  • Verified compatibility with myTarget SDK version 4.7.5.

Version 4.7.4.0

  • Verified compatibility with myTarget SDK version 4.7.4.

Version 4.7.3.0

  • Verified compatibility with myTarget SDK version 4.7.3.
  • Added support for native video ads.

Version 4.6.25.0

  • Verified compatibility with myTarget SDK version 4.6.25.

Version 4.6.24.0

  • First release!
  • Added support for banner, interstitial, rewarded, and native ads.