本页中,您将了解如何使用 MAX 条款和隐私政策流程来提示用户接受使用条款和隐私政策。
您可以选择是否使用 MAX SDK 中的 CMP 流程。 如果您集成了自己的 CMP 流程,请确保在初始化 MAX SDK 之前完成该流程。
由于 iOS 17.4 中的 bug,App Tracking Transparency (ATT) 弹窗可能会过早地指示用户拒绝了 ATT。 这会导致 AppLovin SDK 通过配置了 LAT 的广告 networks 初始化广告单元,即使用户随后授予 ATT 许可。 如果您正在使用 AppLovin 的 Unifed Consent Flow,请更新至最新版本的 iOS SDK (12.3.0+) 以缓解该问题。
配合 Google UMP 使用时,AppLovin MAX SDK 符合 TCF v2 的要求:MAX SDK 可以接收许可字符串和 AC 字符串,并按照 TCF v2 许可中的描述,将 TCF v2 许可字符串/状态转发至被聚合的 mediated networks。
如果您不使用 Google UMP 作为您的 CMP(无论是通过 AppLovin 的自动化流程还是其他方式),您必须确保您选择的 CMP 支持您集成的所有 mediated networks。
如果您不使用 CMP,则必须继续按照 GDPR 及其他地区的许可和其他适用标记中的描述设置 AppLovin SDK 的二进制许可标记。
如果您通过 MAX 对接 Google 广告需求,请务必在开始集成前查看 Google CMP 要求。
AppLovin MAX SDK 可自动化集成 Google UMP。 因此集成 MAX SDK 之外,您无需手动集成 Google UMP。 这是一项完全可选的设置,AppLovin 会为您说明如何启用额外的 Google UMP 集成。 下面是此流程的可视化呈现:
在下列任一情况下,TCF 许可状态可能为 false:
您必须先创建 Google GDPR 信息并在 AdMob dashboard 中发布该信息,才能在 MAX 许可流程中显示 Google GDPR 表单。 请按照下列步骤操作:
请勿勾选 Close (do not consent) 选项。
#ffffff)。#6e6e6e)。在默认 of GDPR 信息中,Google 可能不会显示您的所有广告 network 合作伙伴。 如果未能纳入这些 networks,您的广告收入可能会受到负面影响。 请按照本节中的步骤操作,确保 GDPR 消息中显示所有广告合作伙伴。
请参阅 Google AdMob 帮助网站上的“管理 GDPR 广告合作伙伴”,了解已通过 Google 的 GDPR 认证的广告合作伙伴列表。
首先,请将 Google User Messaging Platform SDK 依赖项添加到您应用的目标中。
请在您项目的 Podfile 中进行该操作:
target '«your-project-name»' do
pod 'Google-Mobile-Ads-SDK'
end
在应用的 Info.plist 中创建一个名为 NSUserTrackingUsageDescription ,类型为 String 的新键。
您可以通过该字符串,告知用户应用为什么要请求使用能监测用户或设备的数据。
AppLovin 建议您将该字符串的值设为:“This uses device info for more personalized ads and content.”
启用 MAX 条款和隐私政策流程的方法有两种:通过编程,或向应用程序资源中添加设置文件。 以下各节将详细解释这两种方法。
将应用提交至 App Store Connect 进行审核时,您必须告知审核员您只为 iOS 14.5+ 启用了 App Tracking Transparency 框架权限请求。 请在 Review Notes 部分注明此信息。 否则,Apple 可能会拒绝您的构建版本。
要以编程方式启用 MAX 条款和隐私政策流程,请在初始化 SDK 之前设置 SDK 的 settings 对象的某些属性。
下方的代码示例展示了如何进行此操作:
#import <AppLovinSDK/AppLovinSDK.h>
⋮
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
⋮
ALSdkSettings *settings = [ALSdk shared].settings;
settings.termsAndPrivacyPolicyFlowSettings.enabled = YES;
settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = [NSURL URLWithString: @"«https://your-company-name.com/privacy-policy»"];
// Terms of Service URL is optional
settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = [NSURL URLWithString: @"«https://your-company-name.com/terms-of-service»"];
// Showing Terms & Privacy Policy flow in GDPR region is optional (disabled by default)
settings.termsAndPrivacyPolicyFlowSettings.showTermsAndPrivacyPolicyAlertInGDPR = YES;
// Set the mediation provider value to @"max" to ensure proper functionality
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
builder.mediationProvider = ALMediationProviderMAX;
}];
// Initialize the SDK with the configuration
[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
⋮
}];
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
⋮
let settings = ALSdk.shared().settings
settings.termsAndPrivacyPolicyFlowSettings.isEnabled = true
settings.termsAndPrivacyPolicyFlowSettings.privacyPolicyURL = URL(string: "«https://your-company-name.com/privacy-policy»")
// Terms of Service URL is optional
settings.termsAndPrivacyPolicyFlowSettings.termsOfServiceURL = URL(string: "«https://your-company-name.com/terms-of-service»")
// Showing Terms & Privacy Policy flow in GDPR region is optional (disabled by default)
settings.termsAndPrivacyPolicyFlowSettings.shouldShowTermsAndPrivacyPolicyAlertInGDPR = true
// Please make sure to set the mediation provider value to "max" to ensure proper functionality
let initConfig = ALSdkInitializationConfiguration(sdkKey: "«SDK-key»") { builder in
builder.mediationProvider = ALMediationProviderMAX
⋮
}
// Initialize the SDK with the configuration
ALSdk.shared().initialize(with: initConfig) { sdkConfig in
⋮
}
}
}
您可以在 AppLovin dashboard 的 Account > General > Keys 部分找到 SDK Key。
要使用应用的 AppLovin-Settings.plist 启用 MAX 条款和隐私政策流程,请按照下列步骤操作:
AppLovin-Settings.plist 的新属性列表文件添加到您项目的 main target。AppLovin-Settings.plist 中创建一个名为 ConsentFlowInfo ,类型为 Dictionary 的新键。
在 ConsentFlowInfo 中添加以下键/值对:
ConsentFlowEnabled 键和 YES 值的 Boolean。ConsentFlowPrivacyPolicy 键和隐私政策 URL 值的 String。ConsentFlowTermsOfService 键和服务条款 URL 值的 String。ConsentFlowShowTermsAndPrivacyPolicyAlertInGDPR 键和 YES 值的 Boolean,以便在 Google UMP 流程之前显示 GDPR 地区的条款和隐私政策提醒。最终结果应类似于:

初始化 SDK 时,SDK 会显示许可请求流程。 用户完成流程时,SDK 会调用您的初始化完成回传。
在初始化第三方 SDK (例如 MMP 或数据分析 SDK) 之前,您必须等待用户完成许可请求流程。 因此,请在初始化完成回传中初始化此类 SDK。 如果您在用户完成许可流程之前初始化第三方 SDK,这些 SDK 将无法访问相关标识符,之后的监测、报告 and 广告收入都会受到实质影响。
请不要在初始化回传中初始化 MAX mediated network SDKs。 MAX 会自动进行这些 SDK 的初始化。
如果您要在 MMP 集成中设置用户 ID,请在设置 AppLovin 用户 ID 的位置进行设置。 以下代码片段以 Adjust 为例。 请参阅 Adjust 文档,了解如何初始化 Adjust以及如何设置用户 ID。
#import <AppLovinSDK/AppLovinSDK.h>
#import <Adjust/Adjust.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
⋮
// Create the initialization configuration
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: @"«SDK-key»" builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
builder.mediationProvider = ALMediationProviderMAX;
}];
// Configure the SDK settings if needed before or after SDK initialization.
ALSdkSettings *settings = [ALSdk shared].settings;
settings.userIdentifier = @"«user-ID»";
[Adjust addSessionCallbackParameter: @"«your-user-ID-key»" value: @"«user-ID»"];
// Initialize the SDK with the configuration
[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
// You can check app transparency tracking authorization via configuration.appTrackingTransparencyStatus
// Initialize other 3rd-party SDKs - do not initialize mediated advertising SDKs; MAX will automatically do that for you. Not following this step will result in noticeable integration issues
// Initialize the Adjust SDK inside the AppLovin SDK's initialization callback
ADJConfig *adjustConfig = [ADJConfig configWithAppToken: @"«your-Adjust-app-token»"
environment: ADJEnvironmentSandbox or ADJEnvironmentProduction];
[Adjust appDidLaunch: adjustConfig];
// Start loading ads
}];
}
import AppLovinSDK
import Adjust
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
⋮
// Create the initialization configuration
let initConfig = ALSdkInitializationConfiguration(sdkKey: "«SDK-key»") { builder in
builder.mediationProvider = ALMediationProviderMAX
}
let settings = ALSdk.shared().settings
settings.userIdentifier = "«user-ID»"
Adjust.addSessionCallbackParameter("«your-user-ID-key»", value: "«user-ID»")
// Initialize the SDK with the configuration
ALSdk.shared().initialize(with: initConfig) { sdkConfig in
// App transparency tracking authorization can be checked via `configuration.appTrackingTransparencyStatus`
// Initialize other 3rd-party SDKs - do not initialize mediated advertising SDKs, MAX will do that for you automatically. Not following this step will result in noticeable integration issues
// Initialize the Adjust SDK inside the AppLovin SDK's initialization callback
let adjustConfig = ADJConfig(appToken: "«your-Adjust-app-token»",
environment: ADJEnvironmentSandbox or ADJEnvironmentProduction)
Adjust.appDidLaunch(adjustConfig)
// Start loading ads
}
}
}
请参阅下方表格,了解英文 (基础) 描述,以及可供选择的本地化版本描述。请参阅 文档 > Xcode > 本地化 说明,了解如何本地化您的应用。
| 语言 | String |
|---|---|
| 英语 (基础) | This uses device info for more personalized ads and content |
| 简体中文 (ZhHans) | 我们使用设备信息来提供个性化的广告和内容。 |
| 繁体中文 (ZhHant) | 我們使用設備信息來提供個性化的廣告和內容。 |
| 法语 (fr) | Cela permet d’utiliser les informations du téléphone pour afficher des contenus publicitaires plus pertinents. |
| 德语 (de) | Dies benutzt Gerätinformationen für relevantere Werbeinhalte |
| 日本 (Ja) | 这是ユーザーデータをもとに、より関連性の高い広告コンテンツをお客様に提供します |
| 韩语 (Ko) | 보다 개인화된 광고 및 콘텐츠를 위해 기기 정보를 사용합니다. |
| 西班牙语 (es) | Esto utiliza la información del dispositivo para anuncios y contenido más personalizados |
AppLovin 建议您允许 GDPR 地区的现有用户重新进入 GDPR 流程。
通常,用户可以在应用的设置部分通过Manage Existing Privacy Settings (管理现有隐私设置) 选项来执行此操作。
您可以使用 SDK API ALSdkConfiguration.consentFlowUserGeography 来确定用户是否位于 GDPR 地区。
当 consentFlowUserGeography 为 ALConsentFlowUserGeographyGDPR 时,用户即位于 GDPR 地区。
如果是这样,您可以有条件地向用户显示该设置选项。
当用户点击 Manage Existing Privacy Settings (或其等效选项) 时,调用 -[ALCMPService showCMPForExistingUserWithCompletion]。
这会重置用户现有的许可信息。
#import "MyViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>
@interface MyViewController ()
@end
@implementation MyViewController
- (void)loadAndShowCMPFlow
{
ALCMPService *cmpService = [ALSdk shared].cmpService;
[cmpService showCMPForExistingUserWithCompletion:^(ALCMPError * _Nullable error) {
if ( !error )
{
// The CMP alert was shown successfully.
}
}];
}
@end
import AppLovinSDK
class MyViewController: UIViewController
{
func loadAndShowCmpFlow()
{
let cmpService = ALSdk.shared().cmpService
cmpService.showCMPForExistingUser { error in
if (nil == error)
{
// The CMP alert was shown successfully.
}
}
}
}
如果您想在 GDPR 地区之外测试 Google CMP,请使用下方所示的方法之一,设置调试用户的地理位置:
该流程仅向新用户显示。 如果您想在完成 CMP 提示后测试流程,则必须删除并重新安装应用。
要将调试用户的地理位置设为 GDPR 地区,请参考下列代码示例:
ALSdk.shared.termsAndPrivacyPolicyFlowSettings.debugUserGeography = ALConsentFlowUserGeographyGDPR;
ALSdk.shared().termsAndPrivacyPolicyFlowSettings.debugUserGeography = .GDPR
要设置调试用户地理位置,请在 ConsentFlowInfo 对象下添加带有 gdpr 字符串值的 ConsentFlowDebugUserGeography 键:

在 MAX Mediation Debugger 的 Privacy 部分下,CMP (Consent Management Platform) 行显示已集成的 Google 认证 CMP SDK 的名称。 如果集成了 Google UMP SDK,则会显示 “Google consent management solutions” 作为名称。

如果您选择 CMP (Consent Management Platform) 行,则可以检查 IAB TCF 参数 IABTCF_gdprApplies、IABTCF_TCString 和 IABTCF_AddtlConsent。 对于后两者,您可以点击该行以复制或共享其值。

在 CMP CONFIGURATION 部分,可以验证 Google UMP 配置中集成或缺失的 networks。 这是 MAX 可用的所有 networks 的详尽列表。 您可以忽略应用中未集成的任何 networks。
在您的 CMP 流程中,您必须列出您在应用中集成的 networks。 要检查是否缺失了其中任何 networks,并修复此问题:
重复这些步骤,直到确认您已将全部 networks 包含在 CMP 流程中。
要查看所有 networks 的许可状态,请展开 Mediation Debugger 中的 Network Consent Statuses。 Mediation Debugger 会解析 TC 字符串并显示所有 networks 的许可状态。 此外还会显示从 Google UMP 生成的 AC 字符串中解析出的 AppLovin 许可状态。
