Firebase analytics implemenetatzions

I can’t get any data in my firebase analytics and I’m wondering if implemented firebase analytics correctly or do I only get data once the product is pushed to production?

I have 2 navigations. One for guest users (users haven’t logged in yet) and logged in users. Both export as RootStack

My main goals are to see how long users are staying logged in and when was the last time they logged in but right now I just want firebase to trigger so I know it’s working

Example of my logged in user navigation:

const RootStack = createDrawerNavigator({

    Home: {
        screen: HomeNavigator,
    },

}, {
    // code for side menu 
});

export default createAppContainer(RootStack)

app.js

// just to get idea that how everything is setup. both navs are imported
import GuestNavigation from './application/navigations/Guest';
import LoggedNavigation from './application/navigations/Logged';
import * as Analytics from 'expo-firebase-analytics';

// Get the current screen from the navigation state
function getActiveRouteName(navigationState) {
  if (!navigationState) return null;
  const route = navigationState.routes[navigationState.index];
  // Parse the nested navigators
  if (route.routes) return getActiveRouteName(route);
  return route.routeName;
}




        <StyleProvider style={getTheme(variables)}>
            <Provider store={store}>
              <PersistGate persistor={persistor}>
                <MenuProvider>
                  <Root
                    onNavigationStateChange={(prevState, currentState) => {
                      const currentScreen = getActiveRouteName(currentState);
                      const prevScreen = getActiveRouteName(prevState);
                      if (prevScreen !== currentScreen) {
                        // Update Firebase with the name of your screen
                        Analytics.setCurrentScreen(currentScreen);
                      }
                    }}
                    >                
   <StatusBar barStyle="dark-content" backgroundColor="white" />
                    <LoggedNavigation />
                  </Root>
                </MenuProvider>
              </PersistGate>
            </Provider>
          </StyleProvider>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.