File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 33import Script from "next/script" ;
44import * as gtag from "@/lib/gtag" ;
55import { usePathname , useSearchParams } from "next/navigation" ;
6- import { useEffect } from "react" ;
6+ import { useEffect , Suspense } from "react" ;
77
8- export default function GoogleAnalytics ( ) {
8+ function GoogleAnalyticsInner ( ) {
99 const pathname = usePathname ( ) ;
1010 const searchParams = useSearchParams ( ) ;
1111
@@ -14,6 +14,10 @@ export default function GoogleAnalytics() {
1414 gtag . pageview ( url ) ;
1515 } , [ pathname , searchParams ] ) ;
1616
17+ return null ;
18+ }
19+
20+ export default function GoogleAnalytics ( ) {
1721 return (
1822 < >
1923 < Script
@@ -32,6 +36,9 @@ export default function GoogleAnalytics() {
3236 ` ,
3337 } }
3438 />
39+ < Suspense fallback = { null } >
40+ < GoogleAnalyticsInner />
41+ </ Suspense >
3542 </ >
3643 ) ;
3744}
You can’t perform that action at this time.
0 commit comments