You need to know how long it takes users to move from first interaction to purchase—whether that's signup to trial activation or onboarding to paid plan. Mixpanel tracks event timestamps, so the data is there. We'll show you three ways to get the number: using funnels, pulling events manually, or measuring in real time.
Find Conversion Time in Mixpanel Funnels
If you're already tracking events in a funnel, Mixpanel calculates conversion time for you automatically.
Create or open your conversion funnel
Go to Funnels in your Mixpanel project and set up a funnel with your starting event (e.g., Sign Up) and conversion event (e.g., Purchase). Make sure both events are firing in your app with user IDs.
// Track the entry event
mixpanel.track('Sign Up', {
user_id: user.id,
plan_type: 'free'
});
// Track the conversion event later
mixpanel.track('Purchase', {
user_id: user.id,
amount: 99,
plan: 'Pro'
});Read the time to conversion metric
Once data accumulates, Mixpanel calculates median time to conversion between each step. Click a funnel step to see the breakdown: median, mean, and percentiles. This is measured in days by default.
// Retrieve funnel data with time metrics via API
const response = await fetch(
'https://mixpanel.com/api/2.0/funnels?' +
'project_id=YOUR_PROJECT_ID&' +
'funnel_id=YOUR_FUNNEL_ID&' +
'from_date=2024-01-01&' +
'to_date=2024-12-31',
{
headers: {
'Authorization': 'Basic ' + btoa('SERVICE_ACCOUNT:PASSWORD')
}
}
);
const funnel = await response.json();
console.log('Median conversion time:', funnel.data.computed_funnel_conversion_data);Calculate Time to Convert from Raw Events
For precise control or to analyze specific segments, pull events directly and calculate duration yourself.
Export your events with the Data Export API
Use the Data Export API to fetch events in bulk. Include user_id and time properties. Each event has a Unix timestamp in seconds. Export both your starting event and conversion event.
async function getEventData(eventName, fromDate, toDate) {
const params = new URLSearchParams({
from_date: fromDate, // '2024-01-01'
to_date: toDate, // '2024-12-31'
event: eventName, // 'Sign Up' or 'Purchase'
export_properties: 'user_id,time,plan_type'
});
const response = await fetch(
`https://mixpanel.com/api/2.0/export?${params}`,
{
headers: {
'Authorization': 'Basic ' + btoa('SERVICE_ACCOUNT:PASSWORD')
}
}
);
// Returns JSONL (one JSON object per line)
return response.text().then(text =>
text.split('\n').filter(Boolean).map(JSON.parse)
);
}Match events per user and calculate duration
Group events by user_id. For each user, find their starting event timestamp and conversion event timestamp. Subtract to get the duration in seconds, then convert to days or hours depending on your use case.
function calculateConversionTimes(signupEvents, conversionEvents) {
const conversionMap = new Map();
// Index conversion events by user_id
conversionEvents.forEach(event => {
const userId = event.properties.user_id;
if (!conversionMap.has(userId)) {
conversionMap.set(userId, event);
}
});
// Calculate time to convert for each signup
const results = signupEvents.map(signup => {
const userId = signup.properties.user_id;
const conversion = conversionMap.get(userId);
if (conversion && conversion.properties.time > signup.properties.time) {
const durationSeconds = conversion.properties.time - signup.properties.time;
const durationDays = durationSeconds / (24 * 60 * 60);
return {
user_id: userId,
time_to_convert_days: Math.round(durationDays * 10) / 10,
converted: true
};
}
return { user_id: userId, converted: false };
});
return results;
}Track Conversion Time as a Property
The cleanest approach is to measure the duration client-side and send it to Mixpanel as an event property.
Store the entry timestamp when users sign up
When users enter your funnel, store the current timestamp in localStorage or a session variable. Later, when they convert, you'll use this to calculate elapsed time.
// On signup, store the entry time
function handleSignUp(user) {
const entryTimestamp = Date.now();
localStorage.setItem('conversion_start_ms', entryTimestamp);
mixpanel.track('Sign Up', {
user_id: user.id,
email: user.email
});
}
// On purchase or conversion
function handlePurchase(order) {
const startMs = parseInt(localStorage.getItem('conversion_start_ms'), 10);
const elapsedMs = Date.now() - startMs;
const elapsedDays = elapsedMs / (1000 * 60 * 60 * 24);
mixpanel.track('Purchase', {
user_id: user.id,
amount: order.amount,
time_to_convert_days: Math.round(elapsedDays * 10) / 10
});
localStorage.removeItem('conversion_start_ms');
}Analyze the property in Segmentation or create a report
Once you're sending time_to_convert_days as a property, slice it in Segmentation or Reports. Group by the property to see a histogram of conversion times. Mixpanel calculates median, mean, and percentiles automatically.
// Query conversion time distribution via Segmentation API
const response = await fetch(
'https://mixpanel.com/api/2.0/segmentation?' +
'project_id=YOUR_PROJECT_ID&' +
'event=Purchase&' +
'on=time_to_convert_days&' +
'unit=day&' +
'from_date=2024-01-01&' +
'to_date=2024-12-31',
{
headers: {
'Authorization': 'Basic ' + btoa('SERVICE_ACCOUNT:PASSWORD')
}
}
);
const data = await response.json();
console.log('Conversion time breakdown:', data.data);Common Pitfalls
- Confusing drop-off rate with conversion time. Funnels show you what percentage of users convert, not how long it takes them. You need to explicitly look at the time breakdown.
- Forgetting JavaScript Date.now() returns milliseconds, not seconds like Mixpanel timestamps. Always divide by 1000 when comparing to Mixpanel event times.
- Only measuring converters. Non-converters skew your understanding of your funnel. Always calculate time to convert for all users, then filter by conversion status.
- Not accounting for timezone mismatches. If events are logged in UTC but you're calculating in a different timezone, timestamps can drift by hours.
Wrapping Up
You now have three ways to measure conversion time: using Mixpanel's built-in funnel analytics, calculating from exported events, or tracking it client-side as a property. This metric tells you whether users are activating quickly and how engaged they are before they pay. If you want to track conversion time automatically across Mixpanel, Amplitude, PostHog, and other tools from one dashboard, Product Analyst can help.