fix ga
This commit is contained in:
parent
f5e2ed40a7
commit
34e1359872
11
src/App.tsx
11
src/App.tsx
|
@ -37,14 +37,17 @@ if (prod) {
|
||||||
function App(props: RouteComponentProps) {
|
function App(props: RouteComponentProps) {
|
||||||
const [navOpen, setNavOpen] = useState(false);
|
const [navOpen, setNavOpen] = useState(false);
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
useEffect(() => {
|
function logAnalytics() {
|
||||||
|
if (prod && !(user?.admin)) {
|
||||||
ReactGA.pageview(window.location.pathname);
|
ReactGA.pageview(window.location.pathname);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
logAnalytics();
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.scroll(0, 0);
|
window.scroll(0, 0);
|
||||||
if (prod && !(user?.admin)) {
|
logAnalytics();
|
||||||
ReactGA.pageview(window.location.pathname);
|
|
||||||
}
|
|
||||||
}, [props.location.pathname, user]);
|
}, [props.location.pathname, user]);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue