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 a Unity app.
Supported integrations and ad formats
Integration | |
---|---|
Bidding | |
Waterfall | |
Formats | |
Banner | |
Interstitial | |
Rewarded | |
Rewarded Interstitial |
Requirements
- Unity 4 or higher
- Latest Google Mobile Ads SDK
- 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 the Google Mobile Ads SDK. See Get Started for details.
- 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 将用于设置您的 AdMob 广告单元。
除了 slot_id 之外,您还需要使用 myTarget 永久访问令牌来设置 AdMob 广告单元 ID。前往 Profile 标签页,然后选择 Access Tokens。点击创建令牌或显示令牌以查看 myTarget 永久访问令牌。
开启测试模式
按照 myTarget 文档中的说明在 myTarget 界面中添加和配置测试设备。
Step 2: Set up myTarget demand in AdMob UI
আপনার বিজ্ঞাপন ইউনিটের জন্য মধ্যস্থতা সেটিংস কনফিগার করুন
অ্যান্ড্রয়েড
নির্দেশাবলীর জন্য,Android এর জন্য গাইডের ধাপ 2 দেখুন।
iOS
নির্দেশাবলীর জন্য,iOS- এর জন্য গাইডের ধাপ 2 দেখুন।
Add Mail.ru to GDPR and US state regulations ad partners list
GDPR সেটিংসএবংইউএস স্টেট রেগুলেশন সেটিংসএ ধাপগুলি অনুসরণ করুন AdMob UI এ।
Step 3: Import the myTarget SDK and adapter
Download the latest version of Google Mobile Ads mediation plugin for myTarget
from the download link in the
Changelog and extract the
GoogleMobileAdsMyTargetMediation.unitypackage
from the zip file.
In your Unity project editor, select Assets > Import Package > Custom
Package and find the GoogleMobileAdsMyTargetMediation.unitypackage
file you
downloaded. Make sure that all the files are selected and click Import.
Then, select Assets > Play Services Resolver > Android Resolver > Force
Resolve. The Unity Play Services Resolver 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 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.
The Google Mobile Ads mediation plugin for myTarget version 2.1.0 includes the
SetUserConsent()
and SetUserAgeRestricted()
methods. The following sample
code shows how to pass user 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.
using GoogleMobileAds.Api.Mediation.MyTarget;
// ...
MyTarget.SetUserConsent(true);
If the user is known to be in an age-restricted category, you can also call the
SetUserAgeRestricted()
method.
MyTarget.SetUserAgeRestricted(true);
See myTarget's Privacy and GDPR guide for more information.
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 myTarget version 3.13.3 includes the
SetCCPAUserConsent(bool)
method. The following sample code shows how to pass
user 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.
using GoogleMobileAds.Api.Mediation.MyTarget;
// ...
MyTarget.SetCCPAUserConsent(true);
Contact myTarget support for more information.
Step 5: Add required code
Android
No additional code is required for myTarget integration.
iOS
SKAdNetwork integration
Follow myTarget's documentation
to add the SKAdNetwork identifiers to your project's Info.plist
file.
Step 6: Test your implementation
পরীক্ষা বিজ্ঞাপন সক্ষম করুন
নিশ্চিত করুন যে আপনিAdMob এর জন্য আপনার পরীক্ষার ডিভাইসটি নিবন্ধন করেছেন এবং myTarget UI-তে পরীক্ষা মোড সক্ষম করেছেন ৷
পরীক্ষা বিজ্ঞাপন যাচাই করুন
আপনিmyTargetথেকে পরীক্ষামূলক বিজ্ঞাপনগুলি পাচ্ছেন তা যাচাই করতে, myTarget (Waterfall) বিজ্ঞাপন উত্স(গুলি) ব্যবহার করে বিজ্ঞাপন পরিদর্শক-এ একক বিজ্ঞাপন উত্স পরীক্ষা সক্ষম করুন।
Error codes
If the adapter fails to receive an ad from myTarget, publishers can check the
underlying error from the ad response using
ResponseInfo
under the
following classes:
Android
com.google.ads.mediation.mytarget.MyTargetAdapter
com.google.ads.mediation.mytarget.MyTargetNativeAdapter
com.google.ads.mediation.mytarget.MyTargetRewardedAdapter
iOS
GADMAdapterMyTarget
GADMediationAdapterMyTargetNative
GADMediationAdapterMyTargetRewarded
Here are the codes and accompanying messages thrown by the myTarget adapter when an ad fails to load:
Android
Error code | Reason |
---|---|
100 | myTarget SDK returned an error. |
101 | myTarget server parameters configured in the AdMob UI are missing/invalid. |
102 | The requested ad size does not match a myTarget supported banner size. |
103 | Ad request is not a Unified native ad request. |
104 | The loaded native ad from myTarget is different from the requested native ad. |
105 | The loaded native ad from myTarget is missing some required assets (e.g. image or icon). |
iOS
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 Unity Mediation Plugin Changelog
Version 3.18.0
- Renamed
DummyClient
toPlaceholderClient
. - Supports myTarget Android adapter version 5.22.1.0.
- Supports myTarget iOS adapter version 5.21.6.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 9.2.0.
Version 3.17.1
- Supports myTarget Android adapter version 5.21.1.0.
- Supports myTarget iOS adapter version 5.21.5.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 9.2.0.
Version 3.17.0
- Supports myTarget Android adapter version 5.21.0.0.
- Supports myTarget iOS adapter version 5.21.4.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 9.1.0.
Version 3.16.2
- Supports myTarget Android adapter version 5.20.1.0.
- Supports myTarget iOS adapter version 5.21.2.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 9.1.0.
Version 3.16.1
- Supports myTarget Android adapter version 5.20.1.0.
- Supports myTarget iOS adapter version 5.21.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 9.0.0.
Version 3.16.0
- Supports myTarget Android adapter version 5.20.0.0.
- Supports myTarget iOS adapter version 5.21.0.1.
- Built and tested with the Google Mobile Ads Unity Plugin version 9.0.0.
Version 3.15.0
- Supports myTarget Android adapter version 5.20.0.0.
- Supports myTarget iOS adapter version 5.20.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.7.0.
Version 3.14.0
- Supports myTarget Android adapter version 5.18.0.0.
- Supports myTarget iOS adapter version 5.19.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.5.0.
Version 3.13.2
- Supports myTarget Android adapter version 5.16.5.0.
- Supports myTarget iOS adapter version 5.17.5.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.3.0.
Version 3.13.1
- Moved adapter content to
GoogleMobileAds/Mediation/MyTarget/
. - Refactored adapter namespace to use
GoogleMobileAds.Mediation.MyTarget
. - Supports myTarget Android adapter version 5.16.4.1.
- Supports myTarget iOS adapter version 5.17.4.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.1.0.
Version 3.13.0
- Supports myTarget Android adapter version 5.16.4.0.
- Supports myTarget iOS adapter version 5.17.4.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.0.0.
Version 3.12.0
- Supports myTarget Android adapter version 5.15.5.0.
- Supports myTarget iOS adapter version 5.16.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.3.0.
Version 3.11.4
- Supports myTarget Android adapter version 5.15.4.0.
- Supports myTarget iOS adapter version 5.15.2.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.2.0.
Version 3.11.3
- Renamed the
IsConsent()
method from theMyTarget
class toGetUserConsent()
. - Added the following methods to the
MyTarget
class:SetCCPAUserConsent(bool)
GetCCPAUserConsent()
- Supports myTarget Android adapter version 5.15.3.0.
- Supports myTarget iOS adapter version 5.15.2.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.2.0.
Version 3.11.2
- Supports myTarget Android adapter version 5.15.2.1.
- Supports myTarget iOS adapter version 5.15.2.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.2.
Version 3.11.1
- Supports myTarget Android adapter version 5.15.1.0.
- Supports myTarget iOS adapter version 5.15.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 3.11.0
- Supports myTarget Android adapter version 5.15.0.0.
- Supports myTarget iOS adapter version 5.15.0.1.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 3.10.2
- Supports myTarget Android adapter version 5.14.4.0.
- Supports myTarget iOS adapter version 5.14.4.0.
Version 3.10.1
- Supports myTarget Android adapter version 5.14.3.0.
- Supports myTarget iOS adapter version 5.14.2.0.
Version 3.10.0
- Supports myTarget Android adapter version 5.14.2.0.
- Supports myTarget iOS adapter version 5.14.1.0.
Version 3.9.0
- Supports myTarget Android adapter version 5.13.0.0.
- Supports myTarget iOS adapter version 5.11.2.0.
Version 3.8.2
- Supports myTarget Android adapter version 5.11.7.0.
- Supports myTarget iOS adapter version 5.9.10.0.
Version 3.8.1
- Supports myTarget Android adapter version 5.11.5.0.
- Supports myTarget iOS adapter version 5.9.6.0.
Version 3.8.0
- Supports myTarget Android adapter version 5.11.4.0.
- Supports myTarget iOS adapter version 5.9.5.0.
Version 3.7.0
- Supports myTarget Android adapter version 5.10.0.0.
- Supports myTarget iOS adapter version 5.7.5.0.
Version 3.6.1
- Renamed the
MyTarget.IsUserConsent()
method toMyTarget.IsConsent()
. - Supports myTarget Android adapter version 5.9.1.0.
- Supports myTarget iOS adapter version 5.7.2.0.
Version 3.6.0
- Supports myTarget Android adapter version 5.9.0.0.
- Supports myTarget iOS adapter version 5.7.0.0.
Version 3.5.2
- Supports myTarget Android adapter version 5.8.3.0.
- Supports myTarget iOS adapter version 5.6.3.0.
Version 3.5.1
- Supports myTarget Android adapter version 5.8.2.0.
- Supports myTarget iOS adapter version 5.6.1.0.
Version 3.5.0
- Supports myTarget Android adapter version 5.8.1.0.
- Supports myTarget iOS adapter version 5.6.0.0.
Version 3.4.0
- Supports myTarget Android adapter version 5.8.0.0.
- Supports myTarget iOS adapter version 5.5.2.0.
Version 3.3.0
- Supports myTarget Android adapter version 5.7.0.0.
- Supports myTarget iOS adapter version 5.5.1.0.
Version 3.2.0
- Supports myTarget Android adapter version 5.6.3.0.
- Supports myTarget iOS adapter version 5.4.9.0.
Version 3.1.0
- Supports myTarget Android adapter version 5.4.6.0.
- Supports myTarget iOS adapter version 5.3.3.0.
Version 3.0.0
- Updated the plugin to support the new open-beta Rewarded API.
- Supports myTarget Android adapter version 5.3.9.0.
- Supports myTarget iOS adapter version 5.0.4.0.
Version 2.3.2
- Supports myTarget Android adapter version 5.2.5.0.
- Supports myTarget iOS adapter version 4.8.9.0.
Version 2.3.1
- Supports myTarget Android adapter version 5.2.5.0.
- Supports myTarget iOS adapter version 4.8.5.0.
Version 2.3.0
- Supports myTarget Android adapter version 5.2.2.0.
- Supports myTarget iOS adapter version 4.8.0.0.
Version 2.2.0
- Supports myTarget Android adapter version 5.1.4.0.
- Supports myTarget iOS adapter version 4.8.0.0.
Version 2.1.2
- Supports myTarget Android adapter version 5.1.3.0.
- Supports myTarget iOS adapter version 4.7.11.0.
Version 2.1.1
- Supports myTarget Android adapter version 5.1.1.0.
- Supports myTarget iOS adapter version 4.7.10.0.
Version 2.1.0
- Supports myTarget Android SDK version 5.1.0.
- Supports myTarget iOS SDK version 4.7.9.
- Added the following methods:
MyTarget.SetUserConsent()
method to forward the user's consent status to the MyTarget SDK.MyTarget.SetUserAgeRestricted
method that sets a flag to indicate if the user is known to be in an age-restricted category (i.e., under the age of 16).MyTarget.IsUserConsent()
method to get the user's current consent status.MyTarget.IsUserAgeRestricted()
method to get the flag indicating that the user is known to be in an age-restricted category (i.e., under the age of 16).
Version 2.0.1
- Supports myTarget Android SDK version 5.0.2.
- Supports myTarget iOS SDK version 4.7.8.
Version 2.0.0
- Supports myTarget Android SDK version 5.0.0.
- Supports myTarget iOS SDK version 4.7.7.
Version 1.1.0
- Supports myTarget Android SDK version 4.7.2.
- Supports myTarget iOS SDK version 4.7.6.
Version 1.0.0
- First release!
- Supports myTarget Android SDK version 4.6.27.
- Supports myTarget iOS SDK version 4.6.24.