File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { siteConfig } from '@/config/site';
1313import { fontSans } from '@/lib/fonts' ;
1414
1515import '@/styles/globals.css' ;
16+ import { GA } from '@/components/analytics/ga' ;
1617
1718export const metadata : Metadata = {
1819 authors : [
@@ -103,6 +104,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
103104 </ Providers >
104105 < TailwindIndicator />
105106
107+ < GA />
106108 < Toaster />
107109 </ body >
108110 </ html >
Original file line number Diff line number Diff line change 1+ import type { FC } from 'react' ;
2+
3+ import { GoogleAnalytics } from '@next/third-parties/google' ;
4+
5+ export const GA : FC = ( ) => {
6+ if ( ! process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID ) {
7+ return null ;
8+ }
9+
10+ return < GoogleAnalytics gaId = { process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID } /> ;
11+ } ;
Original file line number Diff line number Diff line change 1111 "env" : [
1212 " COMPONENTS_BASE_URL" ,
1313 " NEXT_PUBLIC_APP_URL" ,
14+ " NEXT_PUBLIC_GA_MEASUREMENT_ID" ,
1415 " NODE_ENV" ,
1516 " npm_config_user_agent" ,
1617 " https_proxy"
You can’t perform that action at this time.
0 commit comments