have you included the cdn link and js for google analyctics in the head of html?
Have you tried adding the tracking code inside
<head> in index.html (Admin -> Property -> Tracking code)?
Since you are using empty dependencies array in
useEffect your code gets executed only once, when
<App/> rendered. So you are not sending pageviews on route change.
You need to put pageview-related code before your App component, right after ReactGA initialization. It's a usage example from docs.
I had a similar issue try disabling your ad block if you have it active and put the ReactGA.initialize inside the useEffect
- Google analytics with react is not working
- Google Optimize not working with React App (no cookie set)
- Passport.js Google strategy is not working with the React application
- getPlace function not working with Google Autocomplete in react
- Google Analytics 4 with React
- React Router with custom history not working
- React router v4 not working with Redux
- React Error Boundaries not working with React
- React JS not working with Internet Explorer 9
- React Native Image Not Working with specific URL
- React hook useRef not working with styled-components and typescript
- Paste from clipboard not working with React Native on iOS simulator
- require function not working with image in react
- Search not working with React material-table using remote data
- Font Awesome 5 icons not working with React ("Could not find icon" error)
- Media queries not working with styled components in React App
- React router not working with params
- React render not working with createElement
- Keydown/up events with React Hooks not working properly
- Recharts is not working for the React with typescript
- React - New Context API not working with Class.contextType, but works with Context.Consumer
- React Context not working with server side rendering
- IsValidated not working with redux in react stepzilla
- Replace of setState callback in react hook with useEffect hooks for complicated scenario not working
- React - Ant Design, Form with getFieldDecorator and initialValue not working in single chechbox
- ReferenceError: document is not defined in Next.js while working with React Aria overlays
- React facebook share not working on open graph meta tags with server side rendering
- How do I show the Google passport oAuth consent screen in the react frontend, not with express views template
- Unable to track time spent on React web app with Google Analytics
- Shake gesture not working on physical device with react native
More Query from same tag
- How to assign variables in .env file?
- Using UseEffect Hook to Fetch API
- background colour not applying in <a> tag
- Remove element that is not in .css
- How to acess name attribute of iframe in React.js
- semantic ui react mobile friendly components
- MUI 5 Autocomplete filtered options count
- react: addEventListener is not a function error
- Have a Button to add same component in React
- React bind custom handler onChange to input
- Get value of loop options in React
- react-intl: unicode character
- React Redux: View not getting updated even though mapStateToProps is
- I'm getting a Cannot read property of 'exercises' of undefined error when trying to map my props
- How can I pass down props through Route and container component?
- How to redirect to a gatsby-react page with an onclick event of a component?
- use context value as initial state value - react hooks
- Which one is more safe local storage or cookies?
- how to change only current component style on hover
- Websocket event receiving old redux state in React app
- Securing a React frontend and with Python API using AWS Cognito
- Each child in a list should have a unique "key" prop while nested list iteration
- How do I use React props in Typescript correctly?
- React Router: clicking on mapped items to a new page
- How do I access a ref in a functional child component that is wrapped in React-Redux's connect function?
- How to use a react component for showing Google Maps InfoWindow
- Deleting list Item in react keep older items instead
- How to send params in useHistory of React Router Dom?
- Use Web3 and Metamask in React
- Why is this object failing my own PropTypes validation