6 min read

How to Calculate Conversion Rate in Mixpanel

Conversion rate is the percentage of users who complete a goal action after starting in your funnel. Mixpanel makes it straightforward to track this by connecting events and using Funnels or JQL queries to measure who dropped off and who converted.

Track Your Funnel Events with JavaScript SDK

Start by instrumenting your key conversion steps with Mixpanel's JavaScript SDK. You'll track the entry point (e.g., user views signup) and the completion point (e.g., user completes signup).

Initialize Mixpanel and track the funnel start event

Include the Mixpanel SDK in your app and track the first step of your conversion funnel. This is typically a page view or interaction that signals the user is in consideration mode. Use mixpanel.track() to send the event with relevant context.

javascript
// Initialize Mixpanel
mixpanel.init('YOUR_PROJECT_TOKEN');

// Track signup page view (funnel entry point)
mixpanel.track('signup_viewed', {
  'source': 'google_ads',
  'plan_type': 'pro',
  'timestamp': new Date()
});

// Later, track signup completion
mixpanel.track('account_created', {
  'plan_type': 'pro',
  'signup_duration_seconds': 45
});
Track both the starting event and completion event with relevant properties for filtering and segmentation

Add user properties to segment your conversion analysis

Set user-level properties using mixpanel.people.set() so you can later segment conversion rates by cohort, plan, or other dimensions. This enriches your funnel data.

javascript
// Set user properties when account is created
mixpanel.people.set({
  'Plan': 'pro',
  'Account Created': new Date(),
  'Cohort': '2024-Q1',
  'Industry': 'SaaS'
});
User properties enable filtering funnels by segment
Tip: Use consistent event names across your product. If some parts of your app track signup_complete and others track account_created, your conversion metrics will split across multiple events and undercount.

Build a Funnel Report in Mixpanel UI

Once your events are flowing, use Mixpanel's Funnels report to visualize conversion and drop-off rates.

Navigate to Funnels and add your conversion events

Go to Reports > Funnels in Mixpanel. Click Create Funnel. Add your events in order: first the funnel start event, then the completion event. Mixpanel will show you how many users reached each step and the drop-off percentage.

javascript
// This is a visual process in the UI, but here's what the underlying calculation does:
// Conversion Rate = (Users who completed event B / Users who completed event A) * 100
// Example: (1000 account_created / 5000 signup_viewed) * 100 = 20% conversion rate
Mixpanel Funnels automatically calculate this ratio for you

Filter and segment your funnel by user properties

Click Filter to narrow your funnel to specific user cohorts. For example, filter by Plan = 'pro' or Source = 'google_ads'. This shows you conversion rates for different segments.

javascript
// When querying programmatically, add filters to isolate segments:
// COUNT DISTINCT user_id WHERE event = 'signup_viewed' AND properties['plan_type'] = 'pro'
// THEN divide by:
// COUNT DISTINCT user_id WHERE event = 'account_created' AND properties['plan_type'] = 'pro'
// Result: conversion rate for pro plan only
Filters let you compare conversion rates across segments
Watch out: The Funnels UI defaults to a 30-day window. If your conversion cycle is longer, adjust the date range or you'll underestimate conversion rates.

Calculate Conversion Rate Programmatically with the Events API

For reporting dashboards or custom analysis, query your funnel data directly using Mixpanel's Events API or Data Export.

Query conversion counts using the Events API

Use the Mixpanel Events API to count users in each step, then calculate the ratio. You'll need your Project Token to authenticate. This approach gives you raw data to build custom reports.

javascript
// Query Mixpanel Events API to count unique users per funnel step
const projectToken = 'YOUR_PROJECT_TOKEN';

// Count distinct users for funnel start
const startResponse = await fetch(
  'https://api.mixpanel.com/events?' +
  'event=signup_viewed&unit=day&interval=30&api_key=' + projectToken
).then(r => r.json());

// Count distinct users for funnel completion
const completeResponse = await fetch(
  'https://api.mixpanel.com/events?' +
  'event=account_created&unit=day&interval=30&api_key=' + projectToken
).then(r => r.json());

// Calculate conversion rate
const uniqueStart = startResponse.data.values[0];
const uniqueComplete = completeResponse.data.values[0];
const conversionRate = (uniqueComplete / uniqueStart) * 100;
console.log('Conversion Rate:', conversionRate.toFixed(2) + '%');
API queries return event counts; divide completion by start events to get conversion

Use Data Export API for historical batch analysis

For deeper analysis of funnel conversions over time, use the Data Export API. This endpoint returns raw events so you can filter by time, properties, and user segments.

javascript
// Data Export API request (requires API secret for authentication)
const baseUrl = 'https://data.mixpanel.com/api/2.0/export';
const params = new URLSearchParams({
  'from_date': '2024-01-01',
  'to_date': '2024-01-31',
  'api_key': 'YOUR_PROJECT_TOKEN'
});

const response = await fetch(baseUrl + '?' + params, {
  headers: {
    'Authorization': 'Basic ' + btoa('YOUR_API_SECRET' + ':')
  }
});

const events = await response.json();
// Filter events for signup_viewed and account_created, then calculate user counts and ratio
Export raw events for custom analysis and conversion tracking
Tip: When calculating conversion programmatically, define your attribution window. Not every user who viewed the signup page will convert in the same session. Set a time window (e.g., within 7 days) for what counts as a conversion.

Common Pitfalls

  • Inconsistent event naming: If signup completion is tracked as account_created in one flow and signup_complete in another, your conversion metrics will be fragmented across multiple events and undercount.
  • Forgetting user identity: Without properly identifying users across sessions using mixpanel.identify(), Mixpanel treats returning users as new visitors, inflating funnel entries and deflating conversion rates.
  • Not setting time windows: Conversion rate looks different if you measure it over 24 hours vs. 30 days. Define and document your attribution window or your metrics will shift unexpectedly.
  • Ignoring segmentation: Reporting overall conversion rate hides critical insights. A 10% rate might hide 50% conversion in mobile and 3% on web—always break it down by segment to find what actually works.

Wrapping Up

Conversion rate in Mixpanel is the percentage of users who complete your goal action. Build it in the UI with Funnels for quick visibility, or query the Events API for custom dashboards. The key is consistent event tracking and clear attribution windows. If you want to track this automatically across tools, Product Analyst can help.

Track these metrics automatically

Product Analyst connects to your stack and surfaces the insights that matter.

Try Product Analyst — Free