Getting Started with Firebase Analytics for Apps


Getting Started With Firebase Analytics for Mobile Apps

Firebase Analytics is an analytics tool specifically designed for apps. It is part of the larger Firebase SDK, a mobile development platform that helps you use Google services when building iOS and Android apps. There are a variety of other tools built into the Firebase SDK, but for our purposes we are only focused on utilizing Firebase Analytics.

This post aims to provide the stepping stones for getting up and running with Firebase Analytics for your mobile app, as well as sending the information to your Google Analytics mobile app property.


Firebase Analytics

What does it cost to use Firebase? According to the documentation, there is no charge for using Firebase to collect events about user activity on your apps. There are no limits or tiers for the amount of data collected – there is only a limit to the number of types of events you collect (the names given to the events you are tracking). You can have up to 500 different event types or names, which should be plenty in most cases.

Note: Firebase data is oriented around events instead of screenviews – you will essentially be logging events into Firebase with optional parameters containing additional information about the action that occurred. This is different than the traditional form of app tracking with Google Analytics where data is screenview-oriented and your reports look very similar to a standard web Google Analytics property (which is pageview-oriented). However, you can use Firebase and GTM in tandem to get both – we’ll walk through how to do that in this post as well.

Google Tag Manager

Firebase hooks into the Google Tag Manager (GTM) dataLayer, making integration with Google Analytics very straightforward. When events are logged to Firebase (as instructed later in this post), GTM can be used to collect and send that data to Google Analytics as well, which will make it possible to provide roll-up reporting with website data for a bigger picture of how users are engaging with all of your digital properties.

Note – These instructions are geared towards fully native apps. If your app is a hybrid app (such as a PhoneGap app), you may need to customize your implementation.

Summary of Steps

Here we’ll focus on the basic steps to getting set up and logging Firebase events, as well as tracking those same events with Google Analytics screenview and event tracking. Firebase offers a variety of additional features and functionality that could not be fit into this one blog post, but there are many links to Google’s documentation throughout if you want to learn more as well.

The general steps we will walk through include:

  1. Set up Firebase Account
  2. Install Firebase SDK
  3. Install GTM SDK
  4. Log Firebase Events
  5. Bonus: Send Screenviews and Events to Google Analytics

Firebase Account Setup

Follow the steps below to set up a new Firebase account for your Android and/or iOS app.

If you have both an Android and an iOS version of your app, you can either set them up with separate Firebase accounts or set them up within the same Firebase account. If you want to set them up within the same Firebase account, you’ll need to set up one first and then add the second within the Project Settings. This will allow you to toggle back and forth between data for the Android and iOS apps, for example (the data will not be combined).


Getting Started

Have your package name ready for your Android app and/or your Bundle ID ready for your iOS app (ask your developers for this).

Go to and create a new project.


Once you’ve created a new project, you’ll see the overview screen. Down the left-hand side you will see many of the Firebase features, such as Crash Reporting and Analytics. We’re going to be working with Firebase Analytics.


In the center of the screen you’ll see options to Add Firebase to your iOS app, Add Firebase to your Android app and Add Firebase to your web app. Click on the appropriate option for your app (disregard the web app option for now), you will be prompted to enter your app’s package name (Android) or Bundle ID (iOS).


Get the Config File(s)

Once you have provided your Bundle ID or Package Name you will be given a config file along with instructions on where to place it in your app. You will also be provided with steps to installing the config file and installing dependencies for your Android or iOS app. Follow each of the steps as instructed.

Examples for both Objective-C and Swift are provided for iOS.

Go to Analytics from the left-hand navigation and you will see a variety of reports are available, including a Dashboard, Events, Audiences, and more:


There are other data points that Firebase can collect (such as user properties), but we’ll save those for a later post. Today we’re only concerned with logging Firebase events and setting up basic screenview and event tracking for Google Analytics. Check out this handy resource to learn more about the Firebase Analytics reporting interface.

While You’re At It – Take It A Step Further

While we’re setting up Firebase, there are a few other tools that we can use in tandem. Consider the differences between the tools and how much effort is required to track into multiple tools. In some cases, it’s not much effort at all!

Google Analytics

This one we’ll cover in this post – set up a Mobile Google Analytics property and use GTM to piggyback off the Firebase events in order to send screenviews and events to Google Analytics as you would with analytics tracking on a website using GTM. This is a helpful approach if you’re just getting warmed up to the Firebase reporting style and you want to have your more familiar Google Analytics-style reports available to refer back to as you make the transition to Firebase.

Make sure you select the Google Analytics Services SDK option, not the Firebase option (more on the Firebase option at the very end of this post):


This is NOT mandatory, but often we will recommend doing this in addition to using Firebase Analytics because you reap the benefits of having more familiar reports in Google Analytics. It can be a very handy approach if you’re interested in using Firebase but are more comfortable with the reporting options in Google Analytics or need a feature in the Google Analytics interface that does not yet exist in Firebase. Ideally though, the goal is to rely solely on Firebase Analytics, not both, as the data will not always line up 1:1. See this post for more information about the reporting differences.

Google’s documentation actually lays out a few good points you can use to decide whether you want to use Firebase Analytics, Google Analytics or both. Some best practices are also provided for deciding how to segment the data into different properties in Google Analytics as well.

For the purposes of exploring the options and the reporting differences, we’re going to assume you are interested in configuring both Firebase Analytics and tracking screenviews and events in Google Analytics and that you have a mobile Google Analytics property ready.


For another day – BigQuery Integration! Enough said, right? Well, except a quick note on billing: you will have to enable a billing account for Firebase (since BQ is a paid tool) and choose the “Blaze” (pay-as-you-go) plan. If you’re not using the Firebase features other than Analytics (other features like Realtime Database, File Storage, etc.) you shouldn’t have any charges aside from BigQuery storage and query processing.β€―In the Firebase project, select the gear icon in the left nav, Project Settings. Then go to the Account Linking tab and choose BigQuery.

Install Firebase SDK

You will need to refer to the documentation for installing the Firebase SDK on your app:

Note that at the bottom of both sets of instructions there are additional services you can enable, such as crash reporting. Enable that and any other service relevant to your app.

Install GTM SDK

As I mentioned earlier, we’re going to use GTM for collecting Firebase events and sending them to our mobile Google Analytics property in order to enable a new suite of reports that we otherwise would not get with Firebase alone.

First we need to make sure we have a GTM container to add to our app. Go to and create a new container for your app(s). Select the appropriate operating system and choose a Firebase container:


Once you do this, you will immediately be provided with a link to instructions on installing the GTM SDK for your app:

If you peek ahead in those instructions, you’ll see some examples for logging events. You’ll also see this important note:

Google Tag Manager uses Firebase Analytics’ events, parameters, and user properties to trigger and build tags you’ve configured in the Google Tag Manager web interface. In this sense, your Firebase Analytics implementation acts as your data layer.

This is a key point referring to how GTM and Firebase work together. In fact, you could completely ignore the Firebase Analytics reports altogether and simply use the platform to log events to the “data layer” for GTM, ultimately using GTM to send data to Google Analytics if you prefer the screenview-oriented reports.

Log Firebase Events

You should have a strategy in place for how the data is going to look before you request it from your developers. If you want to capture screenviews, you’re likely going to want to see the screen name of the screen that was viewed, for example. It may be helpful to create a spreadsheet to organize all of the actions you want to track and the details you want to collect about those actions.

The two documents I linked to last show some examples of how you would log events. For example, the Android documentation shows example code that looks like this:

In this example, share_image is the name of the custom event, and the image_name and full_text are additional pieces of information that are provided as parameters.

If you’re not sure how to label your events, check out Google’s list of suggested events.

Better yet, there are certain events that are automatically logged to Firebase for you (but not to Google Analytics), such as first_open. We won’t go into detail on those, but if you’re interested you can check out the documentation for those.

For additional information on logging events, there is more thorough documentation for that:

Ok, so once those new custom events are logged to Firebase from within your app, you will begin to see them in your Firebase Analytics account (typically within a few hours, but it can take longer). They will appear in the Events tab along with the events that are automatically logged for you:


You will not need to configure tags in GTM in order to see the Firebase events that you are logging.

You will need to set up tags in GTM to pass this data along to Google Analytics as traditional screenview and event tracking, however.

Send Screenviews and Events to Google Analytics

As I said, events that are logged to Firebase will appear in Firebase Analytics reports – you will not need to configure tags in GTM to see them there. However, if you want to also send that data to Google Analytics, you will need to capture it with variables and set up Google Analytics tags.

Google Analytics Screenview Tracking

Here’s an example of how an event might be logged in an Android app for a screenview:

In GTM – we can take this information, break it apart into pieces, and then use that to send information to Google Analytics. Let’s start from the bottom up – Variable, Trigger, then Tag.

Use an event parameter variable to pull in the screen name from the Firebase event being logged from your app:


Then create a trigger that listens for Firebase events called “screenview:”


Lastly, you’ll need to create a Google Analytics tag for your screenview. We can set the tracking ID to your new Google Analytics mobile app property.


You’ve just created your first screenview tag using Firebase and GTM! Once the GTM container is published, screenview hits will be collected in the mobile app Google Analytics property:


Google Analytics Event Tracking

So now that we have our screenviews tracked, let’s set up some event tracking. Let’s use an iOS example this time, written in Swift, of an event that might be logged when a user performs a search on the app:

This example comes from Google’s list of suggested events mentioned earlier.

To capture this with Google Analytics event tracking, we’ll again start from the bottom and work our way to a Tag.

We can reuse that same event parameter variable created earlier to pull in the screen name from the Firebase event being logged from within the app:


Create another event parameter variable to pull in the search term for the event action:


Then create a trigger that listens for Firebase events called “search:”


Finally, set up a new Google Analytics tag:


Again, set the tracking id to the Google Analytics mobile app property.

Once you publish GTM with these updates, event tracking data will appear in the mobile app Google Analytics Event reports:



Now that you’ve set up these tags, you’re probably wondering how to test them. Testing Firebase and Google Analytics on a mobile app can be especially challenging, and is certainly worthy of its own blog post. Some of the most common tools for debugging include:

  • Charles Proxy, Fiddler, WireShark or similar network request sniffing tool – You can configure these to listen to the network requests sent out from your app, check the parameters that are provided for accuracy, etc.
  • Android Studio console – Log console events in Android Studio while testing configurations with an Android emulator.
  • Xcode debug console – Same idea as the Android Studio console, but for iOS.
  • DebugView in Firebase – you have to do a little extra work to configure this, but it will allow you to send debug hits and see them in the same Firebase Console Project that you have set up for your app. In the Analytics section, hover over StreamView to get the DebugView drop down to appear and check it out.
  • Google Analytics Real Time Reports – While app hits can take a few minutes little longer to appear in Real Time reports, they should appear there while you’re testing.


I hope this is a clear yet useful guide to getting up and running with Firebase Analytics. There are plenty of other Firebase features we could talk about in future posts. If you’re curious, check out Jimmy’s review of Noteworthy Features of Firebase Analytics.

Keep in mind that if you have a hybrid app (using web components and native components), you may need a MUCH more complex solution. If you’re not sure whether your app is fully native or a hybrid, talk with your developers before getting started with setting up Firebase.

Note that you can also set up a new Firebase Google Analytics property and link it to your new Firebase account in order to bring those same Firebase reports into Google Analytics:


This means you can see your Firebase reports in the Google Analytics interface rather than having to switch to Firebase to see your app data. I kept this piece of information out of the original list of Additional Opportunities in order to prevent confusion throughout the setup instructions – this is not as useful as setting up a mobile app Google Analytics property, in my opinion.

Amanda Schroeder is a Senior Consultant and comes from the marketing industry where she found a need for accurate, insightful data that could aid in making results-driven decisions. Amanda’s passion for building solid measurement strategies and connecting all the pieces of integrated digital and traditional marketing campaigns has led her to her current role at LunaMetrics.

  • Steve Guberman

    GREAT POST!!! Thanks for sharing all this amazing information.

    • Amanda

      Thanks Steve, glad you found it useful!

  • spiros skaliotis

    How i can use firebase to make my application better?

  • Patricia

    Thanks for the great post! Very helpful!
    If I understood correctly, this means that you need to make one GTM tag per event tracked in Firebase?

    • Patricia

      What about the events tracked automatically by Firebase? Do we also need to make individual GTM tags for each of those, so that we can see them in GA?

      And the automatic user properties? ( Do they also need to be GTM variables?

      • Amanda

        Hi Patricia,

        Yes, you need to set up Universal Analytics tags if you want to see the data in Google Analytics.

        The events that are tracked automatically for Firebase are not tracked automatically in Google Analytics – you will need to set up Universal Analytics tags in GTM for those as well.

        The user properties will need to be added as variables in GTM if you want to attach them to Universal Analytics tags to get that data into Google Analytics.


        • Patricia

          Thanks Amanda! πŸ™‚

          • Amanda

            Sure thing!

  • Guio

    That’s a great step-by-step post, thanks a lot Amanda!
    I’m working in a project that are developing a hybrid mobile app, where can we find more information about how customize firebase implementation?
    I love the idea of firebase work as a datalayer for GTM; so, an hybrid app won’t make any difference in setting up GTM and tags, right?

    • Amanda

      Hi Guio,

      Unfortunately, I have not found any resources or documentation on customizing Firebase for hybrid apps. I think we should write a blog post about that topic because it is fairly complex and there are a few different ways to handle it, but until then here are a few things to consider:

      Will the hits / tracking be handled entirely on the native app side? For instance, sometimes hybrid apps are configured in a way where activity in the web-driven parts of the app is actually passed to the native side, where Firebase is then used to track it.

      However, if there are various parts of the app that are web-driven that will be tracked within webviews, for example, that will likely need to be tracked separately because Firebase cannot be used there. If you are dealing with this scenario, you will likely need a standard web GTM container on the web-driven parts of the app. This means you will end up with two GTM containers – one Firebase GTM container for the native app side of things and one standard web GTM container for the web driven side of the app.

      Talk with your developers and see which path they are considering. As I said, this topic really deserves its own blog post…. Perhaps that will be my follow-up topic πŸ™‚ I hope this gives you an idea of the complexity here.


  • Alex Paul

    Hey Amanda,

    thank you very much for this great Post.

    I still have a few questions and would be very thankful for your answers:

    – Do UTM-Parameters in GA still work with this kind of setup and are there any things to consider when tracking campaigns with this setup? I started to implement this tutorial for my new app but am still not sure if i will see campaign data in my analytics property.

    – Does this implementation method have any other disadvantages (like data missing in Google Analytics etc.)

    – Is it possible to use Google Analytics and Firebase Analytics together, leaving out GTM?

    Thank you very much πŸ™‚


    • Amanda

      Hi Alex,

      We are testing campaign tracking with this approach, it is just a little difficult as we do not have an app in the iOS/Android app stores. There is a setting in Google Analytics tags in GTM (for a Firebase app container) that is basically a checkbox to “Enable Advertising ID Features” – I believe this is the setting you need to apply in order for campaign tracking to work properly. Again, we’re still testing this – I will follow up in the future if we find out otherwise (campaign tracking for apps could probably be its own blog post…).

      Regarding potential drawbacks to this method of app tracking, we have found that there can be a steep learning curve to app analytics tracking and this approach can make it a little steeper (especially when dealing with hybrid apps) compared to simply installing GTM + GA.

      Perhaps the largest drawbacks we’ve discovered is that it does not support ecommerce tracking and Firebase Analytics is extremely strict regarding event names logged – once you log one event name with whatever parameters, every single additional event that is logged with the same name has to have the exact same parameters associated with it as well or else they will be thrown out and will not appear in Firebase Analytics reports.

      There are character limitations for event names and parameters in Firebase as well – event names can be up to 40 characters long and parameter values can be up to 100 characters. That limitation does not impact how much data can be passed along to Google Analytics though – it only impacts how much data is shown inside of Firebase Analytics reports.

      It is not possible to use Google Analytics and Firebase without GTM. Firebase essentially operates hand-in-hand with GTM.

      You do not need to install the Google Analytics SDK because you will be firing Google Analytics tracking via GTM (similar to how you would fire Google Analytics tags inside GTM on a website without placing any on-page Google Analytics tracking code).

      Let me know if I answered all of your questions.


      • Alex Paul

        Hey Amanda,

        thank you very very much for your extra-detailed answer! All things that you answered confirmed my assumptions and this saved me a lot of testing time. I owe you a coffee πŸ™‚



        • Amanda

          Glad it was helpful!

          Note that my comment regarding the strictness of the event names does not impact what you can send to Google Analytics – just what will appear in Firebase Analytics. Just wanted to make sure that was also clear.

          • Alex Paul

            Hey Amanda πŸ™‚

            did you have some trouble transferring parameters to custom dimensions? The same GTM variable which i used for the screenview field doesnt get sent when i use it as a custom dimension value. I dont know if this could have something to do with your statement about parameter strictness. Did you mean by that, that the parameter keys should remain the same for every following event after the first log? Because i cant avoid to make the values of the parameter keys dynamic but sending the same param. keys is ok because i can just give empty or unavailable key-values a string like “none”.

            Thanks in advance for your help!


          • Amanda

            Hi Alex,

            Nope – I didn’t have any trouble using parameter values as custom dimensions. When I mentioned the strict nature of event logging I was particularly referring to how the data appears inside Firebase – that does not impact what you can send to Google Analytics though.

            Are you sure your screen name was being set? Perhaps the variable was not working in either the screen name field and the dimension slot in your tag… Or you may need to configure the custom dimension slot in Google Analytics at the property level?

          • Alex Paul

            Hey Amanda!

            thanks very much again :)) I found that my setup was correct, the custom dimension data just appeared now (very strange, retroactively for the last days). And i am very sure that it wasnt available before because i checked it in many ways like API, BigQuery, GA itself…

            However, thanks very much I owe you a second coffee

            Best regards from Zurich


          • Amanda

            Ah, glad to hear it is working for you!

      • Laurens Aertssen

        Hi Amanda,

        Thanks a lot for the great post. Do you now have more clarity about utm campaign tracking for apps? Will the “Enable Advertising ID Features” option solve this?

        We want to use the url builder to track sources of installations:

        Thank you!

        • Amanda

          Hi Laurens,

          Based on some initial testing, “Enable Advertising ID Features” is not the only step required when utilizing Firebase + GTM.

          I am also looking into the document that you linked to (though we still do not have an app on the app store, so testing has been a challenge). It does seem as though the updates outlined in that document are needed, even though the GA SDK is not actually installed in the approach taken in this blog post (GA tracking is configured via GTM). If this is the case, it will mean that the Firebase SDK, GTM SDK and GA SDK are all required – which is not ideal! Still looking for some confirmation though – hope to have an answer soon.


          • Laurens Aertssen

            Hi Amanda,

            Thanks for the answer. So let’s assume that the GA SDK is indeed needed in order to track campaign parameters.
            We could then add the GA SDK only for this scenario and still do the rest of tracking via GTM and Firebase. Also we would sent the data into the same property.
            But will this data be attributed correctly to the same client-id? Or will we have issues because of that?

            Thank you in advance,

          • Amanda

            Hi Laurens, I have an update here (finally) – but first, some clarity. My earlier idea was simply to utilize the Broadcast Receiver built in with the GA SDK. I did not mean that you should send GA hits from the GA SDK to the same property that you’re sending hits to via GTM.

            Second, I don’t believe using the GA SDK for the Broadcast Receiver is the solution. There is a possibility that you could use Dynamic Links for Firebase for install tracking. I am testing this myself, as I mentioned above, but this would be for Android specifically. For iOS apps, the only hope for install tracking is to use the “supported ad networks.”

          • Thomas Ruffie

            Hey Amanda.
            Great article!
            Have you had any updates on campaigns? I’m in the same boat where I’m using Firebase for analytics (and crash reporting ).
            I’ve now been asked to make sure the campaigns were tracked properly, and documentation is very blurry on this part. I’m not quite sure what is required.
            Another issue is that we need to track Facebook campaigns too, which I’ve been told are notorious for not working like the other campaigns.
            Any ideas on these issues?

          • Amanda

            Hi Thomas,

            This is still murky water right now, though I believe we are going to have to start using the Firebase Dynamic Links feature to track campaigns – check it out here:


            It does require additional dependencies, though hopefully this will work without requiring installation of the GA SDK, as the older methods of campaign tracking did. As we at LunaMetrics do not have an app on the app store, we are working through other methods of testing this – so I cannot yet say for certain that this is the solution just yet. It seems the most promising though.

            I am not personally familiar with Facebook campaigns but I will suggest that topic if one of my colleagues is.

            Best of luck,

          • Amanda

            Hi Thomas,

            At this time, it seems as though only “supported ad networks” are going to pass campaign information to Firebase. There are about 50 “supported networks” but Facebook is unfortunately not one of them.

            The challenge is that some of these third party apps do not pass the device ID (and you cannot access the device ID from a mobile browser either, so even if you were driving traffic to your app from, for example, it wouldn’t work for you).

            There is a feature called Dynamic Links that I am testing out which may help with this issue for Android campaigns, specifically. Verdict is out at this time though as it doesn’t seem to work as intended – the campaign parameters are not being passed in my tests.

  • Terry

    Hey Amanda,

    I tried to follow your post to setup both Firebase and Google analytics for my iOS app. But I only got my event showing up in the Firebase analytics but not Google analytics. Any reason for it or what went wrong?

    • Amanda

      Hi Terry,

      Did you create tags in Google Tag Manager to collect the events logged and pass them to Google Analytics? Did you follow the steps to create the appropriate parameters and triggers?

      If so, do you have any filters in Google Analytics that would be preventing the data from appearing, such as an include filter that looks for non-app traffic only?

  • Nayan Srivastava

    Hi Amanda, Great post. One quick question, I have done the setup but events and screen-views are showing up only on Google Analytics not on Firebase. Do I need to create tags for Firebase Analytics too if using with GTM?

    • Amanda

      Hello Nayan,

      You do not need to create tags for Firebase Analytics. You only need to create tags for Google Analytics – the Firebase events should be logged in Firebase Analytics automatically.

      Are you testing via Android Studio? One challenge I discovered is that Android Studio’s Instant Run feature is not compatible with Firebase Analytics. The result was that I had data in Google Analytics but nothing appeared in Firebase Analytics. I had to disable Instant Run in Android Studio to get the events to appear in Firebase Analtyics.


    Valuable comments . Coincidentally , if anyone has been searching for a GA MV-18J , my kids filled out and faxed a sample version here

  • This is by far the best post that’s explaining firebase analytics on the internet. Kudos to that. I’ll get to setting up the firebase analytics for my app. I will ping you for questions if I get stuck anywhere. And once again, thanks a lot @disqus_YLYD4L73lN:disqus. You rock πŸ˜€

    • Amanda

      Thanks Anant, glad you found it useful!

  • Alex Barrios Escobar

    After a long time looking for a post that explains this properly, i feel like i finally found it.
    Hopefully i follow all the steps correctly and it works (i might ask a few questions though!) πŸ™‚

    • Amanda

      Good luck!

  • Laurens Aertssen

    Hi Amanda, thanks again for the great post. I have an additional question; suppose you have an app that is available in multiple languages. How would you get this information in Google Analytics? I suppose that the standard google analytics measurement will grab a language from the device settings, but that might not be the same as the language used in the app. Any idea?

    • Amanda

      Hello Laurens,

      I would recommend that you capture the language setting that the user selected in the app as a custom parameter and then store it in a custom dimension in Google Analytics.

      Just as we used custom parameters in our event tracking examples above, you could set one for the known language in the app and pass that along to Google Analytics via a custom dimension on your Google Analytics tags in GTM.

  • Ajith Memana

    Hi Amanda,

    I tried the same steps as you have mentioned for tracking Screenviews on Android. My events are logged on to Firebase console. But not on Google analytics console. I have configured Google tag manager variable, tag and trigger. Where could i have gone wrong? Am i missing something?

    • Amanda

      Hello Ajith,

      Did you install the GTM SDK as well? Did you configure your Google Analytics tags in GTM to look for the appropriate parameters?

      • Ajith Memana

        Yes. I have debugged the GTM events and it seems that the communication with GTM is working properly. Yesterday, i logged into my Google analytics account and found some analytics events logged in it. But when i checked it at the the time events were triggered, it was not there. Seems like the updates to GA are not live and is taking some time to appear. Is this quite usual?

        • Amanda

          Yes, this is normal/expected. The hits may have been batched and not sent from the app immediately, which would be why you weren’t seeing them in Real Time reports at the time you were testing. As long as you do see the data in GA now, you should be good.

          • Ajith Memana

            I have enabled debug mode and my events are logged into Firebase analytics instantly. I am able to see the events live on my Firebase console, but not on Google analytics.

  • sachit

    Hi Amanda, How can we capture “first_open” events from FA? Is there any specific method to do so?

    • Amanda

      Hello, as far as I know, there is a built-in trigger in the iOS version of the Firebase GTM containers that you can use to recognize “first_open” events. You could build an event tracking tag to send this data to Google Analytics. I do not see the same trigger within Android Firebase GTM containers though, and I’m not sure why it wouldn’t exist there (hopefully it is a work in progress).

  • Dan Grainger

    Hey Amanda,

    Just getting up to speed with Firebase and noticed your coding for tracking screen views/ name in Android. Can you suggest the equivalent for iOS? I’m essentially just looking to pass a screenName and screenType (i.e. categorisation of screenName) value on screen view. Have checked the Firebase docs and it seems to suggest:

    class func setScreenName(_ screenName: String?, screenClass screenClassOverride: String?)

    …but I’d like to be sure!

    Similarly, any iOS example for setting userID post-login very welcome (including whether it’s required on every screen view or when it persists until).


    • Amanda

      Hi Dan,

      Unfortunately I am not very iOS-fluent yet – are you using Objective-C? The Firebase docs are publicly available and can be found here for iOS:

      Based on an example there, I would imagine something like this:

      Analytics.logEvent(“screenview”, parameters: [
      “screenname”: name as NSObject

      Note that screenview tracking has become an automated event for Firebase with a recent release of the SDK – you might want to see if you can utilize that if you are not already.

      Regarding the user id, are you trying to send this to Google Analytics or set a User Property in Firebase? If you are trying to set that in Google Analytics, you would update your Google Analytics tags with the ‘userId’ field to set setting. You will need to send this to Google Analytics on each additional screenview as well if you want those to have the user id associated with them.

      Below is a link to a Google doc that explains this concept a little more and it shows that the user id value will not persist for you. The numbered boxes in the diagram represent individual sessions; and you can see that when the box/session is colored blue, that’s when the user id was included in hits in that session –

      Session unification can cause the user id to be associated with hits in the session where the user id was eventually set, but it cannot work on hits after it was initially set, if that makes sense.

  • Ramamohanreddy kasireddy

    Thanks @Amanda . Great post.

  • Tony Hann

    Hi Amanda,

    As of now (Sep 2017) we cannot select Google Analytics Services SDK over Firebase Analytics as the tracking method option when creating a new mobile app Google Analytics property. It defaults to Firebase… therefore we only get the duplicated Firebase reports in GA :

    Thoughts? / can anyone else confirm this.

    • Tony Hann

      So there’s a work around to still getting the regular Google Analytics reports! When setting up the new Google Analytics property choose Website instead of Web app…

      To set up app reporting using the Google Analytics Services SDK for iOS and Android, complete the following steps. Note that the Firebase SDK is the recommended tracking solution for Google Analytics.

      1.Sign in to your Google Analytics account.
      2.Click Admin.
      3.In the PROPERTY column, select Create new property from the dropdown menu.
      4.Select Website.
      5.Provide a Website Name. You may use the name of your app.
      6.Provide a Website URL. You may use your company URL or the URL for your app’s marketing site.
      7.Click Get Tracking ID.
      8.In the VIEW column, select Create new view from the dropdown menu.
      9.Select Mobile app.
      10.Provide a Reporting View Name.
      11.Click Create View.

      This will provide you with a tracking ID which you can use in GTM to push the event data.

      • Amanda

        You are correct, this is the work-around.

  • Marcela Llerena

    Hi Amanda
    How can I use custom tags (tags without templates) with Firebase+GTM?, for example I want to add Adobe Analytics. Is that possible?

    • Amanda

      Hi Marcela,

      With Firebase GTM containers, your options in terms of configuring third-party (non-Google product) tools is limited. There are built-in tag templates for other app analytics tools like AppsFlyer, for instance, but not much else. I can think of a couple options for you, though I have very little experience with Adobe, so bare with me – I’m not positive that the options are applicable. My initial thought is that you would be better off installing the Adobe SDK, if there is one.

      There are Custom Image tags which you may be able to use if you have an image pixel implementation option for Adobe.

      Then there is the Function Call tag, which allows you to trigger a function that exists within your app. So in theory, if there is an HTTP-request style implementation (like the Google Analytics measurement protocol) for Adobe, you could potentially configure a function for that in your app and use a Function Call tag in GTM to trigger that. Perhaps this would allow you to have more flexibility and control over when those tags fire, compared to hard-coding everything, but again I’m not positive about this as I have not worked with Adobe personally.

      I hope this was at least somewhat helpful!

  • Rowrow

    Hello Amanda,

    Not sure if this was asked to you before or if this is still in scope but since you mentioned something about troubleshooting, I’m gonna ask anyway. Hope you dont mind. πŸ™‚

    So I’ve learned that you can now hook Firebase to GTM to collect and send that data to Google Analytics. I tried to use Charles to track the hits sent to GA. And although I am seeing those hits to GA, I noticed that gtm container ID is not included in the hits (no gtm parameter in the request). Is this expected or does having no gtm parameter in the request means the hit did not come from GTM?

    Hope I explained my question well.

    Looking forward to your thoughts on this. Thanks a lot and more power to you.


    • Amanda


      You can enable the built-in variables for GTM container ID and version, and then attach them to your GA tags as a custom dimension, for example.

      There should also be a parameter associated with all Firebase events that are being logged in your app that tells you whether the event was an auto-event emitted by the Firebase SDK or a GTM-configured one. I think the parameter is called ‘firebase_event_origin’ and it will have the value of ‘app+gtm’ if GTM was involved.

      You can also link your Firebase data to BigQuery for more insight around this.

      • Rowrow

        i’ll try this. i’ll share in case it worked. thank you so much! πŸ™‚ really appreciate your help!

  • Hi, Amanda,

    I’m using Firebase, Google Tag Manager and Google Analytics exactly as your instructions. In Firebase, the Attribution panel have the source/medium of my goals. However, I can’t found these informations in Google Analytics.

    Did I make an error in any step?


    • Amanda

      Firebase captures campaign details differently than Google Analytics does, and that data is not automatically attached to your Google Analytics hits. We are working on another post about attribution with Firebase. Stay tuned!

  • Marius Gold

    Hi Amanda, Do you see a huge descrepancy between Firebase and Google Analytics numbers ? For an app in production, we have about 20% to 30% of differences between the two Analytics platforms…

  • Dmitry Klymenko

    Thanks Amanda. Really useful.
    Is there a way to read GA Client ID using this SDK v5?

  • Guib

    Hi Amanda. Thanks for this great article! Events are usually associated with screen views in the Google Measurement Protocol. Is it possible to do that with Firebase + GTM? Your article is not clear about this. Kind regards, G

    • Amanda

      I believe you need to specify the screen name on all hits.

  • Armaan Gill

    Hi Amanda, great post.
    Under the section about sending events to GA, I’m sending custom events (not automatically logged by Firebase) to GA via GTM in this format:

    Analytics.logEvent (“testevent”, parameters: [
    variable 1:value;
    ] )

    I don’t see this event being sent to GA. Am i doing anything wrong here? I would really appreciate your feedback.

Contact Us.

Follow Us



We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187