Skip to content

Commit c2b9f40

Browse files
feat:google analytics
1 parent b87b0e0 commit c2b9f40

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/app/layout.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import "@/styles/globals.css";
22
import { Toaster } from "react-hot-toast";
33
import { ThemeProvider } from "@/components/theme-provider";
44
import { GeistSans } from "geist/font/sans";
5+
import Script from "next/script";
56
import { Metadata } from "next";
6-
import { Analytics } from "@vercel/analytics/next";
77

88
export const metadata: Metadata = {
99
metadataBase: new URL("https://papers.codechefvit.com/"),
@@ -95,6 +95,18 @@ export default function RootLayout({
9595
name="google-site-verification"
9696
content="SjVFuH8GzIj3Ooh2JcWufBoSMWTzo77TACHomonCKVs"
9797
/>
98+
<head>
99+
<Script
100+
async
101+
src="https://www.googletagmanager.com/gtag/js?id=G-J5CD036GJP"
102+
></Script>
103+
<Script id="google-analytics">
104+
{`window.dataLayer = window.dataLayer || [];
105+
function gtag(){dataLayer.push(arguments);}
106+
gtag('js', new Date());
107+
gtag('config', 'G-J5CD036GJP');`}
108+
</Script>
109+
</head>
98110
<body>
99111
<ThemeProvider
100112
attribute="class"
@@ -104,7 +116,6 @@ export default function RootLayout({
104116
>
105117
<Toaster position="top-right" reverseOrder={false} />
106118
{children}
107-
<Analytics />
108119
</ThemeProvider>
109120
</body>
110121
</html>

0 commit comments

Comments
 (0)