Engineering Architecture

Reduce Churn with PostHog: The Engineering-Led Playbook

A cancellation is a lagging indicator. In this technical deep dive, we show you how to use PostHog to build an early warning system using HogQL risk scoring, session replay triggers, and behavioral workflows.

Jake McMahon 26 min read Jake McMahon Published March 28, 2026

TL;DR

  • Detection: Use HogQL to calculate "Engagement Velocity" (e.g., 30% drop in core activity) to flag at-risk accounts before they cancel.
  • Diagnosis: Set Recording Triggers for `rage_click` or `error_event` on the billing page to find silent friction points.
  • Prevention: Deploy multivariate feature flags to offer "Value Discovery" tours or immediate "Price Bridges" to at-risk cohorts.
  • B2B Architecture: Implement Group Analytics to track health at the organization level, identifying Single-User Dependency risks.
  • Data Integrity: Always use a Reverse Proxy to ensure 100% data accuracy by bypassing ad-blockers.

In the world of B2B SaaS, a cancellation email is the end of a 60-day story. By the time a customer clicks "Cancel," their emotional and operational exit has already happened. To reduce churn, you must stop looking at your billing system and start looking at your event stream.

PostHog has emerged as the operating system for retention because it allows you to connect individual user behaviors to broad organizational health. In this guide, we will move past generic dashboarding and provide the exact technical blueprints for building a proactive churn reduction engine.

The goal of product analytics is to intervene at the signal of decay, not the event of departure.

1. Detection: Building the Early Warning System

The first goal is to identify at-risk users *before* they decide to leave. We use a combination of AI anomaly alerts and custom HogQL scoring.

HogQL Custom Risk Scoring

Standard retention charts often miss the "Slow Decay" of a power user. We use HogQL to calculate **Engagement Velocity**—the week-over-week change in usage of core value-driving features.

-- Identify users with >50% drop in core activity SELECT person_id, countIf(timestamp > now() - interval 7 day) as recent_events, countIf(timestamp BETWEEN now() - interval 14 day AND now() - interval 7 day) as prior_events, (recent_events - prior_events) / nullIf(prior_events, 0) as velocity FROM events WHERE event = 'core_feature_used' GROUP BY person_id HAVING velocity < -0.5

The "Dormant" Segment Trap

Monitor the **"Dormant"** lifecycle segment closely. A growing dormant segment is the strongest leading indicator of future churn. We save this segment as a **Dynamic Cohort** named `High Churn Risk` and use it as a trigger for both automated and human-led interventions.

2. Diagnosis: Understanding the "Why"

Once a risk is detected, you must find the friction point. We use targeted qualitative tools to avoid the noise of recording every session.

Session Replay Triggers

Recording every session is expensive and noisy. Instead, set **Recording Triggers** for friction events. For our client FormDR, we triggered recordings only when a `rage_click` occurred on the billing page or when an `error_event` fired during the EHR integration setup.

  • Rule 1: Record on `rage_click` or `error`.
  • Rule 2: Set a `minimum_duration` of 5 seconds to filter out bounces.
  • Rule 3: Capture console logs and network requests for faster debugging.

"A recording of a rage click on the 'Delete Account' page is worth more than 1,000 recordings of a successful login. Focus your qualitative energy on the exit path."

— Jake McMahon, ProductQuant

3. Prevention: Driving Behavioral Stickiness

In 2026, the most effective retention tools are **Behavioral Workflows** that bridge the gap between analytics and action.

Automated Re-engagement Workflows

When a user enters the `High Churn Risk` cohort, PostHog triggers a webhook to your CRM (HubSpot/Intercom). The Account Manager gets a Slack alert with the user's "Frustration History" (e.g., "Hit 3 API errors in 48 hours").

Multivariate Feature Flags for Win-Backs

We use feature flags to test different UI versions for at-risk users. If a user is in the `At-Risk` cohort, we might trigger a **"Value Discovery" flag** that highlights underused features or offers a "Price Bridge" (e.g., 50% off for 3 months) directly in-app.

40% Save Rate

By implementing reason-based winbacks and "Rescue" modals via PostHog feature flags, we achieved a 40% save rate on cancellation attempts for a Series B healthcare platform.

4. Technical Implementation Standards

Poor technical implementation leads to "Data Trust Churn." If your team doesn't trust the numbers, they won't act on them. We enforce three structural standards for all PostHog installs.

Standard Technical Implementation The Value
Reverse Proxy Managed or Cloudflare Worker Ensures 100% data accuracy vs ad-blockers.
Group Analytics `posthog.group()` Tracks health at the B2B organization level.
Custom Taxonomy `object_action` (snake_case) Ensures SQL stability and query-ready data.

B2B Group Analytics: The Critical Lever

In B2B, the individual user doesn't churn—the account churns. We use PostHog's Group Analytics to track **Multi-User Network Density**. If an account has 5 seats but only 1 active admin, that account is at extreme risk. If that admin leaves, the "Organizational Memory" of your product's value is gone.

FAQ

Should we use Autocapture for churn tracking?

No. Autocapture is great for discovery, but **always use Custom Events** for churn signals. You need precise triggers (e.g., `export_completed`) that won't break when a developer changes a CSS class or button label.

How do we handle PHI/PII in session recordings?

Use the `mask_all_element_attributes` flag and server-side event scrubbing. For healthcare clients, we typically recommend a **Private Cloud** deployment to ensure that behavioral data never leaves their compliance boundary.

Can PostHog predict churn?

Yes, by combining behavioral cohorts with Gradient Boosting models (ML). However, start with **Engagement Velocity SQL** (HogQL) first—it provides 70% of the value with 10% of the technical complexity.

Sources

Jake McMahon

About the Author

Jake McMahon is a PLG & GTM Growth Consultant who has migrated 1M+ events to PostHog, reduced tool costs by 90%, and helped Series A-C SaaS companies build clean, high-velocity retention engines. He specializes in connecting technical data layers to operational revenue outcomes.