7 min read

How to Set Up Retention Analysis in PostHog

Retention tells you if users come back. Are customers actually using your product after they sign up, or is churn killing your metrics? PostHog's Retention chart lets you define exactly which users to track and which actions signal they've returned—then shows you the pattern.

Track the events that matter

Retention analysis starts with two events: one for signup (your cohort start) and one for return (your success metric).

Capture signup and identify users

When a user signs up, call identify() with their user ID and relevant properties, then capture() the signup event. This creates the cohort you'll track in retention.

javascript
posthog.identify('user_12345', {
  email: '[email protected]',
  plan: 'pro',
  signup_date: new Date().toISOString()
});

posthog.capture('user_signed_up', {
  plan: 'pro',
  source: 'google_ads',
  country: 'US'
});
Identify the user and capture the signup event

Track engagement events that signal return

Define what "returning" means for your product. Log in? View a dashboard? Make a purchase? Capture it consistently so PostHog can measure if users do it again.

javascript
// Track return on login
posthog.capture('user_logged_in', {
  auth_method: 'google_oauth',
  device: 'web'
});

// Or track product engagement
posthog.capture('dashboard_opened', {
  dashboard_id: 'main',
  session_id: generateSessionId()
});
Pick one event that reliably signals the user returned
Watch out: Inconsistent user IDs break retention. If a user is sometimes user_12345 and sometimes [email protected], PostHog treats them as different people and your retention will be wrong.

Build the retention chart

Once events are flowing, configure the chart to track cohort behavior over time.

Go to Insights > Retention

Open Insights in the left sidebar, then click the Retention tab at the top. PostHog loads a blank retention chart.

Select your starting and returning actions

Set Starting action to user_signed_up (this defines Day 0). Set Returning action to user_logged_in or dashboard_opened (whatever signals engagement). Choose Day, Week, or Month for the time period.

javascript
// The PostHog UI will now show:
// Starting action: user_signed_up (Day 0)
// Returning action: user_logged_in
// Time period: Day
// This generates a heatmap of Day 0 → Day 1, 7, 14, etc.
PostHog chart configuration (UI-based, SDK events already captured)

Interpret the retention heatmap

Green cells = high retention, red = low. Read left-to-right: Day 0 is 100% (all signups), Day 1 might be 40% (40% returned), Day 30 might be 15% (churn accelerates). This guides where to focus: low Day 1 means onboarding is broken; low Day 30 means engagement dies after first month.

Tip: Wait 1-2 days after launching before trusting Day 1 retention. Data arrival delays can make Day 1 look worse than it is.

Filter and compare cohorts

Drill into segments to find which users stick around and which churn fast.

Filter by user properties

Click Add filter in the retention chart. Filter by plan = pro to see if paid customers retain better, or by source = organic to compare acquisition channels. The chart re-runs showing only users matching that filter.

javascript
// Your signup event already has these properties
posthog.capture('user_signed_up', {
  plan: 'pro',           // Filter by this
  source: 'google_ads',  // Filter by this
  country: 'US',         // Filter by this
  monthly_users: 50000   // Filter by this
});

// In PostHog UI, set filter: plan = 'pro'
// Now the retention chart shows only pro users
Capture properties you'll filter by later

Export retention data

Once you're confident in the trend, export the retention data as CSV or embed the chart on a dashboard. Most teams review retention weekly alongside churn and engagement metrics.

Watch out: Filters change your baseline. If you filter by plan='pro' *after* loading the chart, Day 0 still shows all signups—only later days filter to pro. To compare fairly, filter before you read the numbers.

Common Pitfalls

  • Misidentifying users across sessions breaks everything. If user_12345 on Day 0 is a different ID on Day 1, PostHog treats them as new and retention plummets.
  • Picking the wrong returning event. If you choose 'page_view' and your SPA only fires page_view on initial load, returning users won't show up. Pick an event users actually trigger repeatedly.
  • Trusting incomplete data. If today is Day 1 and some users' return events haven't arrived yet, Day 1 retention looks worse than it is. Always wait a full day before pulling retention into reports.
  • Filtering by properties *after* creating the chart hides the baseline. Always think: 'Do I want to see retention of [this segment], or retention overall?'

Wrapping Up

You now have a retention chart showing when users churn. Use it to decide what to build: if Day 1 retention is terrible, fix onboarding; if Day 7 crashes, fix engagement. Watch the trend monthly to see if changes work. 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