feat: add Umami analytics via UMAMI_ID / UMAMI_SRC env vars
Script is injected with lazyOnload strategy and omitted entirely when the env vars are not set, so dev and staging environments stay clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import type { Metadata } from 'next'
|
import type { Metadata } from 'next'
|
||||||
import { Bebas_Neue, Space_Grotesk } from 'next/font/google'
|
import { Bebas_Neue, Space_Grotesk } from 'next/font/google'
|
||||||
|
import Script from 'next/script'
|
||||||
import './globals.css'
|
import './globals.css'
|
||||||
import { Nav } from '@/components/nav'
|
import { Nav } from '@/components/nav'
|
||||||
import { AppApolloProvider } from '@/components/apollo-provider'
|
import { AppApolloProvider } from '@/components/apollo-provider'
|
||||||
@@ -21,10 +22,16 @@ export const metadata: Metadata = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const umamiId = process.env.UMAMI_ID
|
||||||
|
const umamiSrc = process.env.UMAMI_SRC
|
||||||
|
|
||||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<html lang="en" data-scroll-behavior="smooth" className={`${bebasNeue.variable} ${spaceGrotesk.variable}`}>
|
<html lang="en" data-scroll-behavior="smooth" className={`${bebasNeue.variable} ${spaceGrotesk.variable}`}>
|
||||||
<body>
|
<body>
|
||||||
|
{umamiId && umamiSrc && (
|
||||||
|
<Script src={umamiSrc} data-website-id={umamiId} strategy="lazyOnload" />
|
||||||
|
)}
|
||||||
<AppApolloProvider>
|
<AppApolloProvider>
|
||||||
<Nav />
|
<Nav />
|
||||||
<main className="pt-[60px] min-h-screen">{children}</main>
|
<main className="pt-[60px] min-h-screen">{children}</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user