Troubleshooting Firebase + Google Tag Manager events not showing on Google Analytics
By: Daniel Beleza
Tags: Google Analytics, Android, Firebase, Google Tag Manager, Tracking

Photo by Alex King on Unsplash

Tracking with Google Tag Manager

Tracking can be boring, but if we think it right, tracking has a huge role in a company, because it helps to plan and effectively decide the best path for each feature.

Either if your app is an E-commerce, a game, or some day-to-day tool, Google Tag Manager (GTM) has a great tool to track your users' actions.

When I first implemented GTM Enhanced Ecommerce, I read all the documentation and it was fairly good. Until we noticed that sometimes events weren’t triggered, or at least not landing in the right places with the right data.

For all of these reasons and others that will be mentioned below, this article will help you to understand deeply how to make sure every event is triggered and reported consistently in Google Analytics.

Some important notes

The purpose of this article is to go deeper into the GTM + Firebase tool implementation/debugging.

If you haven’t implemented this tool yet, or still have some questions on how to do it, just check my previous article on how to implement “Google Analytics with Tag Manager + Firebase”.

Also…

This article won’t cover every single possible issue. Instead of giving you the fish, I will teach how to fish, i.e., the required steps for you to find the root of the problem. Anyway, let me know if you have faced some problem that I don’t write about in this article!

For last but not least, the Google Analytics account type I’ll be using as an example is Web. The App+Web type at this moment is still in Beta and there are some features that they still don’t support or are still buggy.

Let’s start with one of the most common problem…

“HELP! Can’t see any event on Firebase!”

The first things to take into consideration are the Firebase and GTM warning logs. Most of them are informative and easy to understand.

Now, the first step to debug an event is to…

1. Check if the event is showing in Logcat

First I clicked on an item and showed a toast message (showed even if the event isn’t successfully triggered).

Click event triggered

Then this was logged:

// Screen view event (automatic)

D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-8045236258096811757}] // Click event

D/FA: Logging event (FE): select_content, Bundle[{item_name=Product 2, ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-8045236258096811757, price=29.0, item_id=1}]

Note: You can quickly find all these events by adding “D/FA” to the Logcat keyword filter.

If the event isn’t logged, then look for any debug/warning logs from Firebase.

If there is some warning, firebase might not even trigger the event. In case of error, it won’t even be triggered at all.

Firebase has a table with all these errors in their official documentation.

→ If you can see these logs, let’s move to the next step and…

2. Check Firebase DebugView tool

Firebase events are batched together and take approximately 1 hour to be reported according to Firebase documentation. From my experience, it can be up to 6h or more.

If we are testing some new events or debugging old ones, this might take a while. For that reason, Firebase created this tool called DebugView.

In DebugView you will be able to see your events in realtime, with a delay of just a few couple of seconds.

This tool is under the Analytics section in Firebase console, as you can see below.

DebugView tool screen selected

Basically, you enable Analytics Debug in your Android device/emulator by executing the following command:

adb shell setprop debug.firebase.analytics.app package_name

→ In my case, my package name will be com.danielbeleza.diagonalee.

You should be able to see your device on the top left corner dropdown.

Now when I click on an item from the list, I will be able to see some events in the timeline.