Convalytics

Server-side analytics component for Convex apps that tracks product events from mutations and actions, immune to ad blockers and page unload drops.

Installation

npm install convalytics-dev

About Convalytics

Convalytics provides server-side analytics for Convex applications, allowing you to track product events reliably from mutations and actions. Unlike client-side tracking, server-side events bypass ad blockers and aren't lost on page unloads. It includes web analytics capabilities and provides a unified dashboard for both server events and browser page views.

Benefits

Use cases

how to track user signup events in Convex mutations

The Convalytics Component lets you track events directly from Convex mutations using analytics.track(ctx, {name: 'user_signed_up', userId, props}). Events are delivered asynchronously and never throw errors, ensuring your mutation logic remains unaffected.

server side analytics for SaaS product events

Track subscription renewals, feature usage, and user actions from Convex actions and mutations. Server-side tracking ensures events are captured even when users have ad blockers or close tabs before client-side scripts complete.

Convex webhook analytics tracking

Track events from third-party webhooks in Convex httpActions, like Stripe payment events. The component handles event delivery asynchronously so webhook responses remain fast and reliable.

full stack analytics for Convex applications

Combine server-side product event tracking with browser page view analytics. Add the Convalytics script to your frontend and use the component for backend events to get complete user journey visibility.

Frequently asked questions

Does the Convalytics Component affect Convex function performance?

No, the Convalytics Component delivers events asynchronously and never throws errors. Analytics failures are logged but never propagate to your mutations or actions, ensuring your core application logic remains unaffected.

Can I track events from both Convex mutations and actions?

Yes, the Convalytics Component works in both mutations and actions. Use analytics.track(ctx, event) in mutations for database operations and in httpActions for webhook processing or external API calls.

How do I set up the write key for the Convalytics Component?

Set your write key as a Convex environment variable using npx convex env set CONVALYTICS_WRITE_KEY your_key. Get your write key from the Convalytics dashboard or use npx convalytics init to auto-generate one.

What data can I include with tracked events?

The Convalytics Component accepts event name, userId, optional userEmail, userName, sessionId, timestamp, and custom properties. Properties support strings, numbers, and booleans for flexible event metadata.

Does the component include client-side web analytics?

The Convalytics Component handles server-side tracking only. For complete analytics, pair it with the Convalytics browser script for page views and client-side events in the same dashboard.

Links