angrybeanie-front-end/lib/usePageTracking.js
2021-09-05 16:12:45 +10:00

14 lines
No EOL
356 B
JavaScript
Executable file

import { useEffect} from "react";
import { useLocation } from "react-router-dom";
import ReactGA from "react-ga";
const usePageTracking = () => {
const location = useLocation();
useEffect(() => {
ReactGA.initialize("UA-000000000-0");
ReactGA.pageview(location.pathname + location.search);
}, [location]);
};
export default usePageTracking;