forked from Archives/Athou_commafeed
send GA pageviews only if initialized
This commit is contained in:
@@ -122,7 +122,7 @@ function GoogleAnalyticsHandler() {
|
||||
}, [googleAnalyticsCode])
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname })
|
||||
if (ReactGA.isInitialized) ReactGA.send({ hitType: "pageview", page: location.pathname })
|
||||
}, [location])
|
||||
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user