React.js with Google Analytics Web + App
Our goal
We want to use Google Analytics in our React.js project. In addition, this is a Firebase project using App + Web properties in its Google Analytics setting. Here is a step by step Guide.
Warning
Google Analyticsโ App + Web properties are still in beta version when this article is written. I am highly skeptical about the reason why Firebase recommends using them as these properties are not currently supported in the Analytics app. Which means we cannot set up our customized events and track them in GA unless using BigQuery as this article mentioned. But yes, the events automatically collected by GA will still be shown in its dashboard.
This article will cover:
- Set up A + W config to show default events in GA
- Send A + W customized events in GTM and show them in GAโs debug view
Set up A + W config
As our project uses App + Web properties, we have a measurement id G-xxxxxxxx
instead of a tracking idUA-xxxxxx-x
(the difference is explained here) In order to link Google Analytics to our project, here are two approaches: