Search code examples
androidgoogle-analyticsfirebasegoogle-analytics-apifirebase-analytics

Google Analytics not generating Configuration file, Firebase clash


Initially, I have included Firebase and it's analytics to my project. It worked well, but after realising Firebase anlytics doesn't have real-time data and other features compared to Google analytics, I wanted to include both. Now, when I try to generate the configuration file to include Google analytics in the app, it redirects me to the Firebase console, where I'm unable to a get a new configuration file.

firebase redirected image

In the Firebase I'm only getting the older version of the configuration file. Can anyone here please guide me to the the updated version?

The problem is with out that I will not be able to generate the xml - global_tracker for google analytics.


Solution

  • Because Firebase is built around Firebase Analytics, it doesn't include the Google Analytics tracking ID in the config file unfortunately!

    The easiest thing to do is just to add the tracker XML manually, then you don't have to worry about the config file at all for Google Analytics. There are a number of things you can put in there, but to recreate the setup by the google-services plugin use:

    File: res/xml/global_tracker.xml

    <?xml version="1.0" encoding="utf-8" ?>
    <resources>
       <string name="ga_trackingId">UA-XXXX-X</string>
    </resources>
    

    Replace UA-XXXX-X with your tracker ID from Admin > Tracking Info in the Google Analytics console.