28

I update 'Google/Analytics' from CocoaPod and get FirebaseAnalytics.

After that, each time I run project, the FirebaseAnalytics turns out many error loggings.

Currently I don't use this library and want to remove it. Unfortunately I can't find any way to disable / remove it out of Pod.

Here is the Podfile configuration

target 'myApp' do
    inhibit_all_warnings!
    use_frameworks!
    pod 'Google/Analytics'
end

Console log:

<FIRAnalytics/DEBUG> Debug mode is on
<FIRAnalytics/INFO> Firebase Analytics v.3200000 started
<FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see 'https://developer.apple.com/library/ios/recipes/xcode_help-scheme_editor/Articles/SchemeRun.html')
<FIRAnalytics/DEBUG> Debug logging enabled
<FIRAnalytics/DEBUG> Firebase Analytics is monitoring the network status
<FIRAnalytics/DEBUG> Uploading data. Host: https://play.googleapis.com/log
<FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
<FIRAnalytics/INFO> Firebase Analytics disabled
...
<FIRAnalytics/DEBUG> Network status has changed. code, status: 2, Connected
<FIRAnalytics/DEBUG> Network status has changed. code, status: 2, Connected
<FIRAnalytics/DEBUG> Received SSL challenge for host. Host: https://play.googleapis.com/log
<FIRAnalytics/DEBUG> Cancelling authentication challenge for host. Host: https://play.googleapis.com/log
<FIRAnalytics/ERROR> Encounter network error. Error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://play.googleapis.com/log, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://play.googleapis.com/log}
...

UPDATE: I also try to add FirebaseAppDelegateProxyEnabled = false in Info.plist but it doesn't work either.

enter image description here

5 Answers 5

34

To disable the collection of data by Firebase Analytics in your app, see the instructions here.

In summary, to disable temporarily, set FIREBASE_ANALYTICS_COLLECTION_ENABLED to NO in the GoogleServices-Info.plist file. To disable permanently, set FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED to YES in the same plist file.

5
  • I implemented this article yesterday and FireBase Analytics is disabled ( show in console log). But the error keep raising infinitive. But it's gone today. So weird.. Btw, you answer help me know more about disabling FA. It works!
    – nahung89
    Commented May 31, 2016 at 2:20
  • 5
    Setting FIREBASE_ANALYTICS_ENABLED to NO in my Info.plist seems to have no effect. I still get <FIRAnalytics/INFO> Firebase Analytics enabled in the console. I must be missing something...
    – pejalo
    Commented Jun 24, 2016 at 19:07
  • 1
    The instructions have now been updated as per this discussion.
    – pejalo
    Commented Jun 29, 2016 at 0:59
  • Please if I disable Firebase will this impact Google Analytics?
    – Ne AS
    Commented Nov 7, 2017 at 22:06
  • 1
    ATTENTION STEVE - it is unclear if you do this in Info.plist, or in GoogleServices-Info.plist. The current documentation states Info.plist. Please clarify!
    – Fattie
    Commented Aug 7, 2018 at 5:56
15

For 2018

For 2018, you Info.plist will have entries like this:

<key>FIREBASE_ANALYTICS_COLLECTION_ENABLED</key>
<string>NO</string>
<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
<string>YES</string>
<key>FirebaseScreenReportingEnabled</key>
<false/>

It seems to be in Info.plist, NOT GoogleServices-Info.plist.

6

I recently ran into a similar issue. I'm using Google Analytics but do not want or need Firebase analytics, which is installed by default if you follow the docs. After searching through the podspecs. I found that the Google/Analytics subspec has a dependency on Google/Core. The core subspec in turn depends on FirebaseAnalytics which is why it is getting installed.

I noticed, however, that the Analytics subspec also depends on the GoogleAnalytics cocoapods.

So I changed my Podfile from:

target 'myApp' do
    inhibit_all_warnings!
    use_frameworks!
    pod 'Google/Analytics'
end

To this:

target 'myApp' do
    inhibit_all_warnings!
    use_frameworks!
    pod 'GoogleAnalytics'
end

As a result, the Google/Analytics.h umbrella header is no longer available, and you need to include the correct headers manually or create your own umbrella header with the following includes:

#import "GAI.h"
#import "GAIDictionaryBuilder.h"
#import "GAIEcommerceFields.h"
#import "GAIEcommerceProduct.h"
#import "GAIEcommerceProductAction.h"
#import "GAIEcommercePromotion.h"
#import "GAIFields.h"
#import "GAILogger.h"
#import "GAITrackedViewController.h"
#import "GAITracker.h"

If you're doing this in a Swift project, you'll need to add these files to your bridging header in place of the umbrella header.

In my opinion, this is a small price to pay to not be forced to install the FirebaseAnalytics cocoapod.

Update

Although Google's docs haven't been updated, their podspec now tells you to use the GoogleAnalytics pod directly

3
  • Perfect solution! This even excludes the Firebase libraries from my build too. Thanks for helping me kill Firebase!
    – Fraser
    Commented Jun 21, 2017 at 3:55
  • Btw I also needed #import <GoogleAnalytics/GAIFields.h>
    – Fraser
    Commented Jun 21, 2017 at 3:56
  • Thanks @Fraser, I updated to include a little more information regarding the headers.
    – allenh
    Commented Jun 21, 2017 at 15:00
1

Those logs are not actually from Firebase Analytics but the Firebase Core SDK (based on the URL that it sent to). Therefore, disabling the Firebase Analytics will not eliminate those logs. I guess there was a problem with the device network that the requests from Firebase SDK were cancelled.

2
  • the Great firewall
    – ruandao
    Commented Jun 22, 2016 at 7:45
  • Ah. So calls to play.googleapis.com come from the Firebase Core SDK library? Commented Jul 11, 2017 at 23:46
1

Set the Android platform to true for Google Analytics

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.