mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
send GA pageviews only if initialized
This commit is contained in:
@@ -122,7 +122,7 @@ function GoogleAnalyticsHandler() {
|
|||||||
}, [googleAnalyticsCode])
|
}, [googleAnalyticsCode])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ReactGA.send({ hitType: "pageview", page: location.pathname })
|
if (ReactGA.isInitialized) ReactGA.send({ hitType: "pageview", page: location.pathname })
|
||||||
}, [location])
|
}, [location])
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user