为帮助发布商遵守《加州消费者隐私法案》(CCPA),Google 移动广告 SDK 允许发布商使用两种不同的参数来指明 Google 是否应启用受限的数据处理。借助该 SDK,发布商可以利用以下信号在广告请求一级设置 RDP:
- Google 的 RDP
- IAB 指定的
IABUSPrivacy_String
无论使用哪种参数,Google 都会对某些唯一标识符的使用方式进行限制,并会在向您提供服务时更为严格地处理数据。因此,Google 将仅展示非个性化广告。这些参数会替换界面中的 RDP 设置。
发布商应自行决定受限的数据处理如何为其合规性计划提供支持以及应在何时启用。这两种可选参数可同时使用,尽管它们对 Google 的广告投放而言效果相同。
本指南旨在帮助发布商了解针对每个广告请求启用这些选项所需的操作步骤。在这两种情况下,应用都会将 extras 参数附加到每个广告请求上,还会将设置写入 SharedPreferences
。
RDP 信号
要通知 Google 应使用 Google 的信号启用 RDP,请为 extras 参数使用 rdp
键,并为 SharedPreferences
使用 gad_rdp
。请确保所用的键名正确无误。
以下代码段演示了如何使用 RDP 参数创建广告请求:
Java
Bundle networkExtrasBundle = new Bundle(); networkExtrasBundle.putInt("rdp", 1); AdRequest request = new AdRequest.Builder() .addNetworkExtrasBundle(AdMobAdapter.class, networkExtrasBundle) .build();
Kotlin
val networkExtrasBundle = Bundle() networkExtrasBundle.putInt("rdp", 1) val request = AdRequest.Builder() .addNetworkExtrasBundle(AdMobAdapter::class.java!!, networkExtrasBundle) .build()
以下代码段演示了如何将标记写入 Activity 中的 SharedPreferences
:
Java
SharedPreferences sharedPref = this.getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt("gad_rdp", 1); editor.commit();
Kotlin
val sharedPref = this.getPreferences(Context.MODE_PRIVATE) val editor = sharedPref.edit() editor.putInt("gad_rdp", 1) editor.commit()
IAB 信号
要通知 Google 应使用 IAB 的信号启用 RDP,请同时为 extras 参数和 SharedPreferences
使用 IABUSPrivacy_String
键(请准确复制该键)。请务必使用符合 IAB 规范的字符串值。
以下代码段演示了如何使用 IAB 参数创建广告请求:
Java
Bundle networkExtrasBundle = new Bundle(); networkExtrasBundle.putString("IABUSPrivacy_String", iab string); AdRequest request = new AdRequest.Builder() .addNetworkExtrasBundle(AdMobAdapter.class, networkExtrasBundle) .build();
Kotlin
val networkExtrasBundle = Bundle() networkExtrasBundle.putString("IABUSPrivacy_String", iab string) val request = AdRequest.Builder() .addNetworkExtrasBundle(AdMobAdapter::class.java!!, networkExtrasBundle) .build()
以下代码段演示了如何将参数写入 Activity 中的 SharedPreferences
:
Java
SharedPreferences sharedPref = this.getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString("IABUSPrivacy_String", iab string); editor.commit();
Kotlin
val sharedPref = this.getPreferences(Context.MODE_PRIVATE) val editor = sharedPref.edit() editor.putString("IABUSPrivacy_String", iab string) editor.commit()
中介
如果您将使用中介功能,请参阅各个广告联盟合作伙伴的文档,以确定他们提供哪些选项来帮助您遵守 CCPA。