I used Google Analytics a lot for many sites...
I'm just releasing a first app with Firebase (Firestore + Firebase SDK with reactjs).
Then, I activated GA from my Firebase dashboard... but I cannot see any activity !
I probably need not to add plugin like "autotrack" ?
import 'autotrack';
ga('create', 'UA-XXXXX-Y', 'auto');
It's not clear because, it's impossible to find out the track ID (UA-XXXXX-Y) from my dashboard !
Do I really need it ? Where can I find it ?
To add Firebase Analytics to our React app, we will use ga-4-react package. This package can be used to include Google Analytics tracking code in a website or app that uses React for its front-end codebase. This goes without saying but of course, we’ll need a react app to get started.
Step 1: Assuming you have your React Native App up and running, open your terminal, redirect to your project directory, and run the following command to add RNFirebase to your project: Step 2: Go to console.firebase.google.com and create your Firebase Project.
Measure performance, and so much more, of your React App with Firebase Analytics. Data is everywhere. Being able to see how your website, or app, is doing in real-time is a blessing.
Just add the Firebase SDK to your new or existing app, and data collection begins automatically. You can view analytics data in the Firebase console within hours. Log custom data. You can use Analytics to log custom events that make sense for your app, like E-Commerce purchases or achievements.
I did't correctly initialized Analytics... With firebase it's not a track ID but a measurementId
import app from 'firebase/app';
import 'firebase/analytics';
app.initializeApp({
//other config
measurementId : process.env.REACT_APP_MEASUREMENT_ID,
appId : process.env.REACT_APP_DEV_ID
})
//put inside your constructor
app.analytics()
This will solve the following error:
Error: firebase__WEBPACK_IMPORTED_MODULE_8___default.a.analytics is not a function react
Documentation : https://firebase.google.com/docs/analytics/get-started?platform=web
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With