diff --git a/.env.local.example b/.env.local.example index 9a90b2c..130c722 100644 --- a/.env.local.example +++ b/.env.local.example @@ -13,3 +13,7 @@ SUPABASE_SERVICE_ROLE_KEY=your-service-role-key # Random secret for Vercel cron authentication — set same value in Vercel env vars CRON_SECRET=your-random-secret + +# Google Analytics 4 Measurement ID (format: G-XXXXXXXXXX) +# Get from analytics.google.com -> Admin -> Data Streams -> your stream -> Measurement ID +NEXT_PUBLIC_GA_MEASUREMENT_ID=G-CCRK2NRGSL diff --git a/app/layout.tsx b/app/layout.tsx index 4ad2fe2..30cdc6c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,6 +2,7 @@ import type { Metadata, Viewport } from 'next' import { DM_Sans, Plus_Jakarta_Sans, JetBrains_Mono } from 'next/font/google' import { ThemeProvider } from 'next-themes' import { Analytics } from '@vercel/analytics/next' +import { GoogleAnalytics } from '@next/third-parties/google' import { FaviconInit } from '@/components/ui/FaviconInit' import './globals.css' @@ -94,6 +95,9 @@ export default function RootLayout({ suppressHydrationWarning className={`${dmSans.variable} ${plusJakartaSans.variable} ${jetbrainsMono.variable}`} > + {process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID && ( + + )}