fix: feat: basic analytics funnel tracking for launch readiness (#1101)

Add self-hosted Umami analytics to replace the third-party cloud.umami.is
tracker. Creates @harb/analytics package with typed event helpers and
instruments the conversion funnel: CTA clicks (landing), wallet connect,
swap initiated, and stake created (web-app).

- Add Umami Docker service sharing existing postgres (separate DB)
- Add Caddy /analytics route to proxy Umami dashboard
- Configure via VITE_UMAMI_URL and VITE_UMAMI_WEBSITE_ID env vars
- Document setup and funnel events in docs/ENVIRONMENT.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
johba 2026-03-23 13:04:24 +00:00
parent 8d67e61c17
commit ca2bc03567
17 changed files with 195 additions and 6 deletions

View file

@ -52,6 +52,7 @@ services:
- POSTGRES_DB=ponder_local
volumes:
- postgres-data:/var/lib/postgresql/data
- ./containers/init-umami-db.sh:/docker-entrypoint-initdb.d/init-umami-db.sh:ro,z
expose:
- "5432"
restart: unless-stopped
@ -133,6 +134,8 @@ services:
- CHOKIDAR_USEPOLLING=1
- GIT_BRANCH=${GIT_BRANCH:-}
- VITE_ENABLE_LOCAL_SWAP=true
- VITE_UMAMI_URL=${VITE_UMAMI_URL:-}
- VITE_UMAMI_WEBSITE_ID=${VITE_UMAMI_WEBSITE_ID:-}
expose:
- "5173"
ports:
@ -167,6 +170,8 @@ services:
- CHOKIDAR_USEPOLLING=1
- GIT_BRANCH=${GIT_BRANCH:-}
- VITE_APP_URL=http://localhost:5173/app
- VITE_UMAMI_URL=${VITE_UMAMI_URL:-}
- VITE_UMAMI_WEBSITE_ID=${VITE_UMAMI_WEBSITE_ID:-}
expose:
- "5174"
restart: unless-stopped
@ -228,6 +233,30 @@ services:
retries: 3
start_period: 2s
umami:
image: ghcr.io/umami-software/umami:postgresql-latest
environment:
- DATABASE_URL=postgresql://umami:umami_local@postgres:5432/umami
- APP_SECRET=${UMAMI_APP_SECRET:-harb-analytics-secret}
- DISABLE_TELEMETRY=1
expose:
- "3000"
ports:
- "127.0.0.1:3000:3000"
restart: unless-stopped
networks:
- harb-network
depends_on:
postgres:
condition: service_healthy
logging: *default-logging
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:3000/api/heartbeat"]
interval: 5s
timeout: 3s
retries: 10
start_period: 15s
otterscan:
image: otterscan/otterscan:v2.6.0
environment: