Conversion rate is the metric that usually matters most, so the last thing you want is to miss a sudden drop. PostHog lets you build a funnel, track it, and set up alerts that fire when conversion rate dips below your threshold. You'll catch problems before they become expensive.
Track Your Conversion Events
PostHog needs to know what counts as a conversion. You'll capture two events: the starting action and the completion action.
Initialize PostHog and capture the starting event
Load the PostHog SDK and fire an event when the conversion funnel begins (e.g., user lands on pricing). Use posthog.capture() to send the event with relevant properties.
import posthog from 'posthog-js'
posthog.init('phc_your_api_key', {
api_host: 'https://app.posthog.com',
})
// Fire when conversion funnel starts
posthog.capture('pricing_viewed', {
plan_interest: 'pro',
source: 'search'
})Capture the conversion completion event
When the user completes the desired action (e.g., subscribes), fire a second event. Include properties like plan type and revenue so you can slice by segment later.
// Fire when user completes conversion
posthog.capture('purchase_completed', {
plan: 'pro',
amount: 99,
billing_cycle: 'monthly'
})Create a Funnel and Alert
Build the funnel in PostHog's UI, then set a threshold alert that notifies you when conversion rate drops.
Create the funnel in PostHog
In PostHog, go to Insights and click New insight > Funnel. Add pricing_viewed as step 1, then purchase_completed as step 2. PostHog calculates the conversion rate automatically.
Set the alert threshold
In your funnel view, click the Alerts button. Choose Create alert and set the threshold (e.g., alert if conversion rate drops below 5%). Select your notification channel: Email, Slack, or webhook.
// Create alert programmatically via PostHog's subscriptions API
const alertConfig = {
subscribed_type: 'insight_alert',
threshold: 5, // Alert if conversion rate drops below 5%
comparison: 'less_than',
insight_id: 'your-funnel-id', // Get this from the funnel URL
}
const response = await fetch(
'https://app.posthog.com/api/projects/YOUR_PROJECT_ID/subscriptions/',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${POSTHOG_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(alertConfig),
}
)
const alert = await response.json()
console.log('Alert created with ID:', alert.id)Test the alert
Temporarily set the threshold to 99% to trigger the alert immediately. Verify you receive the notification, then adjust back to your actual threshold (e.g., 5%). This confirms your notification channel works.
Monitor and Refine
Once your alert is live, keep it tuned to your business.
Review alert history
In the funnel view, check the Alert history tab. See which thresholds fire most often. If you're getting alerts weekly, either raise the threshold or investigate why conversion rate is volatile.
Compare periods to avoid false positives
PostHog can alert on week-over-week or day-over-day changes instead of fixed thresholds. This helps avoid false alarms from seasonal shifts. In the alert settings, choose Comparison type > Compared to previous period.
// Update alert to compare to previous period
const updateAlertPayload = {
comparison: 'relative',
comparison_period: 'previous_week', // Compare this week to last week
threshold: 20, // Alert if conversion rate is 20% lower than last week
}
const updateResponse = await fetch(
`https://app.posthog.com/api/projects/YOUR_PROJECT_ID/subscriptions/ALERT_ID/`,
{
method: 'PATCH',
headers: {
'Authorization': `Bearer ${POSTHOG_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(updateAlertPayload),
}
)
const updatedAlert = await updateResponse.json()
console.log('Alert updated:', updatedAlert)Common Pitfalls
- Event capture inconsistencies tank your conversion rate accuracy. If
pricing_viewedfires butpurchase_completedis sporadic, you'll get false low conversion rates. - Fixed thresholds can create noise in seasonal businesses. Weekends, holidays, and new feature launches naturally depress conversion. Use week-over-week alerts instead.
- PostHog funnels require both events from the same user in the same session (or at least the same user ID). Cross-domain funnels or multi-session flows may not calculate correctly.
- Too many alert channels (Slack + email + webhook) lead to alert fatigue. Pick one primary channel for triage, one secondary for escalation.
Wrapping Up
You now have real-time visibility into conversion rate and will catch drops before they compound. Adjust your threshold based on what fires repeatedly. If you want to track this automatically across multiple tools and products, Product Analyst can help.