ga-4-react icon indicating copy to clipboard operation
ga-4-react copied to clipboard

Are page view events sent automatically if I use react router (BrowserRouter)?

Open JetSimon opened this issue 1 month ago • 0 comments

Hello,

I haven't been able to find a clear answer to this online. Do I need to worry about adding page view code if I am using a BrowserRouter? Or will ga-4-react automatically track those pages?

Thanks

Example code I would add:

useEffect(() => {
    ReactGA.send({ hitType: "pageview", page: location.pathname });
}, [])

JetSimon avatar Jan 16 '25 19:01 JetSimon