To help publishers toward compliance with the California Consumer Privacy Act (CCPA), the Google Mobile Ads SDK allows publishers to use two different parameters to indicate whether Google should enable restricted data processing. The SDK provides publishers with the ability to set RDP at an ad request level utilizing the following signals:
- Google's RDP
- IAB-defined
IABUSPrivacy_String
When either parameter is used, Google restricts how it uses certain unique identifiers and other data processed in the provision of services to publishers. As a result, Google will only show non-personalized ads. These parameters override the RDP settings in the UI.
Publishers should decide for themselves how restricted data processing can support their compliance plans and when it should be enabled. It is possible to use both optional parameters at the same time, although they have the same effect on Google's ad serving.
This guide is intended to help publishers understand the steps required to
enable these options on a per-ad request basis. In both cases the app
appends an extras parameter onto every ad request and also write a setting to
SharedPreferences
.
RDP signal
To notify Google that RDP should be enabled using Google's signal, use
the key rdp
for the extras parameter and gad_rdp
for
SharedPreferences
.
Make sure you use these exact key names.
The snippet below demonstrates how to create an ad request with the RDP parameter:
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()
This snippet demonstrates how to write the flag to SharedPreferences
within an
Activity:
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 signal
To notify Google that RDP should be enabled using IAB's signal, use the
key IABUSPrivacy_String
(copy this exactly) for both the extras parameter and
SharedPreferences
. Make sure that the string value you use is compliant with
the IAB
specification.
The snippet below demonstrates how to create an ad request with the IAB parameter:
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()
This snippet demonstrates how to write the parameter to SharedPreferences
within
an Activity:
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()
Mediation
If you use mediation, follow the steps in CCPA settings to add your mediation partners to the CCPA ad partners list in the AdMob UI. Also, consult each ad network partner's documentation to determine what options they offer to help towards CCPA compliance.