2

react.js Google analytics not working. no realtime data is shown. I'm also using firebase database need some help

import ReactGA from 'react-ga';

function App() {
  useEffect(() => {
    ReactGA.initialize('G-6R4D4957DM');
     // To Report Page View 
    ReactGA.pageview(window.location.pathname + window.location.search);
  }, [])
    
  useEffect(() => {
    console.log(window.location.pathname)
  }) 

  return (
    <> 
      <ThemeProvider theme={Theme}>
        <Navbar/>
        <Switch>
          {/* <Route exact path="/" component={Home}/> */}
          <Route exact path="/" component={Properties} className="Properties"/>
          <Route exact path="/sinnerthedog2Login/" component={Adminindex} />
          <Route exact path="/sinnerthedog2/" component={AdminPannel} className="Properties"/>
          <Route exact path="/:slug" component={Singlepage}/>
          {/* <Route exact path="/sinnerthedog2/" component={AdminPannel}/> */}
          <Route component={Error}/>
        </Switch>
      </ThemeProvider>
    </>
  );
}
    
export default App;
oguz ismail
  • 1
  • 16
  • 47
  • 69
Flemin Louis
  • 171
  • 1
  • 6
  • I am having similar trouble right now, I decided to switch from react-ga after trying a lot, to doing my own class based implementation so that I can share google analytics between my components. It does not seem like they do support ga4 right now: https://github.com/react-ga/react-ga/issues/460#issuecomment-715655709 – Juan Andrés Osorio Escobar Oct 26 '20 at 17:48

1 Answers1

0

By Default Google Analytics display yesterday's data. you can choose current date from filter as in screenshot Thanks

https://i.stack.imgur.com/XYtL1.png