Search code examples
firebasegoogle-analyticsgoogle-analytics-firebase

Can I make logEvent support the recommended events as shown in the Firebase dashboard for analytics?


I'm using React.js with JavaScript. In the Firebase dashboard, there is a list of events that are automatically logged and a list of recommended events that can be logged in GA4.

When you click on a recommended event, directions for logging in other languages appear so I'd assume that the event is already built into the dashboard and just waiting for API calls to log and that it would be possible in JavaScript. However, after using this code below, "login" doesn't appear in existing events. I don't think there is a waiting period before the event gets reported because other events are pretty much real time.

firebase.analytics().logEvent("login", {method: 'Phone'});

Should I forget about logEvent and use gtag.js and link the app to a property in GA4 for these events?


Solution

  • The Analytics tab in the Firebase dashboard is connected to a Google Analytics property through a messageID in the configuration document within the application. The Analytics tab is not real-time, however, and it takes a day for it to update. You should use the Realtime tab of the Google Analytics dashboard to verify logged events. The code above is correct for logging events to Analytics through Firebase.