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:

  1. Reads NUXT_PUBLIC_UMAMI_HOST and NUXT_PUBLIC_UMAMI_ID from runtime config
  2. Skips injection if either is missing
  3. Skips injection on localhost in production mode
  4. 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:

  1. Deploy Umami (see umami.is)
  2. Create a website in the Umami dashboard
  3. Copy the Website ID
  4. Set NUXT_PUBLIC_UMAMI_HOST and NUXT_PUBLIC_UMAMI_ID in your frontend environment