From 81b7bdbcc5c5ebe58ade6c81b9a7deead9d7c1ee Mon Sep 17 00:00:00 2001 From: "Ted (OpenClaw)" Date: Wed, 25 Feb 2026 12:21:03 +0000 Subject: [PATCH 1/2] feat: add optional Umami analytics support Adds environment variable configuration for self-hosted Umami analytics: - UMAMI_URL: URL to your Umami script.js - UMAMI_WEBSITE_ID: Your site's Umami website ID When both are set, the tracking script is automatically injected. When not set, no analytics code is loaded (privacy by default). Also exposes these in runtimeConfig.public for potential future client-side use (e.g., custom event tracking). --- app/nuxt.config.ts | 13 +++++++++++++ docs/ENVIRONMENTS.md | 27 ++++++++++++++++++++------- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/app/nuxt.config.ts b/app/nuxt.config.ts index fbcd504..627d6b9 100755 --- a/app/nuxt.config.ts +++ b/app/nuxt.config.ts @@ -56,6 +56,9 @@ export default defineNuxtConfig({ // Voice feature flags voiceEnabled: process.env["VOICE_ENABLED"] !== "false", voiceFreeLimit: parseInt(process.env["VOICE_FREE_LIMIT"] || "50", 10), + // Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable + umamiUrl: process.env["UMAMI_URL"] || "", + umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "", }, }, @@ -146,6 +149,16 @@ export default defineNuxtConfig({ { rel: "icon", type: "image/png", href: "/favicon.png" }, { rel: "apple-touch-icon", href: "/icons/icon-192.png" }, ], + // Optional analytics - configured via UMAMI_URL and UMAMI_WEBSITE_ID env vars + script: process.env["UMAMI_URL"] && process.env["UMAMI_WEBSITE_ID"] + ? [ + { + src: process.env["UMAMI_URL"], + defer: true, + "data-website-id": process.env["UMAMI_WEBSITE_ID"], + }, + ] + : [], }, }, diff --git a/docs/ENVIRONMENTS.md b/docs/ENVIRONMENTS.md index c1fa01a..4b83171 100644 --- a/docs/ENVIRONMENTS.md +++ b/docs/ENVIRONMENTS.md @@ -115,13 +115,26 @@ volumes: ### Environment Variables -| Variable | Required | Default | Purpose | -| --------------- | ----------- | ----------------------- | --------------------------- | -| `DATABASE_URL` | No | `file:/data/db.sqlite` | Database path | -| `NODE_ENV` | No | `production` | Environment mode | -| `APP_URL` | Recommended | `http://localhost:3000` | Public URL for emails/links | -| `VOICE_ENABLED` | No | `true` | Enable voice input | -| `GROQ_API_KEY` | No | - | Voice transcription API | +| Variable | Required | Default | Purpose | +| ------------------- | ----------- | ----------------------- | ------------------------------------ | +| `DATABASE_URL` | No | `file:/data/db.sqlite` | Database path | +| `NODE_ENV` | No | `production` | Environment mode | +| `APP_URL` | Recommended | `http://localhost:3000` | Public URL for emails/links | +| `VOICE_ENABLED` | No | `true` | Enable voice input | +| `GROQ_API_KEY` | No | - | Voice transcription API | +| `UMAMI_URL` | No | - | Umami analytics script URL | +| `UMAMI_WEBSITE_ID` | No | - | Umami website ID for tracking | + +#### Analytics (Optional) + +To enable [Umami](https://umami.is/) analytics, set both environment variables: + +```bash +UMAMI_URL=https://your-umami-instance.com/script.js +UMAMI_WEBSITE_ID=your-website-uuid +``` + +This is optional and privacy-friendly — no data is collected unless you configure it. --- From c8295e06312889712fb7d5573b0600f82f03d224 Mon Sep 17 00:00:00 2001 From: "Ted (OpenClaw)" Date: Wed, 25 Feb 2026 19:01:35 +0000 Subject: [PATCH 2/2] fix: address Copilot review comments - Remove unused runtimeConfig entries (umamiUrl, umamiWebsiteId) Script injection reads from process.env directly, no need for runtime config - Add UMAMI_URL and UMAMI_WEBSITE_ID to .env.example for discoverability --- app/.env.example | 9 +++++++++ app/nuxt.config.ts | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/.env.example b/app/.env.example index 2a54579..92f3757 100644 --- a/app/.env.example +++ b/app/.env.example @@ -79,3 +79,12 @@ SMTP_SECURE=false SMTP_FROM= SMTP_REPLY_TO= APP_URL=http://localhost:3000 + +# ============================================ +# Analytics (optional) +# ============================================ +# Self-hosted Umami analytics. Set both to enable tracking. +# Privacy-friendly, GDPR-compliant, no cookies. +# https://umami.is/ +UMAMI_URL= +UMAMI_WEBSITE_ID= diff --git a/app/nuxt.config.ts b/app/nuxt.config.ts index 627d6b9..f84ac79 100755 --- a/app/nuxt.config.ts +++ b/app/nuxt.config.ts @@ -56,9 +56,6 @@ export default defineNuxtConfig({ // Voice feature flags voiceEnabled: process.env["VOICE_ENABLED"] !== "false", voiceFreeLimit: parseInt(process.env["VOICE_FREE_LIMIT"] || "50", 10), - // Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable - umamiUrl: process.env["UMAMI_URL"] || "", - umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "", }, },