This commit is contained in:
lingdocs 2021-10-18 00:50:24 -04:00
parent f5e2ed40a7
commit 34e1359872
1 changed files with 7 additions and 4 deletions

View File

@ -37,14 +37,17 @@ if (prod) {
function App(props: RouteComponentProps) {
const [navOpen, setNavOpen] = useState(false);
const { user } = useUser();
function logAnalytics() {
if (prod && !(user?.admin)) {
ReactGA.pageview(window.location.pathname);
};
}
useEffect(() => {
ReactGA.pageview(window.location.pathname);
logAnalytics();
}, []);
useEffect(() => {
window.scroll(0, 0);
if (prod && !(user?.admin)) {
ReactGA.pageview(window.location.pathname);
}
logAnalytics();
}, [props.location.pathname, user]);
return (
<>