This article will help you to validate your app's consent mode setup by running it in debug mode and monitoring the logs.
Validate for Android
- Enable Analytics debug mode on an Android device (debug mode is automatically enabled for emulators).
adb shell setprop debug.firebase.analytics.app PACKAGE_NAMEadb shell setprop debug.firebase.analytics.app .none.
- Set Analytics logs to verbose and monitor the logs with Logcat.
- In a terminal, set the log level to verbose
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSEadb logcat -v time -s FA FA-SVC - In Android Studio – set the same filters in the Logcat window
-tag:FA -tag:FA-SVC -level:verbose
- In a terminal, set the log level to verbose
- Validate that defaults were set in the manifest by looking for the following log lines.
- Consent mode V1 signals are indicated by one line
FA-SVC: com.google.android.gms [V] Setting consent, package, consent: {app id}
source=MANIFEST,ad_storage=denied,analytics_storage=denied - Consent mode V2 signals are indicated by 2 lines
- ad_personalization is managed using the non_personalized_ads (npa) property. Learn more about Control data collection for personalised advertising.
FA-SVC: com.google.android.gms [V] Setting DMA consent. package, consent: {app id} source=MANIFEST, ad_user_data=denied
Setting user property: non_personalized_ads(_npa), 1
- ad_personalization is managed using the non_personalized_ads (npa) property. Learn more about Control data collection for personalised advertising.
- Consent mode V1 signals are indicated by one line
- After user consent choices are shared by triggering the consent mode API via a setConsent call in the app, the same log lines will be shown with source=API and the user’s consent choices
- Consent mode V1 signals are indicated by one line
FA-SVC: com.google.android.gms [V] Setting consent, package, consent: {app id}
source=API,ad_storage=granted,analytics_storage=granted - Consent mode V2 signals are indicated by 2 lines
- ad_personalization is managed using the non_personalized_ads (npa) property. Learn more about Control data collection for personalised advertising
FA-SVC: com.google.android.gms [V] Setting DMA consent. package, consent: {app id} source=API, ad_user_data=granted
Setting user property: non_personalized_ads(_npa), 0
- ad_personalization is managed using the non_personalized_ads (npa) property. Learn more about Control data collection for personalised advertising
- Consent mode V1 signals are indicated by one line
Basic mode:
In addition to the validations above, you can also confirm that the SDK is not enabled until after the consent mode API is called.
- Before enabling the SDK, you should view logs such as
FA: {app id} [D] Event not sent since app measurement is disabled
- Confirm that first_open event log is not sent until after user consent choices are sent using consent mode.