Reputation: 31485
Firebase Analytics is just a wrapper for the Google Analytics to be easily connected to a Firebase app, right?
I have a Firebase web app that I've built using React (it's a single page app).
I've followed the Get Started guide on https://firebase.google.com/docs/analytics/get-started#add_the_sdk_to_your_app
and I've added Analytics to my Firebase app. I didn't have any analytics service before that.
What Google Analytics documentation should I refer to now?
Because I can see that calling firebase.analytics()
logs some events that are not mentioned in Firebase documentation. For example: page_view
.
We can see that the gtag.js
mentions that it auto logs the page view event, and this is not mentioned in Firebase Analytics doc.
From https://developers.google.com/analytics/devguides/collection/gtagjs/pages?hl=en
QUESTION
Basically I would like to know exactly what happens when I call firebase.analytics()
and what documentation should I refer to, in order to understand what is going on. Is it a wrapper to the gtag.js
analytics?
Because I can already see some page_view
events being logged, and they're not mentioned in the Firebase Analytics documentation.
In the link below you can see some events that Firebase Analytics mentions that it auto logs, but they are basically events for mobile apps, and none of them is the page_view
event, which I can see already logged in my Google Analytics console.
https://support.google.com/firebase/answer/6317485
Upvotes: 3
Views: 1235
Reputation: 599716
The Firebase SDK for JavaScript Analytics is a wrapper around Google Analytics' gtag.js library, which handles some initialization, logs additional/default events, and adds Firebase-specific functions such as setCurrentScreen
and setUserId
.
The page_view
event is actually logged by gtag.js already, so unrelated to the Firebase SDK.
If you are interested in learning precisely what the Firebase SDK for Analytics does, I recommend browsing its source code on Github.
Update: In searching through the repository myself, I don't see any additional events being logged, so I might be wrong about that at the moment.
But for example the AngularFire2 library now integrates with the Firebase SDK for Analytics, and uses that to automatically log events about the screens being viewed, and the current user of the app. For more on this, see Monitor usage of your application in production in the AngularFire2 docs.
Upvotes: 3