Fix google analytics config

This commit is contained in:
Hazem Krimi
2022-02-06 10:28:28 +01:00
parent b5b33699f6
commit 56cbb0008d
2 changed files with 25 additions and 2 deletions
+6 -2
View File
@@ -15,6 +15,8 @@ import Footer from '../components/Footer';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { GOOGLE_ANALYTICS_KEY } from '../utils/gtag';
NProgress.configure({ showSpinner: false });
const App = ({ Component, pageProps }: AppProps) => {
@@ -38,7 +40,7 @@ const App = ({ Component, pageProps }: AppProps) => {
<>
<Script
strategy='afterInteractive'
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GOOGLE_ANALYTICS_KEY}`}
src={`https://www.googletagmanager.com/gtag/js?id=${GOOGLE_ANALYTICS_KEY}`}
/>
<Script
id='analytics-init'
@@ -52,7 +54,9 @@ const App = ({ Component, pageProps }: AppProps) => {
}
gtag('js', new Date());
gtag('config', ${process.env.GOOGLE_ANALYTICS_KEY});
gtag('config', ${GOOGLE_ANALYTICS_KEY}, {
page_path: window.location.pathname,
});
`
}}
/>