Analytics Configuration
About 214 wordsLess than 1 minute
2025-10-10
Site analytics setup.
File Structure
project-root/
├── src/
│ └── config.ts # Feature toggles
└── .env # Environment variablesSetup Steps
1. Create an Umami Site
- Open the Umami dashboard. If you do not have an account yet, sign up first.
- Click Add website.
- Fill in:
- Name – e.g.
Twilight Blog - Domain – your production domain
- Name – e.g.
- Click Save.
- Press Edit to grab the Tracking code.
- Open Settings → API Keys and copy the Key.
- Create a local
.envfile and configure:
UMAMI_API_KEY=your-key
UMAMI_TRACKING_CODE=your-tracking-code2. Display Statistics
In src/config.ts:
export const umamiConfig = {
enabled: false, // Toggle Umami analytics
baseUrl: "https://api.umami.is", // Keep default unless using a self-hosted URL
};3. Deploy
- Push code to GitHub (or your VCS of choice).
- Deploy to your hosting platform and inject the
.envvalues into environment variables.
Troubleshooting
Common Issues
- Stats are missing
- Double-check the tracking code and API key.
- Ensure the environment variables are present in production.
- Dev server fails to start
- Verify required environment variables exist locally.
- Reinstall dependencies if necessary.
Getting Help
Open an Issue in the project repository if you need assistance.
