From a472c49efb77f6bc8512fc89c9722a2111feff1c Mon Sep 17 00:00:00 2001 From: Matthew Grove Date: Sun, 12 Sep 2021 11:36:58 +0100 Subject: [PATCH] [FIX] Google Analytics error When Home component used in Login component, logEvent not passed. Now Home component only logs events if logEvent is defined (i.e. it's not called from the Login component) --- src/Home.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home.js b/src/Home.js index 86a66c2..2f25298 100644 --- a/src/Home.js +++ b/src/Home.js @@ -19,7 +19,7 @@ export default function Home(props) { document.title = "Parandum"; useEffect(() => { - props.logEvent("page_view"); + if (props.logEvent) props.logEvent("page_view"); }); return (