The template includes two privacy-friendly analytics integrations: Umami (self-hosted or cloud) and Vercel Analytics. Both are GDPR compliant, cookie-free, and load automatically when configured.
Two client plugins:
app/plugins/umami.client.ts - Umami integrationapp/plugins/vercel-analytics.client.ts - Vercel Analytics integrationFeatures:
NUXT_PUBLIC_UMAMI_ID="your-website-id"
NUXT_PUBLIC_UMAMI_HOST="https://cloud.umami.is"
For self-hosted: use your own domain (e.g., https://analytics.yourdomain.com)
That's it! The plugin automatically injects the tracking script and tracks page views.
NUXT_PUBLIC_VERCEL_ANALYTICS="true"
Enable both for comprehensive tracking:
NUXT_PUBLIC_UMAMI_ID="your-website-id"
NUXT_PUBLIC_UMAMI_HOST="https://cloud.umami.is"
NUXT_PUBLIC_VERCEL_ANALYTICS="true"
Why use both?
Development: Omit variables to disable tracking during local development
Production: Set all desired analytics variables in your hosting platform's environment settings
Track custom events beyond page views:
Umami:
<script setup>
const handlePurchase = () => {
// Check if Umami is loaded
if (window.umami) {
window.umami.track('purchase', { plan: 'pro', amount: 29 })
}
}
</script>
<template>
<Button @click="handlePurchase">Buy Now</Button>
</template>
Vercel Analytics:
<script setup>
import { track } from '@vercel/analytics'
const handlePurchase = () => {
track('purchase', { plan: 'pro', amount: 29 })
}
</script>
<template>
<Button @click="handlePurchase">Buy Now</Button>
</template>
window.umami exists before calling track() to avoid errors if the script hasn't loaded yet.GDPR compliant:
Since these analytics are privacy-friendly, cookie consent banners typically aren't required. Check your local regulations.
Both plugins automatically skip loading when environment variables aren't set. To disable analytics during local development, simply omit the variables from your .env file.
Scripts not loading:
Data not appearing: