Disable Google Analytics for Firebase Cloud Messaging

We coped with GCM at FCM without any problems. The notification service works very well. However, we must disable the measurement part of the Firebase Analytics service application for legal reasons.

We used this guide to disable some analytics https://firebase.google.com/support/guides/disable-analytics

Therefore, we put this flag in the manifest file:

<meta-data android:name="firebase_analytics_collection_enabled" android:value=false /> 

and we also disabled the collection programmatically:

 FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false); 

Unfortunately, data is still being collected, and we can see new events in the Firebase Analytics console. Is it possible to completely disable analytics services?

Thanks for your help.

Edit: I also have deactivation metadata in the application tag:

 <meta-data android:name="firebase_analytics_collection_deactivated" android:value=true /> 
+7
source share
5 answers

As of October 2017, the deactivated value must be true. "false" will no longer work.

 <meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" /> 

The magazine shows that it works.

 10-11 16:29:32.755 27857-27857/? I/FA: Collection disabled with firebase_analytics_collection_deactivated=1 
+5
source

This is a Firebase error or a documentation error to disable the Google Analytics collection . To permanently disable the firebase_analytics_collection_deactivated collection firebase_analytics_collection_deactivated to false (not true):

  <meta-data android:name="firebase_analytics_collection_deactivated" android:value="false" /> 

You can confirm that collection has been disabled by enabling Google Analytics logging:

 adb shell setprop log.tag.FA VERBOSE adb shell setprop log.tag.FA-SVC VERBOSE adb logcat -v time -s FA FA-SVC 

and observing the conclusion, for example:

 I/FA: Collection disabled with firebase_analytics_collection_deactivated=1 D/FA: Event not sent since app measurement is disabled 
+3
source

I tried putting this line in my manifest, inside the application tag, as the first line in the application tag :

  <application android:icon="@mipmap/ic_launcher" android:name="your.package.name"> <meta-data android:name="firebase_analytics_collection_enabled" android:value="false" /> 

At the same time, during init, Firebase is displayed in the logs:

I / FA: collection is disabled using firebase_analytics_collection_enabled = 0

And it seems that after that nothing is reported to firebase.

+1
source

Feedback just received from the Firebase support team.

The manifest file code will not compile unless you add a double quote in the android attribute: value, good work if you already added that.

Temporarily disabling the analytics collection should work, could you please try to enable the detailed debugging option and check the logs?

On the other hand, we know that there is a problem with disabling the analytics collection constantly, there is already an error there, filed for this and the priority of our engineers. Please continue to update with our release notes for further notification of this issue.

We apologize for any inconvenience this may cause you, and we appreciate your understanding as we continue to improve our services as we move forward.

+1
source

To completely disable analytics from Firebase Messaging, you need to exclude analytics packages in gradle:

 implementation('com.google.firebase:firebase-messaging:18.0.0') { exclude group: 'com.google.firebase', module: 'firebase-core' exclude group: 'com.google.firebase', module: 'firebase-analytics' exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' } 

And also disable tracking in the AndroidManifest file:

 <meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" /> <meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" /> <meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" /> 

If you are using proguard, then you also need to add this line to the configuration file

 -dontwarn com.google.firebase.analytics.connector.AnalyticsConnector 

I hope this helps everyone who does not want to include any forms of tracking in their applications, but still uses Firebase Cloud Messaging.

0
source

All Articles