Skip to content

Commit 2541c25

Browse files
fix: GA
1 parent d8ca0e8 commit 2541c25

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

app/[locale]/layout.tsx

+3-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { notFound } from 'next/navigation'
44
import { i18n } from '../../i18n'
55
import Footer from './components/Footer/Footer'
66
import Navbar from './components/Navbar/Navbar'
7-
import Script from 'next/script'
7+
import { GoogleAnalytics } from '@next/third-parties/google'
88

99
const notoSansSC = Noto_Sans_SC({
1010
subsets: ['latin'],
@@ -27,26 +27,14 @@ export default async function LangLayout({ children, params: { locale } }
2727

2828
return (
2929
<html lang={locale} className={notoSansSC.className}>
30-
<head>
31-
{/*Google tag (gtag.js)*/}
32-
<Script src="https://www.googletagmanager.com/gtag/js?id=G-6XPF6Q2WY0" />
33-
<Script id="google-analytics">
34-
{`
35-
window.dataLayer = window.dataLayer || [];
36-
function gtag(){dataLayer.push(arguments);}
37-
gtag('js', new Date());
38-
39-
gtag('config', '6XPF6Q2WY0');
40-
`}
41-
</Script>
42-
</head>
4330
<body>
4431
<NextIntlClientProvider locale={locale} messages={locales}>
4532
<Navbar />
4633
{children}
4734
<Footer />
4835
</NextIntlClientProvider>
36+
<GoogleAnalytics gaId="G-6XPF6Q2WY0" />
4937
</body>
5038
</html>
5139
)
52-
}
40+
}

0 commit comments

Comments
 (0)