I tried to do it this way (On the main page):
import analytics from '@react-native-firebase/analytics'
const trackPageView = (title) => {
analytics().logEvent('page_view', {
screen_name: title,
screen_class: title,
})
}
useEffect(() => {
trackPageView("Main_page")
}, []);
But this name doesn't show at all on the Analytics dashboard
I saw in the documentation this way of doing it, but I didn't understand how to make it work or even where to put it
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.SCREEN_NAME, screenName);
bundle.putString(FirebaseAnalytics.Param.SCREEN_CLASS, "MainActivity");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW, bundle);
Use logScreenView like this:
await analytics().logScreenView({
screen_name: <route-name>,
screen_class: <route-name>
});