6 min read

How to Set Up Alerts for Retention Rate in Mixpanel

Retention rate is your early warning system for product health. If it's declining, you need to know immediately, not when you check your dashboard next week. Mixpanel lets you configure alerts that fire when retention dips below your target, so your team can respond before churn accelerates.

Create a Retention Report

Before you can alert on retention, you need to build a Retention report that tracks the metric you care about.

Navigate to Insights > Retention

Open Insights > Retention in your Mixpanel project. This shows you cohort-based retention—which users came back and when. This is the report you'll monitor with alerts.

javascript
// Ensure your events are consistently tracked for retention measurement
mixpanel.track('Sign Up', {
  'user_id': 'user_12345',
  'plan': 'free',
  'signup_source': 'organic'
});

// Track return visits (the metric that defines retention)
mixpanel.track('Dashboard Viewed', {
  'user_id': 'user_12345',
  'days_since_signup': 7
});
Retention depends on consistent event naming and user tracking

Set the starting and return actions

Define Starting Event (e.g., "Sign Up") and Return Event (e.g., "Dashboard Viewed" or "Purchase"). The retention metric tracks what percentage of users who triggered the starting event also triggered the return event.

javascript
// Example: Signal a meaningful return action
mixpanel.track('Purchase Completed', {
  'user_id': 'user_12345',
  'revenue': 99,
  'is_returning_customer': true,
  'days_since_first_signup': 14
});

mixpanel.track('Feature Used', {
  'user_id': 'user_12345',
  'feature_name': 'custom_reports',
  'session_id': 'sess_xyz'
});
Choose return events that indicate active product engagement

Choose your retention window

Select the interval you want to monitor: Day 1, Day 7, Day 30, etc. For SaaS, Day 7 retention is the sweet spot—it's stable enough to avoid noise but fast enough to catch problems early.

Configure Alert Rules

Once your retention report is set up, add an alert to get notified when retention drops.

Click Set Alert in the Retention view

Look for the Set Alert or Alert button in the top-right of your Retention report. This opens the alert configuration panel where you'll define the trigger condition.

javascript
// Use Mixpanel Data API to retrieve retention metrics programmatically
const fetchRetentionData = async () => {
  const response = await fetch(
    'https://data.mixpanel.com/api/2.0/retention',
    {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer YOUR_SERVICE_ACCOUNT_TOKEN'
      }
    }
  );
  
  const params = new URLSearchParams({
    from_date: '2026-03-19',
    to_date: '2026-03-26',
    retention_type: 'retention',
    born_event: 'JSON:{"event":"Sign Up"}',
    event: 'JSON:{"event":"Dashboard Viewed"}',
    interval: 7,
    unit: 'day'
  });
  
  return fetch(`https://data.mixpanel.com/api/2.0/retention?${params}`, {
    headers: { 'Authorization': 'Bearer YOUR_SERVICE_ACCOUNT_TOKEN' }
  }).then(res => res.json());
};

await fetchRetentionData();
The Data API lets you build custom alerting logic outside Mixpanel

Set your alert threshold

Configure the trigger: "Alert when Day 7 Retention drops below 35%" (or whatever your baseline is). You can also set relative thresholds like "more than 5% below last week." Be realistic about your product's baseline.

Choose notification channels

Send alerts to Email and/or Slack. If you have a critical product, set up a Webhook to your internal monitoring system so alerts can trigger runbooks or escalations automatically.

javascript
// Example: Receive and handle Mixpanel alert webhook
const express = require('express');
const app = express();

app.post('/webhooks/mixpanel-retention-alert', express.json(), (req, res) => {
  const { metric_name, value, threshold, alert_name } = req.body;
  
  console.log(`Alert: ${alert_name} - Retention is ${value}% (threshold: ${threshold}%)`);
  
  if (value < threshold) {
    // Trigger incident or notification
    notifyTeam({
      alert: alert_name,
      current_retention: value,
      threshold: threshold,
      timestamp: new Date().toISOString()
    });
  }
  
  res.status(200).json({ received: true });
});

app.listen(5000);
Webhooks integrate alerts with your incident response or ops system

Test and Validate

Before trusting an alert, make sure it's actually working and sending to the right place.

Review the alert configuration

Double-check the alert summary shows the correct metric, interval, threshold, and channels. Save the alert and wait 24 hours for Mixpanel to recalculate retention data.

Check Alert History

Go to Insights > Alerts or check your Slack channel to see when alerts fired and what retention value triggered them. This helps you determine if your threshold is too sensitive.

javascript
// Monitor alert firing frequency to tune thresholds
const trackAlertPerformance = (alertName, firingFrequency) => {
  // If firing more than 2-3 times per week, threshold is too low
  // If never firing, threshold might be too high
  
  console.log(`Alert "${alertName}" fired ${firingFrequency} times in last 30 days`);
  
  if (firingFrequency > 10) {
    console.warn('Too sensitive—consider raising threshold by 2-3 percentage points');
  } else if (firingFrequency === 0) {
    console.warn('Never fired—verify threshold is realistic for your baseline');
  }
};

trackAlertPerformance('Day 7 Retention Alert', 6); // Example: 6 fires in 30 days is reasonable
Track alert frequency to avoid alert fatigue or missed signals

Adjust threshold if needed

If you're drowning in alerts, raise the threshold. If you're not seeing alerts when retention actually dropped, lower it. Changes take effect on the next retention recalculation (daily).

Common Pitfalls

  • Forgetting that Mixpanel's retention cohorts recalculate daily—changes to your event tracking won't fix past cohorts, only new ones going forward
  • Setting the threshold based on industry benchmarks instead of your own product baseline—your target might differ significantly from competitors
  • Alerting on day 1 retention, which is extremely noisy and rarely actionable; day 7 or day 30 is more stable
  • Mismatching event names between your code and Mixpanel config—if you track 'user_login' but the alert looks for 'User Login', retention will calculate as zero

Wrapping Up

Now your team gets notified the moment retention starts slipping, not weeks later when churn has already hit your revenue. You've built an early warning system that catches product degradation before it spreads. If you want to centralize retention monitoring across all your analytics platforms in one place, Product Analyst can help.

Track these metrics automatically

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

Try Product Analyst — Free