Google Advertising ID
Overview
As of late 2021, when an Android user opts out of either interest-based advertising or ads personalization device-level permissions, the Google Advertising ID will no longer be available for applications to use for tracking. Instead, the Google Advertising ID becomes all 0's. For more information, please review the Google Advertising ID Developer page.
Measuring Google Advertising ID Opt Ins / Outs
The OneTrust SDK can help applications measure the opt in / out rates of the Google Advertising ID permissions. This can help publishers gain analytics and insights on how user's manage their ad-based preferences over time. Follow the guide below to adopt this measurement behavior.
Configure the Setting on OneTrust Tenant
First, you will need to enable the Google Advertising ID measurement setting on the Geolocation Rule for your Android app on the OneTrust tenant. Please follow our step by step myOT guide to set that up and publish so the OneTrust SDK adheres to this behavior.
Add the OneTrust SDK to your Application
If not already, you'll need to follow our guide for adding the OneTrust SDK to your Android app.
Add the Google Mobile Ads SDK Dependency
In order to use the functionality described, the OneTrust SDK requires the application to include the Google Mobile Ads SDK ads-identifier dependency.
If your application is already using the Google Mobile Ads SDK dependency, you can skip this step.
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
This dependency's version is subject to change. Please include the version that best suites your application. Version
18.0.1
is the latest at time of writing.
Declare Google Play Services Permission in Manifest File
If your app's target API level is set to 31 (Android 12), you will need to declare a Google Play services normal permission in the manifest file as follows:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Note from Google: Some SDKs, such as the Google Mobile Ads SDK (play-services-ads) may already declare this permission in the SDK’s library manifest. If your app uses these SDKs as dependencies, the AD_ID permission from the SDK’s library manifest will be merged with your app’s main manifest by default, even if you don’t explicitly declare the permission in your app’s main manifest.
Initialize the OneTrust SDK to Measure Consent Changes for Google Advertising ID Permission
Since the Google Advertising ID permission can be changed at any time by a user in Android's device settings, the OneTrust SDK needs a way to become aware of that consent change in order to log the change to the OneTrust server for measurement and reporting.
This process happens automatically during the OneTrust SDK's startSDK()
flow.
- If permission has changed, the SDK will log this Opt In / Opt Out to the OneTrust server
- If permission is un-changed, the SDK will skip this step and continue other steps
Under the hood, the OneTrust SDK uses the isLimitAdTrackingEnabled()
public method on the AdvertisingIdClient.Info
class to compute the opt in / out metric. App developers can also utilize this method to check the status of the permission at any time.
Measuring the Permission Changes on OneTrust Dashboards
When the Google Advertising ID permission changes, the OneTrust SDK will log a consent to OneTrust tenant that includes:
- Purpose Name:
Android Advertising ID
- Purpose Status:
Confirmed
when user changed to opted in.Opted Out
when user changed to opted out.
- Timestamp: The moment the OneTrust SDK became aware of the change based on the app calling
startSDK()
.
Please review our guidance for Viewing Consent Receipts for more information.
Updated 9 months ago