Google Analytics not sending different pages aside from home page in ReactJS(Vite)
Vicente G. Reyes

Vicente G. Reyes @highcenburg

About: Web Developer | Technical Writer | OSS Contributor | Musician | Gamer

Location:
Mars
Joined:
Jan 6, 2019

Google Analytics not sending different pages aside from home page in ReactJS(Vite)

Publish Date: Jul 18
0 0

I'm using react-ga4 for my [portfolio[(https://vicentereyes.org). I have a PageViewTracker.jsx which has:

import { useEffect } from 'react'
import { useLocation } from 'react-router-dom';
import { trackPageView } from '../utils/analytics';

const PageViewTracker = ({ children }) => {
  const location = useLocation();

  useEffect(() => {
    trackPageView(location);
  }, [location]);

  return children;

Comments 0 total

    Add comment