diff --git a/pages/_app.js b/pages/_app.js
index 01a46411eb..917e242f6f 100644
--- a/pages/_app.js
+++ b/pages/_app.js
@@ -7,6 +7,8 @@ import '../styles/layout/layout.scss';
// prettier-ignore
import '../styles/primereact.css';
// prettier-ignore
+import { useRouter } from 'next/router';
+import Script from 'next/script';
import PrimeReact from '../components/lib/api/Api';
import { PrimeReactContext, PrimeReactProvider } from '../components/lib/api/PrimeReactContext';
import AnnouncementData from '../data/news.json';
@@ -20,7 +22,31 @@ function Main({ component: Component }) {
const announcement = useRef(AnnouncementData);
const context = useContext(PrimeReactContext);
+ const router = useRouter();
+
+ useEffect(() => {
+ const handleRouteChange = (url) => {
+ pageview(url);
+ };
+
+ router.events.on('routeChangeComplete', handleRouteChange);
+
+ return () => {
+ router.events.off('routeChangeComplete', handleRouteChange);
+ };
+ }, [router.events]);
+
+ const pageview = (url) => {
+ // eslint-disable-next-line no-console
+ console.log(url);
+ window.gtag('config', 'G-FZJEC89ZVF', {
+ page_path: url
+ });
+ };
+
useEffect(() => {
+ pageview(router.pathname);
+
const itemString = localStorage.getItem(storageKey);
if (itemString) {
@@ -97,8 +123,20 @@ function Main({ component: Component }) {
export default function MyApp({ Component }) {
return (
-
-
-
+ <>
+
+
+
+
+
+ >
);
}