Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Cohort analysis is the gold standard for measuring long-term referral program impact. It answers the most important question: do referred users retain better and spend more than users acquired through other channels? Mixpanel's cohort analysis tools, combined with GrowSurf referral data, let you track referred user cohorts over time and prove the true lifetime value of your referral program.
This guide covers building referral cohort analyses in Mixpanel, comparing referred vs. organic user retention, tracking cohort revenue over time, and using cohort insights to optimize your referral program targeting and rewards.
Ensure every user in Mixpanel has the properties needed for cohort segmentation.
acquisition_channel β "referral", "organic", "paid", "social", etc.referred_by β referrer's email (empty for non-referred users)referral_program_join_date β timestamp of program enrollmentfirst_referral_date β when they made their first referralacquisition_channel on ALL users enables meaningful comparisonsCreate a retention analysis comparing referred users to organic users.
acquisition_channel to compare referral vs. organic vs. paidTrack how referred user cohorts generate revenue over time compared to other channels.
acquisition_channelGroup referral participants by their join month to track program quality over time.
referral_program_join_date as the cohort entry dateCreate a Mixpanel dashboard that tracks referred user quality metrics.
Turn cohort analysis findings into program improvements.
// Set cohort-ready properties in Mixpanel for all users
async function setUserAcquisitionProperties(userEmail, source, referrerEmail = null) {
mixpanel.people.set_once(userEmail, {
// set_once ensures these are only set on first call
acquisition_channel: source, // 'referral', 'organic', 'paid', etc.
referred_by: referrerEmail || '',
signup_date: new Date().toISOString(),
signup_cohort: new Date().toISOString().slice(0, 7) // '2026-02'
});
}
// When processing GrowSurf webhook for new referred user
app.post('/api/growsurf-cohort-tracking', async (req, res) => {
const { event, participant, referrer } = req.body;
if (event === 'PARTICIPANT_CREATED' || event === 'PARTICIPANT_REFERRED') {
// Set acquisition properties for the participant
const isReferred = !!referrer;
await setUserAcquisitionProperties(
participant.email,
isReferred ? 'referral' : 'organic',
referrer?.email
);
// Track the referral join as a cohort-able event
mixpanel.track('Referral Cohort Entry', {
distinct_id: participant.email,
cohort_month: new Date().toISOString().slice(0, 7),
acquisition_channel: isReferred ? 'referral' : 'organic',
referrer_tier: getReferralTier(referrer?.referralCount || 0)
});
}
res.json({ success: true });
});
// Mixpanel Retention Analysis Query (JQL example)
// Compare 30-day retention: referred vs organic
const retentionQuery = `
function main() {
return join(
Events({ from_date: '2026-01-01', to_date: '2026-02-28',
event_selectors: [{ event: 'Sign Up' }] }),
Events({ from_date: '2026-01-01', to_date: '2026-03-31',
event_selectors: [{ event: 'Active Session' }] }),
{ type: 'inner', selectors: [{ selector: 'user.acquisition_channel' }] }
).groupBy(['acquisition_channel'], mixpanel.reducer.retention());
}`;Never analyze referred user cohorts in isolation. Always compare against a well-matched control group (organic users who signed up in the same period). Without a comparison, you can't determine whether referral program users are actually different or just reflecting broader trends.
Referred users may perform better not because of the referral itself but because they were pre-qualified by someone who knows your product. When reporting cohort results, acknowledge this selection bias. The referral program's value includes both the referral channel benefit AND the pre-qualification benefit.
Short-term retention (7-30 days) may look similar between referred and organic users. The real differences often emerge at 3-6 months. Run your cohort analysis over at least 6 months before drawing conclusions about LTV differences. Set up automated monthly reports that extend the analysis window.
Wait for at least 3 months of cohort data before making strategic decisions. You need enough time for retention patterns to emerge and enough users in each cohort for statistical significance. For LTV analysis, 6-12 months is ideal. For basic engagement comparisons, 30-60 days can give early directional signals.
Yes. Create cohorts segmented by the referred_by property or by referrer tier. This shows whether users referred by power referrers retain better than those referred by one-time referrers. This insight helps you decide whether to invest in nurturing power referrers vs. acquiring new referrers.
Set the acquisition_channel to "referral" for any user who arrived via a GrowSurf referral link, regardless of other touchpoints. The referral was the explicit channel of acquisition. You can add a secondary property also_touched_by_ads for multi-touch analysis.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
