Conversation
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).
There was a problem hiding this comment.
Pull request overview
This PR adds optional Umami analytics support to Tada, allowing self-hosted users to track usage via their own Umami instance. The implementation is opt-in only and requires explicit configuration via environment variables.
Changes:
- Adds conditional Umami script injection to
nuxt.config.tswhen bothUMAMI_URLandUMAMI_WEBSITE_IDenvironment variables are set - Documents the new optional analytics configuration in
docs/ENVIRONMENTS.md
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/nuxt.config.ts | Adds runtime config entries for Umami variables and conditional script tag injection in app head configuration |
| docs/ENVIRONMENTS.md | Updates environment variables table and adds new Analytics section explaining how to enable Umami tracking |
app/nuxt.config.ts
Outdated
| // Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable | ||
| umamiUrl: process.env["UMAMI_URL"] || "", | ||
| umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "", |
There was a problem hiding this comment.
The runtime config variables umamiUrl and umamiWebsiteId are defined but never used. The script injection at lines 153-161 reads directly from process.env instead. Consider removing these unused runtime config entries (lines 59-61) since they serve no purpose, or alternatively, update the script injection logic to use the runtime config values for consistency with the rest of the codebase.
| // Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable | |
| umamiUrl: process.env["UMAMI_URL"] || "", | |
| umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "", |
app/nuxt.config.ts
Outdated
| // Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable | ||
| umamiUrl: process.env["UMAMI_URL"] || "", | ||
| umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "", |
There was a problem hiding this comment.
The new environment variables UMAMI_URL and UMAMI_WEBSITE_ID should be documented in the .env.example file for consistency with other optional configuration options. This file serves as a reference for users setting up the application, and currently includes similar optional features like voice features and Stripe configuration.
- 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
Summary
Adds optional Umami analytics support via environment variables.
Changes
UMAMI_URLandUMAMI_WEBSITE_IDare setUsage
Set both environment variables to enable tracking:
Privacy