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 app.
Supported integrations and ad formats
The 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
Latest Google Mobile Ads SDK
Complete the mediation Get started guide
Step 1: Set up configurations in myTarget UI
首先,注册或登录您的 myTarget 帐号。点击标题上的应用以转到“应用”页面。点击添加应用以添加应用。
如果您的应用同时支持 Android 和 iOS 平台,您需要单独设置其中每个平台。
Android
接下来,提供您应用的 Google Play 网址。
iOS
接下来,提供应用的 iTunes 网址**。
添加应用时,myTarget 会要求您先创建一个广告单元,然后才能完成此流程。
横幅
从可用的广告格式中选择BANNER,然后点击BANNER按钮。
插页式广告
从可用的广告格式中选择插页式广告,然后点击添加广告单元按钮。
已奖励
从可用的广告格式中选择激励视频,然后点击添加广告单元按钮。
原生
从可用的广告格式中选择原生,然后点击添加广告单元。
在广告单元的详情页面中,记下您的广告位 ID(您可以在广告单元设置下找到 slot_id)。在下一部分中,此广告位 ID 将用于设置您的 Ad Manager 广告单元。
除了 slot_id 之外,您还需要使用 myTarget 永久访问令牌来设置 AdMob 广告单元 ID。前往 Profile 标签页,然后选择 Access Tokens。点击创建令牌或显示令牌以查看 myTarget 永久访问令牌。
开启测试模式
按照 myTarget 文档中的说明在 myTarget 界面中添加和配置测试设备。
Step 2: Set up myTarget demand in Ad Manager UI
Vermittlungseinstellungen für Anzeigenblöcke konfigurieren
Android
Eine Anleitung finden Sie in Schritt 2 der Anleitung für Android.
iOS
Eine Anleitung dazu finden Sie in Schritt 2 der Anleitung für iOS.
Add Mail.ru to GDPR and US state regulations ad partners list
Folgen Sie den Schritten unter DSGVO-Einstellungen und Einstellungen zu Bestimmungen von US-Bundesstaaten um Mail.ru in die Liste der Werbepartner gemäß DSGVO und US-Bundesstaaten auf der Ad Manager Benutzeroberfläche aufzunehmen.
Step 3: Import the myTarget SDK and adapter
Using CocoaPods (recommended)
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
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.
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
Testanzeigen aktivieren
Registrieren Sie Ihr Testgerät für Ad Manager und aktivieren Sie den Testmodus in der myTarget Benutzeroberfläche.
Testanzeigen überprüfen
Wenn Sie prüfen möchten, ob Sie Testanzeigen vonmyTargeterhalten, aktivieren Sie im Anzeigenprüftool mithilfe der myTarget (Waterfall) Anzeigenquellen den Test für eine einzelne Anzeigenquelle.
Optional steps
Using native ads
Ad rendering
The myTarget adapter returns its native ads as
GADNativeAd
objects. It populates the following
fields
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 Ad Manager 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.7.0
- Verified compatibility with myTarget SDK version 5.21.7.
Built and tested with:
- Google Mobile Ads SDK version 11.8.0.
- MyTarget SDK version 5.21.7.
Version 5.21.6.0
- Verified compatibility with myTarget SDK version 5.21.6.
Built and tested with:
- Google Mobile Ads SDK version 11.7.0.
- MyTarget SDK version 5.21.6.
Version 5.21.5.0
- Verified compatibility with myTarget SDK version 5.21.5.
Built and tested with:
- Google Mobile Ads SDK version 11.7.0.
- MyTarget SDK version 5.21.5.
Version 5.21.4.0
- Verified compatibility with myTarget SDK version 5.21.4.
Built and tested with:
- Google Mobile Ads SDK version 11.5.0.
- MyTarget SDK version 5.21.4.
Version 5.21.3.0
- Verified compatibility with myTarget SDK version 5.21.3.
Built and tested with:
- Google Mobile Ads SDK version 11.5.0.
- MyTarget SDK version 5.21.3.
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 withinMyTargetAdapter.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.