5 min read

How to Set Up Alerts for Churn Rate in PostHog

Churn rate matters more than most teams realize — by the time you notice users are leaving, it's often too late to intervene. PostHog lets you set threshold-based alerts on your churn metric so you get notified the moment something changes.

Track User Activity Events

PostHog tracks churn by analyzing how often users return to your product. Before you can alert on churn, you need clean event data.

Capture user events in your app

PostHog automatically tracks page views and identifies users. To get accurate churn metrics, make sure you're capturing relevant events that indicate active usage. Use posthog.capture() to track key actions like purchases, feature usage, or logins.

javascript
// Capture key user actions to track engagement
posthog.capture('feature_used', {
  feature_name: 'dashboard_view',
  user_tier: 'pro',
  timestamp: new Date()
});

// Or track subscription events
posthog.capture('subscription_renewed', {
  plan: 'annual',
  mrr: 99
});
Capture events that matter for your churn definition

Create Your Churn Insight

In PostHog, you'll build a Retention insight to measure how many users return over time, then use that to define your churn threshold.

Create a retention insight

Go to Insights and click + New insight. Choose Retention as your insight type. This shows you what percentage of users who performed an action in a given time period came back to perform that action again. A 70% retention rate means 30% churn.

javascript
// PostHog API query to create a retention insight
const response = await fetch('https://YOUR_POSTHOG_INSTANCE/api/projects/YOUR_PROJECT_ID/insights/', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${POSTHOG_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Monthly Churn Rate',
    insight: 'RETENTION',
    events: [{ id: 'page_view', type: 'events' }],
    retention_type: 'retention_first_time',
    retention_reference: 'start'
  })
});
const insight = await response.json();
Create a retention insight via the PostHog API

Configure your retention period

Set the retention period that matches your business model. For SaaS with monthly billing, check 30-day retention. For mobile apps, weekly might make more sense. PostHog will show you retention buckets (Day 0, Day 7, Day 30, etc.) so you can see the trend.

Tip: Retention is the inverse of churn. If 75% of users return after 30 days, your 30-day churn rate is 25%.

Set Up Threshold-Based Alerts

Once you have your retention insight, configure alerts so you're notified when churn exceeds your threshold.

Add your insight to a dashboard

Navigate to your insight and click Add to dashboard, or go to a dashboard and add your retention insight card. This is where you'll configure the alert condition.

Configure the alert threshold

Click the insight card and look for Alerts. Set a condition like 'Alert when value drops below 70%' (meaning churn exceeds 30%). Choose your notification method: Slack, email, or webhook. PostHog evaluates this condition daily by default.

javascript
// Example webhook receiver to handle PostHog alerts
const handlePostHogAlert = async (req, res) => {
  const alert = req.body;
  
  if (alert.insight_name === 'Monthly Churn Rate' && alert.value < 0.7) {
    // Alert triggered: churn > 30%
    console.warn(`ALERT: Churn exceeded threshold. Retention: ${alert.value * 100}%`);
    
    // Send to your team
    await fetch('https://hooks.slack.com/services/YOUR/WEBHOOK/URL', {
      method: 'POST',
      body: JSON.stringify({
        text: `⚠️ Churn Alert: Retention dropped to ${alert.value * 100}%`
      })
    });
  }
  
  res.json({ ok: true });
};
Handle incoming churn alerts via webhook

Test and activate

Click Test on the alert configuration to verify it fires correctly. Once live, PostHog will check your churn metric on schedule and notify you if the threshold is crossed.

Watch out: PostHog's default retention uses 'first-time' events. If you want to track repeat engagement, use a specific event (like 'paid_action') instead of pageviews to avoid inflated retention numbers.

Common Pitfalls

  • Using pageviews as your retention event — this inflates retention metrics. Use meaningful actions (purchases, logins, feature usage) instead.
  • Setting thresholds too high and ignoring alerts. A 90% retention threshold will fire constantly. Match your baseline to your historical data.
  • Forgetting to segment by plan or cohort. Enterprise churn looks different from free-tier churn. Create separate insights for each segment.
  • Not accounting for seasonality. Q4 often has worse churn due to budget freezes. Use a rolling average rather than daily alerts to avoid false positives.

Wrapping Up

You now have a churn rate alert running in PostHog that will notify you the moment your retention drops. This gives you time to act before you lose more users. If you want to track churn automatically across multiple analytics tools and correlate it with behavioral changes, Product Analyst can help.

Track these metrics automatically

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

Try Product Analyst — Free