Integrate Chartboost with mediation

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

支持的集成和广告格式

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

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

要求

  • iOS 部署目标为 12.0 或更高版本
  • 最新版 Google 移动广告 SDK

  • 看完中介服务入门指南

第 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.

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.

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

Configure mediation settings for your ad unit

You need to add Chartboost to the mediation configuration for your ad unit.

First, sign in to your AdMob account. Next, navigate to the Mediation tab. If you have an existing mediation group you'd like to modify, click the name of that mediation group to edit it, and skip ahead to Add Chartboost as an ad source.

To create a new mediation group, select Create Mediation Group.

Enter your ad format and platform, then click Continue.

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled, and then click Add Ad Units.

Associate this mediation group with one or more of your existing AdMob ad units. Then click Done.

You should now see the ad units card populated with the ad units you selected:

Add Chartboost as an ad source

Under the Waterfall card in the Ad Sources section, select Add Ad Source. Then select Chartboost.

Select Chartboost and enable the Optimize switch. Enter the User ID and User Signature obtained in the previous section to set up ad source optimization for Chartboost. Then enter an eCPM value for Chartboost and click Continue.

If you already have a mapping for Chartboost, you can select it. Otherwise, click Add mapping.

Next, enter the App ID, App Signature and Ad Location obtained in the previous section. Then click Done.

Chartboost Ad Locations (Named Locations) are simple names representing a place in your app where you want to show an ad. AdMob sends requests to the location specified in the settings. Once requests are sent, Chartboost adds the location to its platform for reporting purposes. Users also have the ability to create new ad locations directly in the Chartboost platform before calling them in their games.

In the Chartboost UI, your Ad Locations can be revealed in the Basic Settings page by clicking Advanced Settings. See Chartboost's Named Locations guide for more details.

Finally, click Done to add Chartboost as an ad source, and then click Save.

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

Follow the steps in GDPR settings and US state regulations settings to add Chartboost to the GDPR and US state regulations ad partners list in the AdMob UI.

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

  • 将以下代码行添加到项目的 Podfile 中:

    pod 'GoogleMobileAdsMediationChartboost'
    
  • 在命令行中运行以下命令:

    pod install --repo-update
    

手动集成

  • 下载最新版本的 Chartboost SDK,并在您的项目中关联 Chartboost.frameworkCHAMoatMobileAppKit.framework

  • 通过 Changelog 中的下载链接下载最新版本的 Chartboost 适配器,并在项目中关联 ChartboostAdapter.framework

  • 将以下框架添加到您的项目中:

    • StoreKit
    • Foundation
    • CoreGraphics
    • WebKit
    • AVFoundation
    • UIKit

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

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

在 SDK 版本 8.2.0 中,Chartboost 添加了 addDataUseConsent 方法。以下示例代码将同意情况设为 CHBGDPRConsentNonBehavioral。如果您选择调用此方法,建议您在通过 Google 移动广告 SDK 请求广告之前执行此操作。

Swift

let dataUseConsent = CHBDataUseConsent.GDPR(CHBDataUseConsent.GDPR.Consent.nonBehavioral)
Chartboost.addDataUseConsent(dataUseConsent)

Objective-C

CHBGDPRDataUseConsent *dataUseConsent = [CHBGDPRDataUseConsent gdprConsent:CHBGDPRConsentNonBehavioral];
[Chartboost addDataUseConsent:dataUseConsent];

如需了解详情以及可在每种方法中提供的值,请参阅 Chartboost 的 GDPR 文章及其 iOS 隐私保护方法

美国州级隐私保护法律

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

在 SDK 版本 8.2.0 中,Chartboost 添加了 addDataUseConsent 方法。以下示例代码将同意情况设为 CHBCCPAConsentOptInSale。如果您选择调用此方法,建议您在通过 Google 移动广告 SDK 请求广告之前进行调用。

Swift

let dataUseConsent = CHBDataUseConsent.CCPA(CHBDataUseConsent.CCPA.Consent.optInSale)
Chartboost.addDataUseConsent(dataUseConsent)

Objective-C

CHBCCPADataUseConsent *dataUseConsent = [CHBCCPADataUseConsent ccpaConsent:CHBCCPAConsentOptInSale];
[Chartboost addDataUseConsent:dataUseConsent];

如需了解详情以及可在每种方法中提供的值,请参阅 Chartboost 的 CCPA 文章及其 iOS 隐私保护方法

错误代码

如果适配器未能接收来自 Chartboost 的广告,您可以使用 GADResponseInfo.adNetworkInfoArray(位于以下类下):

GADMAdapterChartboost
GADMediationAdapterChartboost

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

错误代码 原因
0-99 Chartboost SDK 返回了错误。如需了解详情,请参阅 Chartboost 的文档
101 请求的广告尺寸与 Chartboost 支持的横幅广告尺寸不匹配。
102 Chartboost 一次只能在每个营业地点加载 1 个广告。
103 界面中配置的 Chartboost 服务器参数 AdMob 缺失/无效。
104 Chartboost 插页式广告或激励广告尚未准备好展示。
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 iOS 中介适配器更新日志

版本 9.7.0.0

  • 已验证与 Chartboost SDK 9.7.0 版本的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 11.2.0 版。
  • Chartboost SDK 版本 9.7.0。

版本 9.6.0.1

  • 现在要求最低 iOS 版本为 12.0。
  • 现在需要 Google 移动广告 SDK 11.0 或更高版本。
  • ChartboostAdapter.xcframework 的框架中添加了 Info.plist

构建和测试时所用平台:

  • Google 移动广告 SDK 11.0.1 版。
  • Chartboost SDK 版本 9.6.0。

版本 9.6.0.0

  • 已验证与 Chartboost SDK 9.6.0 版本的兼容性。
  • 将已弃用的 GADMobileAds.sharedInstance.sdkVersion 方法替换为了 GADMobileAds.sharedInstance.versionNumber
  • 添加了 GADMediationInterstitialAd 实现。

构建和测试时所用平台:

  • Google 移动广告 SDK 10.14.0 版。
  • Chartboost SDK 版本 9.6.0。

版本 9.5.1.0

  • 已验证与 Chartboost SDK 9.5.1 版的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 10.12.0 版。
  • Chartboost SDK 9.5.1 版。

版本 9.4.0.0

  • 已验证与 Chartboost SDK 9.4.0 版本的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 10.7.0 版。
  • Chartboost SDK 版本 9.4.0。

版本 9.3.1.0

  • 已验证与 Chartboost SDK 9.3.1 版的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 10.7.0 版。
  • Chartboost SDK 9.3.1 版。

版本 9.3.0.0

  • 已验证与 Chartboost SDK 9.3.0 版本的兼容性。
  • 现在要求最低 iOS 版本为 11.0。
  • 现在需要 Google 移动广告 SDK 10.4.0 或更高版本。

构建和测试时所用平台:

  • Google 移动广告 SDK 10.4.0 版。
  • Chartboost SDK 版本 9.3.0。

版本 9.2.0.0

  • 移除了 ChartboostAdapter 头文件中的 GADMChartboostExtras 导入。
  • 已验证与 Chartboost SDK 9.2.0 版本的兼容性。
  • 现在需要 Google 移动广告 SDK 10.0.0 或更高版本。
  • 移除了对 armv7 架构的支持。
  • 现在要求 iOS 最低版本为 11.0。

构建和测试时所用平台:

  • Google 移动广告 SDK 10.0.0 版。
  • Chartboost SDK 版本 9.2.0。

版本 9.1.0.0

  • 已验证与 Chartboost SDK 9.1.0 版本的兼容性。

构建和测试时所用平台:

  • Google 移动广告 SDK 9.11.0 版。
  • Chartboost SDK 版本 9.1.0。

版本 9.0.0.0

  • 已验证与 Chartboost SDK 9.0.0 版本的兼容性。
  • 已验证与 Google 移动广告 SDK 9.10.0 版兼容。
  • 更新了适配器以使用 didRewardUser API。
  • 现在需要 Google 移动广告 SDK 9.8.0 或更高版本。

构建和测试时所用平台:

  • Google 移动广告 SDK 9.10.0 版。
  • Chartboost SDK 版本 9.0.0。

版本 8.5.0.2

  • 已验证与 Google 移动广告 SDK 9.0.0 版兼容。
  • 现在需要 Google 移动广告 SDK 9.0.0 或更高版本。

构建和测试时所用平台:

  • Google 移动广告 SDK 9.0.0 版。
  • Chartboost SDK 8.5.0 版。

版本 8.5.0.1.0

  • 已验证与 CocoaPods 中的 Chartboost SDK 8.5.0(引用版本 8.5.0.1)兼容。

构建和测试所用的

  • Google 移动广告 SDK 8.13.0 版。
  • Chartboost SDK 8.5.0 版。

版本 8.5.0.0

  • 已验证与 Chartboost SDK 8.5.0 的兼容性。

构建和测试所用的

  • Google 移动广告 SDK 8.12.0 版。
  • Chartboost SDK 8.5.0 版。

版本 8.4.2.0

  • 已验证与 Chartboost SDK 8.4.2 的兼容性。

构建和测试所用的

  • Google 移动广告 SDK 8.6.0 版。
  • Chartboost SDK 版本 8.4.2。

版本 8.4.1.1

  • 放宽了对 Google 移动广告 SDK 8.0.0 或更高版本的依赖。

构建和测试所用的

  • Google 移动广告 SDK 8.4.0 版。
  • Chartboost SDK 版本 8.4.1。

版本 8.4.1.0

  • 已验证与 Chartboost SDK 8.4.1 的兼容性。
  • 现在需要 Google 移动广告 SDK 8.1.0 或更高版本。

构建和测试所用的

  • Google 移动广告 SDK 8.1.0 版。
  • Chartboost SDK 版本 8.4.1。

版本 8.4.0.1

  • 添加了标准化的适配器错误代码和消息。
  • 将适配器更新为使用 .xcframework 格式。
  • 现在需要 Google 移动广告 SDK 8.0.0 或更高版本。

构建和测试所用的

  • Google 移动广告 SDK 8.0.0 版。
  • Chartboost SDK 版本 8.4.0。

版本 8.4.0.0

  • 已验证与 Chartboost SDK 8.4.0 的兼容性。
  • 现在需要 Google 移动广告 SDK 7.68.0 或更高版本。

构建和测试所用的

  • Google 移动广告 SDK 7.68.0 版。
  • Chartboost SDK 版本 8.4.0。

版本 8.3.1.0

  • 已验证与 Chartboost SDK 8.3.1 的兼容性。
  • 现在需要 Google 移动广告 SDK 7.66.0 或更高版本。
  • 现在要求 iOS 最低版本为 10.0。
  • 更新了适配器,以支持自适应横幅广告请求。

构建和测试所用的

  • Google 移动广告 SDK 7.66.0 版。
  • Chartboost SDK 版本 8.3.1。

版本 8.2.1.0

  • 已验证与 Chartboost SDK 8.2.1 的兼容性。
  • 现在需要 Google 移动广告 SDK 7.64.0 或更高版本。
  • 现在要求 iOS 最低版本为 9.0。

构建和测试所用的

  • Google 移动广告 SDK 7.64.0 版。
  • Chartboost SDK 版本 8.2.1。

版本 8.2.0.0

  • 已验证与 Chartboost SDK 8.2.0 的兼容性。
  • 现在需要 Google 移动广告 SDK 7.61.0 或更高版本。

构建和测试所用的

  • Google 移动广告 SDK 7.61.0 版。
  • Chartboost SDK 版本 8.2.0。

版本 8.1.0.1

  • 将要求的最低 Google 移动广告 SDK 版本更新为 7.60.0。
  • 更新了适配器以使用 Chartboost 的新 API,并移除了已废弃的 API。
  • Adapter 现在支持使用同一 Chartboost 位置加载相同格式的多个广告。
  • 如果未在 AdMob 或 Ad Manager 界面中替换奖励,则激励广告的奖励值现在为 Chartboost 界面中指定的值,而非 0

构建和测试所用的

  • Google 移动广告 SDK 7.60.0 版。
  • Chartboost SDK 版本 8.1.0。

版本 8.1.0.0

  • 已验证与 Chartboost SDK 8.1.0 的兼容性。
  • 将要求的最低 Google 移动广告 SDK 版本更新为 7.59.0。
  • 取消了对 i386 架构的支持。

构建和测试所用的

  • Google 移动广告 SDK 7.59.0 版。
  • Chartboost SDK 版本 8.1.0。

版本 8.0.4.0

  • 已验证与 Chartboost SDK 8.0.4 的兼容性。

构建和测试所用的

  • Google 移动广告 SDK 7.52.0 版。
  • Chartboost SDK 版本 8.0.4。

版本 8.0.1.1

  • 修复了请求横幅广告时不返回任何填充操作的问题。

版本 8.0.1.0

  • 已验证与 Chartboost SDK 8.0.1 的兼容性。
  • 添加了对请求横幅广告的支持。

7.5.0.1 版

  • 添加了用于正确初始化 Chartboost SDK 的代码。

7.5.0.0 版

  • 已验证与 Chartboost SDK 7.5.0 的兼容性。
  • 更新了适配器,以使用新的激励广告 API。
  • 更新了适配器,可处理多个插页式广告请求。
  • 现在需要 Google 移动广告 SDK 7.42.2 或更高版本。

7.3.0.0 版

  • 已验证与 Chartboost SDK 7.3.0 的兼容性。

7.2.0.1 版

  • 向适配器添加了 adapterDidCompletePlayingRewardBasedVideoAd: 回调。

7.2.0.0 版

  • 已验证与 Chartboost SDK 7.2.0 的兼容性。

7.1.2.0 版

  • 已验证与 Chartboost SDK 7.1.2 的兼容性。

7.1.1.0 版

  • 已验证与 Chartboost SDK 7.1.1 的兼容性。

7.1.0.0 版

  • 已验证与 Chartboost SDK 7.1.0 的兼容性。

版本 7.0.4.0

  • 已验证与 Chartboost SDK 7.0.4 的兼容性。

版本 7.0.3.0

  • 已验证与 Chartboost SDK 7.0.3 的兼容性。

7.0.2.0 版

  • 已验证与 Chartboost SDK 7.0.2 的兼容性。
  • 添加了对两个新的 Chartboost 错误代码的支持。

7.0.1.0 版

  • 已验证与 Chartboost SDK 7.0.1 的兼容性。

7.0.0.0 版

  • 已验证与 Chartboost SDK 7.0.0 的兼容性。

版本 6.6.3.0

  • 已验证与 Chartboost SDK 6.6.3 的兼容性。
  • 移除了对“armv7s”架构的支持。
  • 修复了以下 bug:将 ChartboostAdapter.framework 作为导入非模块化 Chartboost SDK 的模块时,发布商在 Swift 中遇到编译问题。

版本 6.6.2.0

  • 已验证与 Chartboost SDK 6.6.2 的兼容性。

版本 6.6.1.0

  • 已验证与 Chartboost SDK 6.6.1 的兼容性。

版本 6.6.0.0

  • 已验证与 Chartboost SDK 6.6.0 的兼容性。

版本 6.5.2.1

  • 已启用位码支持。
  • 现在以框架的形式分发 Chartboost 适配器。
  • 如需在项目中导入 ChartboostAdapter.framework,请务必在目标的“Build Settings”(构建设置)下将 Allow Non-modular Includes in Framework Modules 设置为 YES

版本 6.5.2.0

  • 将版本命名系统更改为了 [Chartboost SDK version].[adapter patch version]。
  • 将所需的最低 Chartboost SDK 更新到了 v6.5.1。
  • 将要求的最低 Google 移动广告 SDK 更新到了 v7.10.1。
  • 修复了一个错误,以支持多个 Chartboost 广告位置。
  • 现在,应用会在插页式广告即将关闭时获取 interstitialWillDismissScreen: 回调。
  • 现在,当基于奖励的视频广告打开时,应用会收到 rewardBasedVideoAdDidOpen: 回调。

版本 1.1.0

  • 从 Chartboost extra 中移除了 Chartboost 广告位置。现在,在为中介配置 Chartboost 时,您可以在 AdMob 控制台中指定广告位置。

版本 1.0.0

  • 初始版本。支持基于奖励的视频广告和插页式广告。