From b2b8f1ce4b0a25099760c3c4dd232b568135e12c Mon Sep 17 00:00:00 2001 From: Pranav Rajveer Date: Thu, 30 Nov 2023 16:57:30 +0530 Subject: [PATCH] added correct google analytics code and env --- .env.example | 1 + .gitignore | 1 + src/app/layout.tsx | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..84cdc7d --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +NEXT_PUBLIC_GOOGLE_ANALYTICS = "" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7fb7b63..d5b932f 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ yarn-error.log* # local env files .env*.local +.env # vercel .vercel diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6033395..61b63b8 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -41,7 +41,9 @@ export default function RootLayout({ function gtag(){window.dataLayer.push(arguments);} gtag('js', new Date()); - gtag('config', 'G-7NXTY5KCKL'); + gtag('config', '${process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS}',{ + page_path: window.location.pathname, + }); `}