Analytics
Umami analytics integration
Analytics
What's Included
- Umami analytics integration (privacy-friendly, cookie-free)
- Runtime configuration via environment variables
- Automatic script injection (client-side only)
- Localhost detection (skips tracking in development)
Setup
Umami is optional and configured via environment variables:
NUXT_PUBLIC_UMAMI_HOST=https://analytics.yourdomain.com
NUXT_PUBLIC_UMAMI_ID=your-site-id
If these variables are not set, the analytics plugin is not loaded and no tracking script is injected.
How It Works
The umami.client.ts plugin:
- Reads
NUXT_PUBLIC_UMAMI_HOSTandNUXT_PUBLIC_UMAMI_IDfrom runtime config - Skips injection if either is missing
- Skips injection on
localhostin production mode - Injects the Umami tracking script into the page
<head>
Why Umami?
- Privacy-friendly — no cookies, GDPR-compliant out of the box
- Self-hosted — you own your data
- Lightweight — ~2KB tracking script
- Open source — free to self-host
Self-Hosting Umami
You can run Umami alongside your app using Docker:
- Deploy Umami (see umami.is)
- Create a website in the Umami dashboard
- Copy the Website ID
- Set
NUXT_PUBLIC_UMAMI_HOSTandNUXT_PUBLIC_UMAMI_IDin your frontend environment