We want to track user interactions with the product to capture behavioral data and enrich the database data already in Supabase for full product analytics. Instead of using a third party javascript library, we will build our own lean analytics system with a Next.js/React provider built on top of existing Supabase clients (@supabase/supabase-js and @supabase/ssr). We will use intelligent client-side aggregation and smart batching to capture only the most essential behavioral data, storing it in a single optimized Supabase table designed for both human analysis and LLM consumption via Supabase MCP.
Core Principles:
- Aggregate data client-side before sending (minimal payload)