# 26. Analytics Integration (Plausible/PostHog) meta: id: web-production-26 feature: web-production priority: P2 depends_on: [] tags: [analytics, marketing, production] objective: - Implement privacy-respecting analytics to understand user behavior and measure conversion funnels deliverables: - Analytics tracking setup - Custom event tracking for key actions - Conversion funnel measurement - Dashboard for key metrics steps: 1. Set up analytics platform: - Choose: Plausible (privacy-first, simple) or PostHog (powerful, self-hostable) - Create account and add tracking script - Configure domain and goals 2. Add tracking to app: - Add script to web/src/entry-client.tsx or layout - Respect cookie consent (load only after opt-in) - Respect Do Not Track - Exclude admin traffic 3. Track page views: - All public pages - Dashboard pages (anonymized) - Blog post reads 4. Track custom events: - signup_started, signup_completed - login, logout - subscription_started, subscription_completed - darkwatch_scan_initiated - alert_viewed, alert_resolved - feature_page_viewed (voiceprint, spamshield, etc.) 5. Create conversion funnels: - Landing → Signup → Onboarding → Dashboard - Dashboard → Pricing → Checkout → Subscription - Blog → Signup (content marketing ROI) 6. Set up dashboards: - Daily/weekly active users - Signup conversion rate - Subscription conversion rate - Feature adoption (DarkWatch, VoicePrint, etc.) - Churn rate - Revenue metrics (via Stripe integration) 7. Add A/B testing foundation: - PostHog feature flags or Split.io - Test landing page variants - Test pricing page variants tests: - Integration: Verify events fire correctly - Privacy: Confirm no PII in analytics payload - Consent: Test analytics blocked until cookie consent acceptance_criteria: - Analytics tracking active on all public pages - Custom events firing for signup, login, subscription, key features - Conversion funnels visible in dashboard - No PII (names, emails, IDs) sent to analytics - Analytics loads only after cookie consent (if required) - Admin pages excluded from tracking - Daily active users metric available - Subscription conversion rate tracked - A/B testing framework ready for use validation: - Visit landing page → pageview event in analytics - Sign up → signup_completed event with funnel progression - Check analytics dashboard → conversion rates visible - Inspect network tab → no email addresses in payload - Reject cookies → analytics script not loaded notes: - Plausible is GDPR-compliant without cookie consent banner - PostHog offers more features but requires consent in EU - Consider self-hosting Plausible for complete data control - Stripe can send revenue data to analytics automatically