本指南介绍了通过 UMP SDK 支持美国州级法规消息的操作步骤。请将这些说明与 使用入门搭配使用,后者详细介绍了如何在您的应用中运行 UMP SDK,以及如何设置消息。以下指南专门针对美国州级法规消息。
前提条件
在继续之前,请确保您已完成以下操作:
- 更新到最新版本的 UMP SDK。 如需支持美国州级法规消息,我们建议您使用版本 2.1.0 或更高版本。
- 设置 UMP SDK。 请务必实现隐私选项入口点,并在需要时呈现该入口点。完成本指南后,您将拥有一个入口点,可用于向用户投放美国州级法规消息。
- 为应用创建美国州级法规消息 。
- 如果您同时使用美国州级法规消息和其他 消息,请参阅 可用的用户消息类型 ,了解何时向用户显示不同的消息。
设置未达到同意年龄的用户标记
如需指明用户是否未达到同意年龄,请设置
setTagForUnderAgeOfConsent (TFUA)。当您将 TFUA 设置为
true 时,UMP SDK 不会请求用户同意。如果您的应用面向混合受众群体,请为儿童用户设置此参数,以确保系统不会请求用户同意。
您有责任在必要时设置此参数,以遵守《儿童在线隐私保护法》(COPPA) 和其他相关法规。
以下示例在 UMP 同意请求中将 TFUA 设置为 true:
Swift
// Create a UMPRequestParameters object.
let parameters = RequestParameters()
// Indicate the user is under age of consent.
parameters.isTaggedForUnderAgeOfConsent = true
// Request an update for the consent information.
ConsentInformation.shared.requestConsentInfoUpdate(with: parameters) {
[weak self] requestConsentError in
guard let self else { return }
// ...
}
Objective-C
// Create a UMPRequestParameters object.
UMPRequestParameters *parameters = [[UMPRequestParameters alloc] init];
// Indicate the user is under age of consent.
parameters.tagForUnderAgeOfConsent = YES;
// Request an update for the consent information.
[UMPConsentInformation.sharedInstance
requestConsentInfoUpdateWithParameters:parameters
completionHandler:^(NSError *_Nullable requestConsentError) {
// ...
}];
读取同意选择
在用户做出美国州级法规决定后,您可以按照全球隐私保护平台 (GPP)
规范从本地存储空间读取用户的选择。如需了解详情,请参阅
应用内详细信息。请注意,UMP
SDK 仅填充 IABGPP_GppSID 和 IABGPP_HDR_GppString 键。
测试美国州级法规消息
如需测试美国州级法规消息,请使用 UMPDebugGeographyRegulatedUSState debugGeography 强制 UMP SDK
将您的测试设备视为位于受监管的美国州。您还可以使用 UMPDebugGeographyOther 强制禁止显示美国州级法规消息。如需详细了解debugGeography,请参阅
强制指定地理位置。