0

I have a React web app. I set up analytics as described in the documentation here : https://firebase.google.com/docs/analytics/get-started

With the help of the Analytics extension in Chrome, and in my dev environment, I can see the logs in the Debug view section. That means I setup analytics correctly in the app (I believe).

However, if I deploy my app to my https://myapp.web.app domain, nothing logs. I checked the Hosting section, and my app is correctly deployed and it is selected.

I updated my firebase sdk recently (8.7.0), and I added measurementId in the settings, although the doc says it's optional to use measurementId.

Am I missing something ? Is there any way to see if I'm missing something ?

John Doe
  • 1,092
  • 3
  • 12
  • 25

1 Answers1

0

Enabling Google Analytics involves API requests to Firebase Installations Service, to google-analytics.com and to googletagmanager.com`.

I use Firefox, because Chromium sends my computer CPU and RAM consumption to the moon, even with a single tab open. And in Firefox, unlike Chromium and Brave, among other browsers, I had nothing logged in the console.

Chromium and Brave logged API requests errors.

So, you need to add the Firebase Installations Service API key in the cloud console. I feel this could be mentioned in the documentation, because it's not very obvious. Anyway, someone explained it very clearly here : Firebase: 403 PERMISSION_DENIED (FirebaseError: Installations): Requests are blocked, after updating SDKs (FirebaseInstallationsService)

Now Firebase Analytics show logs when using Chromium.

However, these requests are blocked using Firefox and Brave (and therefore no logs are shown in Firebase Analytics). My understanding is it has to do with default settings in the browser.

With Brave, it's GET requests to googletagmanager.com/ that are blocked. With Firefox, it's POST requests to google-analytics.com/ that are blocked. The above mentioned GET request is NOT blocked by Firefox.

https://rankfuse.com/blog/firefox-browser-blocking-google-analytics/

Does anyone know of a workaround ? I understand some Internet users can be annoyed by tracking systems such as GA, but Internet services need such tracking systems to improve their overall user experience, and if Internet browsers block analytics services, we are kind of stuck there.

EDIT: ok, so a bit of research about the above issue of browsers blocking analytics requests I came across various paid services purposely defined as workarounds and various tricks to bypass analytics blocking.

One straightforward way is to obviously proxy requests from your user's browser to google-analytics.com. There is a good article here that explains how to proceed can be found here: https://iainbean.com/posts/2020/the-shady-world-of-google-analytics-proxying/

Blunderchips
  • 534
  • 4
  • 22
John Doe
  • 1,092
  • 3
  • 12
  • 25