mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-28 01:49:00 +09:00
## Summary - Add Google Analytics tracking with measurement ID `G-D0E63LB9FY` - Uses same property as nomadkaraoke.com for unified cross-subdomain analytics ## Test plan - [x] Build passes - [ ] Verify GA loads on gen.nomadkaraoke.com (Network tab → gtag.js) - [ ] Verify events appear in Google Analytics dashboard @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
25 lines
637 B
TypeScript
25 lines
637 B
TypeScript
'use client'
|
|
|
|
import Script from 'next/script'
|
|
|
|
const GA_MEASUREMENT_ID = process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID || 'G-D0E63LB9FY'
|
|
|
|
export function GoogleAnalytics() {
|
|
return (
|
|
<>
|
|
<Script
|
|
src={`https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}`}
|
|
strategy="afterInteractive"
|
|
/>
|
|
<Script id="google-analytics" strategy="afterInteractive">
|
|
{`
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
gtag('config', '${GA_MEASUREMENT_ID}');
|
|
`}
|
|
</Script>
|
|
</>
|
|
)
|
|
}
|