File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 1+ import Script from "next/script" ;
2+
3+ export default function GA4 ( ) {
4+ return (
5+ < >
6+ < Script
7+ src = "https://www.googletagmanager.com/gtag/js?id=AW-770996949"
8+ strategy = "lazyOnload"
9+ />
10+
11+ < Script id = "gtag-init" strategy = "lazyOnload" >
12+ {
13+ `
14+ window.dataLayer = window.dataLayer || [];
15+ function gtag(){dataLayer.push(arguments);}
16+ gtag('js', new Date());
17+
18+ gtag('config', 'AW-770996949');
19+ `
20+ }
21+ </ Script >
22+ </ >
23+ ) ;
24+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Analytics } from "@vercel/analytics/next";
44import { useRouter } from "next/router" ;
55
66import CR from "@/components/CR" ;
7+ import GA4 from "@/components/GA4" ;
78import RB2B from "@/components/RB2B" ;
89import Vector from "@/components/Vector" ;
910import VectorConnect from "@/components/VectorConnect" ;
@@ -15,7 +16,12 @@ export default function MyApp({
1516
1617 let script = null ;
1718 if ( router . pathname === "/" ) {
18- script = < Vector /> ;
19+ script = (
20+ < >
21+ < GA4 />
22+ < Vector />
23+ </ >
24+ ) ;
1925 } else if ( router . pathname . startsWith ( "/connect" ) ) {
2026 script = (
2127 < >
You can’t perform that action at this time.
0 commit comments