Skip to content

feat: add optional Umami analytics support#1

Open
InfantLab wants to merge 2 commits intomainfrom
feature/optional-umami-analytics
Open

feat: add optional Umami analytics support#1
InfantLab wants to merge 2 commits intomainfrom
feature/optional-umami-analytics

Conversation

@InfantLab
Copy link
Owner

Summary

Adds optional Umami analytics support via environment variables.

Changes

  • nuxt.config.ts: Adds conditional script injection when UMAMI_URL and UMAMI_WEBSITE_ID are set
  • docs/ENVIRONMENTS.md: Documents the new environment variables

Usage

Set both environment variables to enable tracking:

UMAMI_URL=https://your-umami-instance.com/script.js
UMAMI_WEBSITE_ID=your-website-uuid

Privacy

  • Opt-in only: No analytics code is loaded unless explicitly configured
  • Self-hosted friendly: Works with any Umami instance
  • GDPR-compliant: Umami is privacy-focused and doesn't use cookies for tracking

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).
Copilot AI review requested due to automatic review settings February 25, 2026 12:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts when both UMAMI_URL and UMAMI_WEBSITE_ID environment 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

Comment on lines 59 to 61
// Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable
umamiUrl: process.env["UMAMI_URL"] || "",
umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "",
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable
umamiUrl: process.env["UMAMI_URL"] || "",
umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "",

Copilot uses AI. Check for mistakes.
Comment on lines 59 to 61
// Analytics (optional) - set UMAMI_URL and UMAMI_WEBSITE_ID to enable
umamiUrl: process.env["UMAMI_URL"] || "",
umamiWebsiteId: process.env["UMAMI_WEBSITE_ID"] || "",
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants