← View All Guides
Mixpanel logo
Integration Guide

How to Track Referral Cohorts in Mixpanel with GrowSurf

Build cohort analyses in Mixpanel that compare referred vs. organic user behavior and retention.

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.

Integration Steps

Step 1: Set Up Cohort-Ready User Properties

Ensure every user in Mixpanel has the properties needed for cohort segmentation.

  • Set these user profile properties for all users (not just referral participants):
    • acquisition_channel β€” "referral", "organic", "paid", "social", etc.
    • referred_by β€” referrer's email (empty for non-referred users)
    • referral_program_join_date β€” timestamp of program enrollment
    • first_referral_date β€” when they made their first referral
  • These properties should be set at user creation and never overwritten
  • Having acquisition_channel on ALL users enables meaningful comparisons

Step 2: Build a Retention Cohort for Referred Users

Create a retention analysis comparing referred users to organic users.

  • Go to Retention in Mixpanel
  • Set the cohort entry event: "Sign Up" or "Account Created"
  • Set the return event: "Active Session" or "Key Action Performed"
  • Segment by acquisition_channel to compare referral vs. organic vs. paid
  • Analyze weekly or monthly retention curves for each acquisition channel

Step 3: Create Revenue Cohort Analysis

Track how referred user cohorts generate revenue over time compared to other channels.

  • Create a retention chart with "Purchase" or "Subscription Created" as the return event
  • Use revenue (sum of purchase amounts) as the measure instead of user count
  • Segment by acquisition_channel
  • This shows whether referred users spend more over their lifetime

Step 4: Analyze Referral Program Cohorts by Month

Group referral participants by their join month to track program quality over time.

  • Create a cohort using referral_program_join_date as the cohort entry date
  • Track: referral rate (what % made at least one referral), conversion rate, retention
  • Compare monthly cohorts to see if program changes improved or reduced quality
  • Identify seasonal patterns in referral program participation

Step 5: Build a Referred-User Quality Dashboard

Create a Mixpanel dashboard that tracks referred user quality metrics.

  • Key metrics:
    • 7-day, 30-day, and 90-day retention for referred vs. organic users
    • Average revenue per user by acquisition channel
    • Feature adoption rate for referred vs. organic users
    • Time-to-first-purchase for referred vs. organic users
  • Update monthly and share with program stakeholders

Step 6: Use Cohort Insights to Optimize Your Program

Turn cohort analysis findings into program improvements.

  • If referred users have higher retention: increase referral program investment, cite data in budget discussions
  • If referred users have lower retention: investigate referral quality, tighten eligibility, improve referred user onboarding
  • If certain referrer segments produce higher-quality referrals: reward those referrers more generously
  • If certain months show better cohort quality: understand what changed and replicate it

Code Snippets

// 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());
}`;

Tips

Always Compare Against a Control Group

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.

Account for Selection Bias in Referral Cohorts

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.

Track Cohorts Long Enough to See LTV Differences

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.

FAQ

How long should I wait before drawing conclusions from referral cohort data?

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.

Can I track individual referrer quality through cohort analysis?

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.

How do I handle users who were referred but also saw paid ads?

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.

Set up your refer a friend program with customer referral and affiliate program software that lowers your acquisition costs, increases customer loyalty, and saves you gobs of time.

Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies