-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Google Analytics 4 #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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' | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| import { FaviconInit } from '@/components/ui/FaviconInit' | ||
| import './globals.css' | ||
|
|
||
|
|
@@ -118,6 +119,9 @@ export default function RootLayout({ | |
| <FaviconInit /> | ||
| {children} | ||
| <Analytics /> | ||
| {process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID && ( | ||
| <GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID} /> | ||
| )} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Privacy policy is now out of sync — GA4 uses cookies.
🤖 Prompt for AI Agents |
||
| </ThemeProvider> | ||
| </body> | ||
| </html> | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't ship a real-looking Measurement ID in the example file.
G-CCRK2NRGSLreads like a real GA4 stream ID rather than a placeholder. Anyone cloning/forking without overriding.env.localwill pollute your GA property with their dev traffic (and you'll inherit their PII-adjacent data). The comment on line 17 already specifies the placeholder format — use it.🔧 Proposed fix
If
G-CCRK2NRGSLis indeed your production stream, consider rotating it and scrubbing git history since.env.local.exampleis public.📝 Committable suggestion
🤖 Prompt for AI Agents