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
內容
依序前往「營利」>「建立內容」,即可建立要與刊登位置一起顯示的內容。
如需建立內容的其他操作說明,請選取與偏好廣告格式對應的分頁:
出價
插頁式
按一下「程式輔助插頁式影片」內容的「建立」按鈕。 提供內容的「名稱」,然後選擇「平台」。 * {Android} * {iOS} 選取先前建立的虛擬貨幣做為虛擬貨幣。 選取先前建立的插頁式廣告刊登位置。完成建立內容後,按一下底部的「Save」按鈕。已獲得獎勵
按一下「程式輔助獎勵影片」內容的「建立」按鈕。 * {Android} * {iOS} 選取先前建立的虛擬貨幣做為「虛擬貨幣」。 選取先前建立的獎勵廣告刊登位置。完成建立內容後,按一下底部的「Save」按鈕。瀑布
插頁式
按一下「插頁式影片」內容的「建立」按鈕。 提供內容的「名稱」,然後選擇「平台」。 * {Android} * {iOS} 選取先前建立的虛擬貨幣做為虛擬貨幣。 選取先前建立的插頁式廣告刊登位置。完成建立內容後,按一下底部的「Save」按鈕。已獲得獎勵
按一下「獎勵影片廣告」內容的「建立」按鈕。 提供內容的「名稱」,然後選擇「平台」。 * {Android} * {iOS} 選取先前建立的虛擬貨幣做為虛擬貨幣。 選取先前建立的獎勵廣告刊登位置。完成建立內容後,按一下底部的「Save」按鈕。找出 SDK 金鑰
除了「刊登位置名稱」外,還需要 SDK 金鑰,才能設定 AdMob 廣告單元。
依序前往「設定」>「應用程式設定」。您可以透過「Application Platforms」分頁下的「App Info」(應用程式資訊) 取得 SDK 金鑰。
Android
iOS
找出報表鍵
出價
整合出價時不需要執行這個步驟。
瀑布
您需要有發布商 OAuth 金鑰和中介服務金鑰,才能繼續進行操作。 您可以在「API Keys」(API 金鑰) 分頁標籤下的相同頁面中取得發布者 OAuth 金鑰。
您可以前往「Reporting API Keys」(報表 API 金鑰) 欄下方的「Mediation Keys」(中介服務金鑰) 分頁,取得中介服務金鑰。金鑰會標示為「AdMob」。
開啟測試模式
您可以在 Tapjoy 資訊主頁的「Settings」>「App Settings」>「Test Devices」底下啟用測試廣告。使用裝置的廣告 ID 建立新的測試裝置:
Android
如要查詢裝置的「廣告 ID」,請在裝置的「設定」中依序前往「Google」>「廣告」。
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);
接著,修改先前建立的內容。
如要修改內容,請先前往「營利」>「刊登位置」,然後按一下「使用者發起」分頁標籤。接著,選取要編輯的內容下拉式選單,然後選擇「Edit」。
在內容的「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 設定 和 美國州級法規設定 ,在 AdMob UI 和美國州級法規廣告合作夥伴清單中新增 Tapjoy。
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.