From d4a4572498b5ebb771b143350d3d8780dfff4036 Mon Sep 17 00:00:00 2001 From: AmElmo Date: Mon, 23 Feb 2026 17:46:04 +0700 Subject: [PATCH] feat(website): add Umami analytics integration Add custom _app.tsx with next/script for Umami tracking. Uses NEXT_PUBLIC_UMAMI_URL and NEXT_PUBLIC_UMAMI_WEBSITE_ID environment variables so the script only loads when configured. --- website/.env.example | 4 ++++ website/pages/_app.tsx | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 website/.env.example create mode 100644 website/pages/_app.tsx diff --git a/website/.env.example b/website/.env.example new file mode 100644 index 0000000..03937ed --- /dev/null +++ b/website/.env.example @@ -0,0 +1,4 @@ +# Umami Analytics +# Get these from your Umami dashboard: Settings → Websites → Edit +NEXT_PUBLIC_UMAMI_URL=https://your-umami-instance.com/script.js +NEXT_PUBLIC_UMAMI_WEBSITE_ID=your-website-id-here diff --git a/website/pages/_app.tsx b/website/pages/_app.tsx new file mode 100644 index 0000000..14893c8 --- /dev/null +++ b/website/pages/_app.tsx @@ -0,0 +1,20 @@ +import type { AppProps } from 'next/app' +import Script from 'next/script' + +export default function App({ Component, pageProps }: AppProps) { + const umamiUrl = process.env.NEXT_PUBLIC_UMAMI_URL + const umamiWebsiteId = process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID + + return ( + <> + {umamiUrl && umamiWebsiteId && ( +