Skip to content

Commit e5f4598

Browse files
committed
add intecom
1 parent 887d84d commit e5f4598

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

app/GTM.tsx

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use client"
2+
3+
import { useEffect } from "react";
4+
import TagManager from "react-gtm-module";
5+
6+
export default function GTM() {
7+
useEffect(() => {
8+
const gtmId = process.env.NEXT_PUBLIC_GTM_ID
9+
if (gtmId) {
10+
TagManager.initialize({ gtmId });
11+
}
12+
}, []);
13+
14+
return null;
15+
}

app/layout.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import './globals.css'
44
import { Toaster } from '@/components/ui/toaster'
55
import GoogleAnalytics from './components/GoogleAnalytics'
66
import { cn } from '@/lib/utils'
7+
import GTM from './GTM'
78

89
const inter = Inter({ subsets: ['latin'] })
910

@@ -20,10 +21,7 @@ export default function RootLayout({
2021
return (
2122
<html lang="en">
2223
<body className={cn(inter.className, "relative")}>
23-
{process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS ? (
24-
<GoogleAnalytics ga_id=
25-
{process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS} />
26-
) : null}
24+
<GTM />
2725
{children}
2826
<Toaster />
2927
</body>

package-lock.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@radix-ui/react-slot": "^1.0.2",
1919
"@radix-ui/react-toast": "^1.2.2",
2020
"@radix-ui/react-tooltip": "^1.1.4",
21+
"@types/react-gtm-module": "^2.0.4",
2122
"autoprefixer": "^10.4.20",
2223
"class-variance-authority": "^0.7.1",
2324
"clsx": "^2.1.0",
@@ -27,6 +28,7 @@
2728
"react": "^18",
2829
"react-dom": "^18",
2930
"react-force-graph-2d": "^1.25.8",
31+
"react-gtm-module": "^2.0.11",
3032
"react-resizable-panels": "^2.0.20",
3133
"react-syntax-highlighter": "^15.6.1",
3234
"react-type-animation": "^3.2.0",

0 commit comments

Comments
 (0)