本指南介绍了如何向广告请求提供定位信息。
前提条件
- 完成入门指南。
RequestConfiguration
RequestConfiguration
是一个结构体,用于收集要
通过 SetRequestConfiguration()
全局函数进行全局应用。
如需更新请求配置,请先获取当前配置,执行任何所需的更新,然后按如下所示进行设置:
firebase::gma::RequestConfiguration retrieved_configuration = firebase::gma::GetRequestConfiguration(); // .. apply your changes, then: firebase::gma::SetRequestConfiguration(request_configuration);
面向儿童的设置
为了遵守《儿童在线隐私保护法》 (COPPA), 有一个名为“标记为面向儿童的内容”的设置通过设置 标记,即表示您确认此通知准确无误,且您有权 代表应用所有者执行操作。您了解,滥用此设置 我们可能会终止您的 Google 账号。
作为应用开发者,您可以在发出广告请求时表明是否希望 Google 将您的内容视为面向儿童的内容。如果您表明 希望 Google 将您的内容视为面向儿童的内容,我们会采取措施以 针对该广告请求投放 IBA 和再营销广告。
可以通过分配
RequestConfiguration
结构体的 tag_for_child_directed_treatment
个成员更改为
下列枚举值之一:
- 将
RequestConfiguration::tag_for_child_directed_treatment
分配给RequestConfiguration::kChildDirectedTreatmentTrue
以指明 根据《儿童在线隐私保护法》(COPPA) 的规定,您的内容会被视为面向儿童的内容。 - 将
RequestConfiguration::tag_for_child_directed_treatment
分配给RequestConfiguration::kChildDirectedTreatmentFalse
来表明您 并不希望根据《儿童在线隐私保护法》(COPPA) 的规定将您的内容视为面向儿童的内容。 - 将
RequestConfiguration::tag_for_child_directed_treatment
分配给RequestConfiguration::kChildDirectedTreatmentUnspecified
如果您不想使用 以表明您希望如何根据《儿童在线隐私保护法》(COPPA) 。
以下示例表明您希望将自己的内容视为 是否属于面向儿童的内容:
firebase::gma::RequestConfiguration request_configuration = firebase::gma::GetRequestConfiguration(); request_configuration.tag_for_child_directed_treatment = firebase::RequestConfiguration::kChildDirectedTreatmentTrue; firebase::gma::SetRequestConfiguration(request_configuration);
设置此标记,即表示您确认此通知准确无误,且您有权代表应用的所有者行事。您了解,滥用此设置可能会导致您的 Google 账号被终止。
未达到同意年龄的用户
您可以对广告请求进行标记,确保针对未达到法定承诺年龄的欧洲经济区 (EEA) 用户投放的是合适的广告。这项功能旨在帮助您遵守《一般数据保护条例》(GDPR)。请注意,您可能还须承担 GDPR 规定的其他法律义务。请查看 获取欧盟相关指导并咨询您自己的法律顾问。另外请注意,Google 的工具旨在协助发布商遵守法规,但并不能免除任何特定发布商按照法律规定所需承担的义务。了解详情 来了解 GDPR 给发布商带来了哪些影响。
使用这项功能时,广告请求中会包含一个用于表示用户位于欧洲且未达到法定承诺年龄的标记 (TFUA) 参数。此参数会禁止针对所有广告请求投放个性化广告(包括再营销广告)。并且还会禁止向第三方广告供应商(例如广告衡量像素和第三方广告服务器)发送请求。
与面向儿童的设置一样,RequestConfiguration 中也有一个成员
配置 TFUA 参数:tag_for_under_age_of_consent
。该参数可能是
并配置了以下枚举值:
- 将
RequestConfiguration::tag_for_under_age_of_consent
分配给RequestConfiguration::kUnderAgeOfConsentTrue
,即表明您希望按适合未达到法定承诺年龄的欧洲经济区 (EEA) 用户的方式处理该广告请求。 - 将
RequestConfiguration::tag_for_under_age_of_consent
分配给RequestConfiguration::kUnderAgeOfConsentFalse
,以表示您想要 广告请求未得到针对欧洲经济区用户进行处理 (欧洲经济区 [EEA])内的用户未达到同意年龄。 - 将
RequestConfiguration::tag_for_under_age_of_consent
分配给RequestConfiguration::kUnderAgeOfConsentUnspecified
来表明您 尚未指明是否应按用户标准来处理该广告请求 欧洲经济区 (EEA) 内的用户,未达到同意年龄。
以下示例表明您希望广告请求中包含 TFUA:
firebase::gma::RequestConfiguration request_configuration = firebase::gma::GetRequestConfiguration(); request_configuration.tag_for_under_age_of_consent = firebase::RequestConfiguration::kUnderAgeOfConsentTrue; firebase::gma::SetRequestConfiguration(request_configuration);
用于启用“面向儿童”设置和未达到同意年龄的用户的代码 不应同时设置为 true。如果同时设置为 true,则以“面向儿童的设置”为准。
广告内容过滤
应用可通过
RequestConfiguration::max_ad_content_rating field
。AdMob 广告返回的时间
配置的内容分级等于或低于该级别。可能出现的
取决于数字内容标签分类,
下列枚举值之一:
RequestConfiguration::kMaxAdContentRatingG
RequestConfiguration::kMaxAdContentRatingPG
RequestConfiguration::kMaxAdContentRatingT
RequestConfiguration::kMaxAdContentRatingMA
下面的代码会配置 RequestConfiguration
结构体,以指定返回的广告内容所对应的数字内容标签不应高于 G:
firebase::gma::RequestConfiguration request_configuration = firebase::gma::GetRequestConfiguration(); request_configuration.max_ad_content_rating = firebase::RequestConfiguration::kMaxAdContentRatingG; firebase::gma::SetRequestConfiguration(request_configuration);
AdRequest
AdRequest
对象可收集随广告一起发送的定位信息
请求。
内容网址
在请求广告时,应用可能会传递自身正在投放的内容的网址。 这样,您就可以进行关键字定位,从而将广告与内容进行匹配。
例如,如果您的应用在显示
https://www.example.com
,您可以传递此网址来定位相关的关键字:
// AdRequest with content URL: firebase::admob::AdRequest ad_request(/*content_url=*/"https://www.example.com"); // AdRequest without content URL: firebase::admob::AdRequest ad_request();