First-party real-time analytics for Convex with drop-in React dashboard, browser SDK, and HTTP ingest - no third-party services required
npm install @abdssamie/convex-analyticsA complete first-party analytics solution for Convex applications that tracks pageviews, custom events, and user identity directly into your own database. Provides a real-time HTTP ingestion endpoint, a React dashboard component with timeseries charts, and a lightweight browser SDK with auto-batching. Events are stored and processed entirely within your Convex deployment without requiring third-party services.
Convex Analytics provides first-party analytics that stores all data in your Convex database. Install the component, create a site with a write key, and use the browser SDK to track events. All user data stays in your deployment.
Use the AnalyticsDashboard React component to render timeseries charts, top pages, referrers, and custom events. The dashboard connects to authenticated Convex queries and updates in real-time as new events are tracked.
The browser SDK provides track() and identify() methods to send custom events with properties and link anonymous visitors to user IDs. Events are batched and sent to a high-speed HTTP endpoint for real-time ingestion.
Convex Analytics runs entirely within your Convex deployment, tracking pageviews, sessions, referrers, and custom events. You control the data and can query it directly using Convex functions for custom reports.
Convex Analytics stores all data in your own Convex database, so no user data is sent to external services. You control data retention, access, and compliance. The write key acts like a publishable key for browser ingestion but requires authentication for dashboard access.
Convex Analytics uses HTTP ingest for browser events instead of public mutations for better performance and security. The browser SDK batches events and sends them to the HTTP route, which hashes the write key before calling internal component functions.
Raw events are inserted quickly with aggregatedAt: null, then a background worker processes them into visitors, sessions, and hourly/daily rollups. Dashboard queries use these materialized views for fast reporting while raw events remain available for detailed analysis.
Yes, Convex Analytics supports multiple sites through the sites table. Each site has its own write key and allowed origins. For single-site use cases, create one site named 'default' and ignore the multi-site features until needed.
The write key is treated like a publishable key for ingestion only. Protect your deployment by setting allowedOrigins to restrict which domains can send events. Rotate the key by updating both your site record and frontend environment variables if needed.