From e90b80c6413d11960117cda53405b710582743af Mon Sep 17 00:00:00 2001 From: Athou Date: Wed, 17 May 2023 13:43:25 +0200 Subject: [PATCH] send GA pageviews only if initialized --- commafeed-client/src/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commafeed-client/src/App.tsx b/commafeed-client/src/App.tsx index 4aab69c1..e3f84ff6 100644 --- a/commafeed-client/src/App.tsx +++ b/commafeed-client/src/App.tsx @@ -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