# Umami Analytics Integration This project uses [Umami Analytics](https://umami.is/) for privacy-focused website analytics. The implementation is modern, clean, and follows Next.js best practices. ## Overview The analytics system consists of: 1. **`UmamiScript`** - Loads the Umami tracking script 2. **`AnalyticsProvider`** - Tracks pageviews on route changes 3. **`useAnalytics`** - Custom hook for tracking custom events 4. **`analytics-events.ts`** - Centralized event definitions 5. **`UmamiAnalyticsService`** - Service layer for analytics operations ## Setup ### Environment Variables Add these to your `.env` file: ```bash # Required: Your Umami website ID UMAMI_WEBSITE_ID=59a7db94-0100-4c7e-98ef-99f45b17f9c3 # Optional: Custom Umami script URL (defaults to https://analytics.infra.mintel.me/script.js) NEXT_PUBLIC_UMAMI_SCRIPT_URL=https://analytics.infra.mintel.me/script.js ``` ### Docker Compose The `docker-compose.yml` already includes the environment variables: ```yaml environment: - UMAMI_WEBSITE_ID=${UMAMI_WEBSITE_ID} - NEXT_PUBLIC_UMAMI_SCRIPT_URL=${NEXT_PUBLIC_UMAMI_SCRIPT_URL:-https://analytics.infra.mintel.me/script.js} ``` ## Usage ### 1. Automatic Pageview Tracking The `AnalyticsProvider` component automatically tracks pageviews on client-side route changes. It's already included in your layout: ```tsx // app/[locale]/layout.tsx
{children}