feat: add privacy-friendly Umami page-view analytics (#15)
Cookieless, env-gated page-view tracking via Umami. The <Analytics /> component injects the script only when NEXT_PUBLIC_UMAMI_SRC and NEXT_PUBLIC_UMAMI_WEBSITE_ID are both set, so local dev and forks send nothing to our instance. Adds .env.example docs (section 6) and a homepage footer privacy disclosure. No Cookie consent banner needed.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import Script from "next/script";
|
||||
|
||||
// Privacy-friendly, cookieless page-view analytics (Umami). Both env vars
|
||||
// unset → render nothing, so local dev and forks never report to our instance.
|
||||
export function Analytics() {
|
||||
const src = process.env.NEXT_PUBLIC_UMAMI_SRC;
|
||||
const websiteId = process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID;
|
||||
if (!src || !websiteId) return null;
|
||||
|
||||
return (
|
||||
<Script
|
||||
src={src}
|
||||
data-website-id={websiteId}
|
||||
strategy="afterInteractive"
|
||||
defer
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user