To help publishers comply with U.S. states privacy laws, the Google Mobile Ads SDK allows publishers to use two different parameters to indicate whether Google should enable restricted data processing (RDP). 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.
RDP signal
There are two different ways to notify Google that RDP should be enabled using Google's RDP signal:
Extras parameter for RDP
For the extras parameter option, create an ad request that specifies extra
parameters, with a key rdp
and a value of 1
.
Java
Bundle networkExtrasBundle = new Bundle();
networkExtrasBundle.putInt("rdp", 1);
AdManagerAdRequest request = new AdManagerAdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter.class, networkExtrasBundle)
.build();
Kotlin
val networkExtrasBundle = Bundle()
networkExtrasBundle.putInt("rdp", 1)
val request = AdManagerAdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter::class.java!!, networkExtrasBundle)
.build()
Make sure to use this request object when loading an ad.
Shared preferences for RDP
For the shared preferences option, write the key gad_rdp
with a value of 1
to
SharedPreferences
.
The Google Mobile Ads SDK reads the gad_rdp
key during ad loading.
Java
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
sharedPref.edit().putInt("gad_rdp", 1).apply();
Kotlin
val sharedPref = PreferenceManager.getDefaultSharedPreferences(context)
sharedPref.edit().putInt("gad_rdp", 1).apply()
IAB signal
There are two different ways to notify Google that RDP should be enabled using IAB's signal:
Extras parameter for IAB
For the extras parameter option, create an ad request that specifies extra
paremeters, with a key IABUSPrivacy_String
and a string value that is
compliant with the IAB
specification.
Java
Bundle networkExtrasBundle = new Bundle();
networkExtrasBundle.putString("IABUSPrivacy_String", IAB_STRING);
AdManagerAdRequest request = new AdManagerAdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter.class, networkExtrasBundle)
.build();
Kotlin
val networkExtrasBundle = Bundle()
networkExtrasBundle.putString("IABUSPrivacy_String", IAB_STRING)
val request = AdManagerAdRequest.Builder()
.addNetworkExtrasBundle(AdMobAdapter::class.java!!, networkExtrasBundle)
.build()
Make sure to use this request object when loading an ad.
Shared preferences for IAB
For the shared preferences option, write the key IABUSPrivacy_String
with a
string value that is compliant with the IAB
specification
to
SharedPreferences
.
The Google Mobile Ads SDK reads the IABUSPrivacy_String
key during ad loading.
Java
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
sharedPref.edit().putString("IABUSPrivacy_String", IAB_STRING).apply();
Kotlin
val sharedPref = PreferenceManager.getDefaultSharedPreferences(context)
sharedPref.edit().putString("IABUSPrivacy_String", IAB_STRING).apply()
Mediation
If you use mediation:
Follow the steps in Select a data processing setting to add your mediation partners to the CPRA ad partners list in the Ad Manager UI.
Consider writing the IAB signal using shared preferences so mediation partner SDKs that are compliant with the IAB Specification can also read the signal.
Consult each ad network partner's documentation to determine what options they offer to help towards CPRA compliance.