将 Chartboost 与中介集成

本指南介绍了如何使用 Google 移动广告 SDK 通过中介(涵盖广告瀑布流集成)从 Chartboost 加载和展示广告。其中介绍了如何将 Chartboost 添加到广告单元的中介配置,以及如何将 Chartboost SDK 和适配器集成到 Unity 应用中。

支持的集成和广告格式

Chartboost 的 AdMob 中介适配器具有以下功能:

集成
出价
瀑布
表现形式
横幅
插页式广告
已奖励

要求

  • Unity 4 或更高版本
  • 最新版 Google 移动广告 SDK
  • 在 Android 上部署
    • Android API 级别 21 或更高级别
  • 在 iOS 上部署
    • iOS 部署目标为 12.0 或更高版本
  • 使用 Google 移动广告 SDK 配置的有效 Unity 项目。如需了解详情,请参阅开始使用
  • 看完中介服务入门指南

第 1 步:在 Chartboost 界面中设置配置

Sign up for a Chartboost account and log in once your account is verified. Then, navigate to the Apps management tab.

Chartboost apps dashboard

Click the Add new app button to create your app.

Apps Management

Fill out the rest of the form and click the Add App button to finalize your app.

New app form

After your app is created, you will be directed to its dashboard. Take note of the App ID and App Signature of your app.

Android

App settings

iOS

App settings

AdMob requires the Chartboost User ID and User Signature for setting up your AdMob ad unit ID. You can find these parameters by clicking Chartboost mediation on the Chartboost UI.

Chartboost mediation dashboard

Navigate to the Resources > API Explorer tab and take note of your User ID and User Signature located under the Authentication section.

Chartboost api explorer

Turn on test mode

You can enable test mode on your app by navigating to the Apps management tab from the Chartboost UI, selecting your app from the list and clicking on Edit app settings.

Android

Edit app settings

iOS

Edit app settings

From your app's settings, you can toggle Test mode on your app.

Chartboost test mode

Once test mode is enabled, you can request ads using the ad unit ID created earlier and receive a Chartboost test ad.

After you are able to receive Chartboost test ads, your app will be placed on Chartboost's Publisher App Review. In order for monetization on Chartboost to work, the publisher app review will need to be approved by Chartboost.

第 2 步:在界面中设置 Chartboost 需求 AdMob

为广告单元配置中介设置

Android

如需了解相关说明,请参阅 Android 指南中的第 2 步。

iOS

如需了解相关说明,请参阅 iOS 指南中的第 2 步。

将 Chartboost 添加到 GDPR 和美国州级法规广告合作伙伴列表中

按照 GDPR 设置美国州级法规设置 中的步骤,将 Chartboost 添加到 AdMob 界面中的 GDPR 和美国州级法规广告合作伙伴列表中。

第 3 步:导入 Chartboost SDK 和适配器

通过更新日志中的下载链接下载适用于 Chartboost 的最新版 Google 移动广告中介插件,然后从 ZIP 文件中提取 GoogleMobileAdsChartboostMediation.unitypackage

在 Unity 项目编辑器中,依次选择 Assets > Import Package > Custom Package,然后找到您下载的 GoogleMobileAdsChartboostMediation.unitypackage 文件。确保选择所有文件,然后点击 Import

然后,依次选择 Assets > Play Services Resolver > Android Resolver > Force Resolve。Unity Play Services Resolver 库将从头开始执行依赖项解析,并将声明的依赖项复制到 Unity 应用的 Assets/Plugins/Android 目录中。

第 4 步:在 Chartboost SDK 上实现隐私设置

根据 Google 欧盟地区用户意见征求政策,您必须确保就设备标识符和个人数据的使用向欧洲经济区 (EEA) 内的用户披露特定信息,并征得其同意。此政策反映了欧盟《电子隐私指令》和《一般数据保护条例》(GDPR) 的要求。在征求用户意见时,您必须指明中介链中可能会收集、接收或使用个人数据的每个广告联盟,并提供有关每个广告联盟使用情况的信息。Google 目前无法将用户意见征求结果自动传递给此类广告联盟。

适用于 Chartboost 3.1.0 版 Google 移动广告中介插件包含 Chartboost.AddDataUseConsent() 方法。以下示例代码将同意情况设为 NonBehavioral。如果您选择调用此方法,建议您在使用 Google 移动广告 SDK 请求广告之前执行此操作。

using GoogleMobileAds.Api.Mediation.Chartboost;
// ...

Chartboost.AddDataUseConsent(CBGDPRDataUseConsent.NonBehavioral);

美国州级隐私保护法律

美国州级隐私保护法律 规定,用户有权选择不“出售”其“个人信息”(该法律对这些术语进行了定义),“出售”方首页上醒目的“请勿出售我的个人信息”链接提供该拒绝选项。根据美国州级隐私保护法律合规性指南,您可以为 Google 广告投放启用受限的数据处理,但 Google 无法将此设置应用于中介链中的每个广告联盟。因此,您必须找出中介链中可能参与出售个人信息的每个广告联盟,并按照每个广告联盟的指导来确保遵守该政策。

适用于 Chartboost 3.1.0 版 Google 移动广告中介插件包含 Chartboost.AddDataUseConsent() 方法。以下示例代码将同意情况设为 OptInSale。如果您选择调用此方法,建议您在使用 Google 移动广告 SDK 请求广告之前执行此操作。

using GoogleMobileAds.Api.Mediation.Chartboost;
// ...

Chartboost.AddDataUseConsent(CBCCPADataUseConsent.OptInSale);

第 5 步:添加所需的代码

Android

Chartboost 集成无需其他代码。

iOS

SKAdNetwork 集成

按照 Chartboost 的文档中的说明操作,将 SKAdNetwork 标识符添加到项目的 Info.plist 文件中。

第 6 步:测试实现效果

启用测试广告

请务必为AdMob 注册您的测试设备,并在 Chartboost 界面中启用测试模式

验证测试广告

如需验证您收到的是来自Chartboost的测试广告,请使用相应广告来源在广告检查器中启用单一广告来源测试Chartboost (Waterfall)

可选步骤

Android

权限

为了获得最佳性能,Chartboost 建议将以下可选权限添加到应用的 AndroidManifest.xml 文件中:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

iOS

iOS 集成无需执行额外步骤。

错误代码

如果适配器未能接收来自 Chartboost 的广告,发布商可以使用以下类下的 ResponseInfo 检查广告响应中的潜在错误:

Android

com.google.ads.mediation.chartboost.ChartboostAdapter
com.google.ads.mediation.chartboost.ChartboostMediationAdapter

iOS

GADMAdapterChartboost
GADMediationAdapterChartboost

当广告加载失败时,Chartboost 适配器会抛出以下代码和随附的消息:

Android

错误代码 原因
0-99 Chartboost SDK 返回了错误。
101 请求的广告尺寸与 Chartboost 支持的横幅广告尺寸不匹配。
102 Chartboost 一次只能在每个营业地点加载 1 个广告。
103 界面中配置的 Chartboost 服务器参数 AdMob 缺失/无效。
104 Chartboost 插页式广告或激励广告尚未准备好展示。

iOS

错误代码 原因
101 界面中配置的 Chartboost 服务器参数 AdMob 缺失/无效。
102 Chartboost SDK 返回了初始化错误。
103 Chartboost 广告在显示时未进行缓存。
104 请求的广告尺寸与 Chartboost 支持的横幅广告尺寸不匹配。
105 设备的操作系统版本低于 Chartboost SDK 支持的最低操作系统版本。
200-299 Chartboost SDK 缓存错误。如需了解详情,请参阅代码
300-399 Chartboost SDK 会显示错误。如需了解详情,请参阅代码
400-499 Chartboost SDK 点击错误。如需了解详情,请参阅代码

Chartboost Unity 中介插件更新日志

版本 4.6.0

版本 4.5.0

版本 4.4.0

版本 4.3.0

版本 4.2.0

版本 4.1.1

版本 4.1.0

版本 4.0.0

版本 3.5.1

版本 3.5.0

版本 3.4.1

版本 3.4.0

版本 3.3.1

版本 3.3.0

版本 3.2.0

版本 3.1.0

版本 3.0.1

版本 3.0.0

版本 2.0.1

版本 2.0.0

  • 支持 Chartboost Android 适配器版本 7.5.0.0。
  • 支持 Chartboost iOS 适配器版本 8.0.1.1。

版本 1.3.0

  • 更新了插件以支持新的激励广告 API。
  • 支持 Chartboost Android 适配器版本 7.3.1.1。
  • 支持 Chartboost iOS 适配器版本 7.5.0.0。

版本 1.2.0

  • 支持 Chartboost Android 适配器版本 7.3.0.0。
  • 支持 Chartboost iOS 适配器版本 7.3.0.0。

版本 1.1.1

  • 支持 Chartboost Android 适配器版本 7.2.0.1。
  • 支持 Chartboost iOS 适配器版本 7.2.0.1。

版本 1.1.0

  • 支持 Chartboost Android SDK 7.2.0 版。
  • 支持 Chartboost iOS SDK 7.2.0 版。
  • 添加了 Chartboost.RestrictDataCollection() 方法,以便为 Chartboost SDK 启用 GDPR 数据收集限制。

版本 1.0.0

  • 第一个版本!
  • 支持 Chartboost Android SDK 7.0.1 版。
  • 支持 Chartboost iOS SDK 7.1.2 版。