This guide shows you how to use the Google Mobile Ads SDK to load and display ads from Tapjoy using mediation, covering both bidding and waterfall integrations. It covers how to add Tapjoy to an ad unit's mediation configuration, and how to integrate the Tapjoy SDK and adapter into a Unity app.
Supported integrations and ad formats
The AdMob mediation adapter for Tapjoy has the following capabilities:
Integration | |
---|---|
Bidding | |
Waterfall | |
Formats | |
Banner | |
Interstitial | |
Rewarded |
Requirements
- Unity 4 or higher
- Latest Google Mobile Ads SDK
- [For bidding]: Google Mobile Ads mediation plugin for Tapjoy 2.3.0 or higher (latest version recommended)
- To deploy on Android
- Android API level 19 or higher
- To deploy on iOS
- iOS deployment target of 12.0 or higher
- A working Unity project configured with Google Mobile Ads SDK. See Get Started for details.
- Complete the mediation Get started guide
Step 1: Set up configurations in Tapjoy UI
添加应用
前往右上角的应用列表,然后点击 Add App(添加应用)按钮,将您的应用添加到 Tapjoy 信息中心。然后,系统会提示您输入应用的详细信息。
填写表单,然后点击 Create Now 按钮,将您的应用添加到 Tapjoy 信息中心。
您可以跳过 Tapjoy 提供的集成步骤,直接创建可与中介结合使用的展示位置。 AdMob
如果您的应用同时支持这两种平台,请选择两者作为平台。
Android
iOS
展示位置、虚拟货币和内容
展示位置
依次前往创收 > 展示位置,然后点击右上角的创建展示位置按钮。即使您已有展示位置,也最好为 AdMob 创建一个新展示位置,以便单独进行跟踪和报告。
为展示位置输入名称,选中中介复选框,然后从下拉列表中选择 AdMob。完成后,点击创建。
在下一部分中,系统将使用在此输入的展示位置名称为中介设置AdMob 广告单元。此示例中使用了“AdMob 中介”,但您可以随意调用展示位置。
虚拟货币
依次前往创收 > 虚拟货币,然后点击右上角的创建虚拟货币按钮。
填写表单,然后点击立即创建。使用 NO_CALLBACK 作为回调网址。这样可以确保 Tapjoy SDK 避免对服务器进行不必要的调用。
货币值和名称不会通过 Tapjoy 适配器转发,因此您可以选择货币名称和金额的任何通用值。
Android
iOS
内容
依次前往创收 > 创建内容,创建与展示位置一起展示的内容。
如需了解有关创建内容的更多说明,请选择与首选广告格式对应的标签页:
出价
插页式广告
点击程序化插页式视频广告内容对应的 Create 按钮。 为内容提供名称,然后选择您的平台。 * {Android} * {iOS} 选择之前创建的虚拟货币作为虚拟货币。 选择之前创建的插页式广告展示位置。完成后,点击底部的保存按钮以创建内容。已奖励
点击程序化激励视频广告内容的创建按钮。 * {Android} * {iOS} 选择之前创建的虚拟货币作为虚拟货币。 选择之前创建的激励广告展示位置。完成后,点击底部的保存按钮以创建内容。瀑布
插页式广告
点击插页式视频广告内容对应的创建按钮。 为内容提供名称,然后选择您的平台。 * {Android} * {iOS} 选择之前创建的虚拟货币作为虚拟货币。 选择之前创建的插页式广告展示位置。完成后,点击底部的保存按钮以创建内容。已奖励
点击激励视频广告内容对应的创建按钮。 为内容提供名称,然后选择您的平台。 * {Android} * {iOS} 选择之前创建的虚拟货币作为虚拟货币。 选择之前创建的激励广告展示位置。完成后,点击底部的保存按钮以创建内容。查找 SDK 密钥
除了展示位置名称之外,您还需要 SDK 密钥才能设置广告单元 AdMob 。
依次转到设置 > 应用设置。您可以从应用平台标签页下的应用信息中获取 SDK 密钥。
Android
iOS
找到报告键
出价
出价集成不需要执行此步骤。
瀑布
您需要有发布商 OAuth 密钥和中介密钥才能继续操作。您的发布商 OAuth 密钥可以在同一页面的 API 密钥标签页下获取。
在同一页面中,您可以在报告 API 密钥列下的中介密钥标签页下获取中介密钥。该密钥带有“AdMob”标签。
开启测试模式
您可以在 Tapjoy 信息中心通过 Settings > App Settings > Test Devices 启用测试广告。使用设备的广告 ID 创建一个新的测试设备:
Android
可在设备设置中依次转到 Google > 广告,找到设备的广告 ID。
iOS
要获取您设备的广告 ID,请将以下代码添加到您的应用中。请务必先将 AdSupport 框架导入您的应用,然后再使用下面的代码。
Swift
let advertisingId: String = ASIdentifierManager.shared().advertisingIdentifier.uuidString
print("Advertising ID: \(advertisingId)")
Objective-C
NSString *advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
NSLog(@"Advertising ID: %@", advertisingId);
接下来,修改您之前创建的内容。
如需修改您的内容,请先依次转到创收 > 展示位置,然后点击用户发起标签页。接下来,选择要修改的内容的下拉菜单,然后选择修改。
在内容的 Basic 部分下,选中 Only for Test Devices 复选框。然后,点击页面底部的保存。大功告成!现在,您已与 Tapjoy 有效集成了中介。
Android
iOS
Step 2: Set up Tapjoy demand in AdMob UI
为广告单元配置中介设置
Add Tapjoy to GDPR and US state regulations ad partners list
按照 GDPR 设置 和 美国州级法规设置 中的步骤,将 Tapjoy 添加到 AdMob 界面中的 GDPR 和美国州级法规广告合作伙伴列表中。
Step 3: Import the Tapjoy SDK and adapter
Download the latest version of Google Mobile Ads mediation plugin for Tapjoy
from the download link in the
Changelog and extract
GoogleMobileAdsTapjoyMediation.unitypackage
from the zip file.
In your Unity project editor, select Assets > Import Package > Custom
Package and select the GoogleMobileAdsTapjoyMediation.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 Tapjoy 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 Tapjoy version 1.1.1 includes the
SetUserConsent()
and SubjectToGDPR()
methods. The following sample code
shows how to pass consent information to the Tapjoy 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.Tapjoy;
// ...
Tapjoy.SetUserConsent("myUserConsent");
Additionally, there is an optional flag that can be set to indicate whether the user is subject to GDPR.
Tapjoy.SubjectToGDPR(true);
See Tapjoy's User Privacy guide for more details 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.
The Google Mobile Ads mediation plugin for Tapjoy version 2.9.1 includes the
SetUSPrivacy()
method. The following sample code shows how to pass consent
information to the Tapjoy 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.Tapjoy;
// ...
Tapjoy.SetUSPrivacy("myUSPrivacyString");
See Tapjoy's User Privacy guide for more details and the values that can be provided in the method.
Step 5: Add required code:
Android
No additional code is required for Tapjoy integration.
iOS
SKAdNetwork integration
Follow Tapjoy's documentation to add
the SKAdNetwork identifiers to your project's Info.plist
file.
Step 6: Test your implementation
启用测试广告
请务必为AdMob 注册您的测试设备,并在 Tapjoy 界面中启用测试模式。
验证测试广告
如需验证您收到的是来自Tapjoy的测试广告,请使用相应广告来源在广告检查器中启用单一广告来源测试。 Tapjoy (Bidding) and Tapjoy (Waterfall)
Optional steps
Android
Permissions
For optimal performance, Tapjoy recommends adding the following
optional permissions
to your app's AndroidManifest.xml
file. Modify the AndroidManifest.xml
file located under the
Assets/Plugins/Android/GoogleMobileAdsTapjoyMediation
folder and include
these optional permissions:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
iOS
No additional steps for iOS integration.
Error codes
If the adapter fails to receive an ad from Tapjoy, publishers can check the
underlying error from the ad response using
ResponseInfo
under the
following classes:
Android
Format | Class name |
---|---|
Interstitial | TapjoyAdapter |
Rewarded | TapjoyMediationAdapter |
iOS
Format | Class name |
---|---|
Interstitial | GADMAdapterTapjoy |
Rewarded | GADMAdapterTapjoy |
Here are the codes and accompanying messages thrown by the Tapjoy adapter when an ad fails to load:
Android
Error code | Reason |
---|---|
101 | Tapjoy server parameters configured in the AdMob UI are missing/invalid. |
103 | The publisher must request ads with an Activity context. |
104 | Tapjoy SDK failed to initialize. |
105 | A Tapjoy presentation error occurred during video playback. |
106 | Tapjoy SDK can't load two ads for the same placement ID at once. |
107 | App did not request for native ads. |
108 | Tapjoy SDK has no ad content available. |
iOS
Error code | Reason |
---|---|
101 | Tapjoy server parameters configured in the AdMob UI are missing/invalid. |
102 | Tapjoy SDK failed to initialize. |
103 | The Tapjoy adapter does not support the ad format being requested. |
104 | Tapjoy sent a successful load callback but no content was available. |
105 | An ad is already loaded for this network configuration. |
106 | Tapjoy SDK returned a video failure error callback. |
Tapjoy Unity Mediation Plugin Changelog
Version 3.2.0
- Supports Tapjoy Android adapter version 13.2.1.0.
- Supports Tapjoy iOS adapter version 13.2.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.6.0.
Version 3.1.1
- Supports Tapjoy Android adapter version 13.1.2.0.
- Supports Tapjoy iOS adapter version 13.1.2.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.4.1.
Version 3.1.0
- Supports Tapjoy Android adapter version 13.1.1.0.
- Supports Tapjoy iOS adapter version 13.1.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.4.0.
Version 3.0.0
- Moved adapter content to
GoogleMobileAds/Mediation/Tapjoy/
. - Refactored adapter namespace to use
GoogleMobileAds.Mediation.Tapjoy
. - Supports Tapjoy Android adapter version 13.0.1.0.
- Supports Tapjoy iOS adapter version 13.0.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 8.1.0.
Version 2.10.1
- Supports Tapjoy Android adapter version 12.11.1.0.
- Supports Tapjoy iOS adapter version 12.11.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.4.1.
Version 2.10.0
- Supports Tapjoy Android adapter version 12.11.0.0.
- Supports Tapjoy iOS adapter version 12.11.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.3.0.
Version 2.9.1
- Added the
Tapjoy.SetUSPrivacy(string)
method. - Supports Tapjoy Android adapter version 12.10.0.1.
- Supports Tapjoy iOS adapter version 12.10.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.2.0.
Version 2.9.0
- Supports Tapjoy Android adapter version 12.10.0.1.
- Supports Tapjoy iOS adapter version 12.10.0.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.2.
Version 2.8.2
- Supports Tapjoy Android adapter version 12.9.1.0.
- Supports Tapjoy iOS adapter version 12.9.1.0.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 2.8.1
- Supports Tapjoy Android adapter version 12.9.0.0.
- Supports Tapjoy iOS adapter version 12.9.0.1.
- Built and tested with the Google Mobile Ads Unity Plugin version 7.0.0.
Version 2.8.0
- Supports Tapjoy Android adapter version 12.9.0.0.
- Supports Tapjoy iOS adapter version 12.9.0.0.
Version 2.7.1
- Supports Tapjoy Android adapter version 12.8.1.0.
- Supports Tapjoy iOS adapter version 12.8.1.0.
Version 2.7.0
- Supports Tapjoy Android adapter version 12.8.0.1.
- Supports Tapjoy iOS adapter version 12.8.0.1.
Version 2.6.1
- Supports Tapjoy Android adapter version 12.7.1.0.
- Supports Tapjoy iOS adapter version 12.7.1.0.
Version 2.6.0
- Supports Tapjoy Android adapter version 12.7.0.0.
- Supports Tapjoy iOS adapter version 12.7.0.0.
Version 2.5.1
- Supports Tapjoy Android adapter version 12.6.1.0.
- Supports Tapjoy iOS adapter version 12.6.1.0.
Version 2.5.0
- Supports Tapjoy Android adapter version 12.6.0.0.
- Supports Tapjoy iOS adapter version 12.6.0.0.
Version 2.4.2
- Supports Tapjoy Android adapter version 12.4.2.1.
- Supports Tapjoy iOS adapter version 12.4.2.1.
Version 2.4.1
- Supports Tapjoy Android adapter version 12.4.2.0.
- Supports Tapjoy iOS adapter version 12.4.2.0.
Version 2.4.0
- Supports Tapjoy Android adapter version 12.4.1.0.
- Supports Tapjoy iOS adapter version 12.4.1.0.
Version 2.3.1
- Supports Tapjoy Android adapter version 12.3.3.0.
- Supports Tapjoy iOS adapter version 12.3.3.0.
Version 2.3.0
- Supports Tapjoy Android adapter version 12.3.1.0.
- Supports Tapjoy iOS adapter version 12.3.1.0.
Version 2.2.0
- Updated the plugin to support the new Rewarded API.
- Supports Tapjoy Android adapter version 12.2.1.0.
- Supports Tapjoy iOS adapter version 12.2.1.0.
Version 2.1.0
- Supports Tapjoy Android adapter version 12.2.0.0.
- Supports Tapjoy iOS adapter version 12.1.0.0.
Version 2.0.1
- Supports Tapjoy Android adapter version 12.0.0.1.
- Supports Tapjoy iOS adapter version 12.0.0.0.
Version 2.0.0
- Supports Tapjoy Android adapter version 12.0.0.0.
- Supports Tapjoy iOS adapter version 12.0.0.0.
Version 1.1.1
- Supports Tapjoy Android SDK version 11.12.2.
- Supports Tapjoy iOS SDK version 11.12.2.
- Added
Tapjoy.SetUserConsent()
method to forward the user's consent status to the Tapjoy SDK in the form of a consent string. - Added
Tapjoy.SubjectToGDPR()
method to indicate if GDPR is applicable to the user or not.
Version 1.1.0
- Supports Tapjoy Android SDK version 11.12.1.
- Supports Tapjoy iOS SDK version 11.12.1.
Version 1.0.0
- First release!
- Supports Tapjoy Android SDK version 11.11.1.
- Supports Tapjoy iOS SDK version 11.11.1.