Skip to content

Commit cc1b20c

Browse files
committed
feat: ga
1 parent cf9861e commit cc1b20c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/components/GA.jsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Script from "next/script"
2+
3+
const GA = () => {
4+
return (
5+
<>
6+
<Script async src="https://www.googletagmanager.com/gtag/js?id=G-ZS8DH79JJ7"></Script>
7+
<Script id="ga" defer={false}>
8+
{`
9+
window.dataLayer = window.dataLayer || [];
10+
function gtag(){dataLayer.push(arguments);}
11+
gtag('js', new Date());
12+
13+
gtag('config', 'G-ZS8DH79JJ7');
14+
`}
15+
</Script>
16+
</>
17+
)
18+
}
19+
20+
export default GA

pages/_document.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Html, Head, Main, NextScript } from "next/document"
2+
import GA from "@/lib/components/GA"
23

34
export default function Document() {
45
return (
@@ -7,6 +8,7 @@ export default function Document() {
78
<meta name="description" content="Linx Flow" />
89
<meta name="viewport" content="width=device-width, initial-scale=1" />
910
<link rel="icon" href="/favicon.ico" />
11+
<GA />
1012
</Head>
1113
<body>
1214
<Main />

0 commit comments

Comments
 (0)