Disabling analytics for iOS has no effect?

3362 views
Skip to first unread message

Peter LoBue

unread,
Jun 24, 2016, 9:16:30 PM6/24/16
to Firebase Google Group
I want to disable Firebase Analytics by default for my debug release, and enable it programmatically for my production release. I've tried following the instructions here for iOS:
https://firebase.google.com/support/guides/disable-analytics

As instructed, I added FIREBASE_ANALYTICS_ENABLED to my app's Info.plist with the value NO. Still I get the following logs in the console:

<FIRAnalytics/INFO> Firebase Analytics v.3200000 started
<FIRAnalytics/INFO> Firebase Analytics enabled

I tried adding this to GoogleService-Info.plist, also to no effect.

BTW also I see IS_ANALYTICS_ENABLED set to NO in GoogleService-Info.plist.

Thanks!

Jacob Klint

unread,
Jun 27, 2016, 7:42:58 PM6/27/16
to Firebase Google Group
Thanks for the heads-up, there was a typo in the key for the plist. The instructions have been updated with the correct key 'FIREBASE_ANALYTICS_COLLECTION_ENABLED'. Set this to Boolean NO in your Info.plist and the startup log should look like this:
<FIRAnalytics/INFO> Firebase Analytics v.3200000 started
<FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
<FIRAnalytics/INFO> Firebase Analytics disabled

Peter LoBue

unread,
Jun 28, 2016, 10:04:33 PM6/28/16
to Firebase Google Group
Thanks Jacob! It works now. However, a couple things tripped me up that could have been made clearer in the documentation.


setAnalyticsCollectionEnabled is an instance method, not a class method. It would be nice if the instructions included the full line of code required:
[[
FIRAnalyticsConfiguration sharedInstance] setAnalyticsCollectionEnabled:YES]

For some reason the following (Swift) lines in Xcode don't give me any errors, even though the code is wrong:
#if RELEASE
FIRAnalyticsConfiguration.setAnalyticsCollectionEnabled(true)
#endif


Also, it took me a couple runs to realize that the value sent to setAnalyticsCollectionEnabled is saved across app executions. I was expecting the Info.plist value to apply for every app execution, and that I had to call setAnalyticsCollectionEnabled for every launch in the AppDelegate, but that's not the case.


Reply all
Reply to author
Forward
0 new messages