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;
…