Your conversion rate is dropping and you want to know immediately—not when you check your dashboard tomorrow. Mixpanel alerts let you monitor conversion metrics in real time and get notified when things go wrong. Here's how to set up alerts for conversion rate.
Track Conversion Events with the SDK
Before you can alert on conversion rate, you need to track the events that make up your funnel.
Install and Initialize Mixpanel
Add the Mixpanel JavaScript SDK to your app. Initialize it with your project token from Project Settings > Access Keys.
// npm install mixpanel-browser
import mixpanel from 'mixpanel-browser';
mixpanel.init('YOUR_PROJECT_TOKEN', {
debug: false,
track_pageview: true,
});
mixpanel.identify('user123');
console.log('Mixpanel initialized');Track Entry and Exit Points
Track when users start your funnel and when they convert. For an e-commerce site, track Product Viewed, Add to Cart, and Purchase. Use mixpanel.track() with properties that define the step.
// Track funnel entry
mixpanel.track('Product Viewed', {
'product_id': 'SKU-12345',
'product_name': 'Premium Plan',
'price': 99,
});
// Track intermediate step
mixpanel.track('Add to Cart', {
'product_id': 'SKU-12345',
'cart_value': 99,
});
// Track conversion
mixpanel.track('Purchase', {
'product_id': 'SKU-12345',
'revenue': 99,
'currency': 'USD',
});product_id and Product_Id are different properties.Build a Funnel and Measure Conversion Rate
With your events tracked, create a funnel in Mixpanel to calculate conversion rate at each step.
Create the Funnel
Go to Funnels in the left sidebar and click New Funnel. Name it 'Purchase Funnel'. Add your events in order: Product Viewed → Add to Cart → Purchase. Mixpanel calculates conversion rate automatically at each step.
// Query funnel data via Mixpanel Data API
const funnelResponse = await fetch(
'https://mixpanel.com/api/2.0/funnels?project_id=YOUR_PROJECT_ID&from_date=2026-03-20&to_date=2026-03-26',
{
headers: {
'Authorization': 'Basic ' + btoa('YOUR_SERVICE_ACCOUNT_TOKEN:'),
},
}
).then(r => r.json());
const funnel = funnelResponse[0];
const conversionRate = (funnel.data[0][funnel.data[0].length - 1] / funnel.data[0][0]) * 100;
console.log(`Conversion Rate: ${conversionRate.toFixed(2)}%`);Set Your Baseline Threshold
Look at your conversion rate over the last 30 days. If it's typically 5%, you might set an alert threshold at 3–4% to catch real drops without constant false alarms. Write down this baseline—you'll use it when configuring the alert.
// Calculate baseline conversion rate from historical data
const historicalData = await fetch(
'https://mixpanel.com/api/2.0/events/top?type=general&unit=day&limit=90',
{
headers: {
'Authorization': 'Basic ' + btoa('YOUR_SERVICE_ACCOUNT_TOKEN:'),
},
}
).then(r => r.json());
const avgConversionRate = historicalData.data.events
.filter(e => e.event === 'Purchase')
.reduce((sum, e) => sum + e.count, 0) / 90; // Average per day
console.log(`Baseline conversion rate: ${avgConversionRate.toFixed(2)}%`);
const alertThreshold = avgConversionRate * 0.6; // Alert at 60% of baseline
console.log(`Alert threshold: ${alertThreshold.toFixed(2)}%`);Configure and Test the Alert
Set up the alert to notify your team when conversion rate hits your threshold.
Enable Alerts on Your Funnel
In your funnel view, click the Alert button (bell icon). Select Conversion Rate as the metric. Set your threshold (e.g., 3%) and choose the operator (below, above, or changed by %). Choose how often to check: every hour, daily, or on a custom interval.
// Configure alert via Mixpanel REST API
const alertPayload = {
funnel_id: 'YOUR_FUNNEL_ID',
metric_type: 'conversion_rate',
threshold: 3,
comparison: 'less_than',
check_interval: 'hourly',
lookback_window: 24, // hours
};
const alertResponse = await fetch(
'https://mixpanel.com/api/2.0/funnels/YOUR_FUNNEL_ID/alerts',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('YOUR_SERVICE_ACCOUNT_TOKEN:'),
},
body: JSON.stringify(alertPayload),
}
).then(r => r.json());
console.log('Alert created:', alertResponse.alert_id);Choose Recipients and Notification Channel
Select where alerts go: Email, Slack, or Webhook. Add email addresses or Slack channel names. For critical metrics, use Slack so your team sees it immediately. Set alert frequency—alert on the first violation or require 3 violations in a row to reduce noise.
// Configure notification channels
const notificationConfig = {
email_recipients: ['[email protected]', '[email protected]'],
slack_channel: '#alerts',
slack_message_template: 'Conversion rate dropped to {{conversion_rate}}% (threshold: 3%)',
webhook_url: 'https://company.com/webhooks/mixpanel',
webhook_timeout_seconds: 5,
consecutive_violations_required: 1, // Alert immediately
};
await fetch(
'https://mixpanel.com/api/2.0/funnels/YOUR_FUNNEL_ID/alerts/YOUR_ALERT_ID',
{
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('YOUR_SERVICE_ACCOUNT_TOKEN:'),
},
body: JSON.stringify(notificationConfig),
}
);Common Pitfalls
- Not tracking all steps of your funnel consistently. If you track
Product ViewedandPurchasebut missAdd to Cart, your conversion rate is meaningless. - Forgetting that Mixpanel funnels require the same user to complete all steps within a 30-day window. Users who abandon carts drop out, skewing your conversion rate.
- Setting alert thresholds too high. If your baseline is 5% and you alert at 4%, you'll get daily false alarms. Start at 50% below your baseline and adjust upward.
- Confusing event-level and user-level conversion rates. Mixpanel counts events by default, not unique users, so 10 purchases from one user can look like a 100% conversion if only 10 product views happened.
Wrapping Up
You now have conversion rate alerts firing to your team immediately when something goes wrong. Combined with deeper dives into the Mixpanel dashboard, you can diagnose drop-offs fast. If you want to track this automatically across tools, Product Analyst can help.