← View All Guides
Amplitude logo
Integration Guide

How to Track Referral Events in Amplitude with GrowSurf

Send GrowSurf referral events to Amplitude for product analytics and user behavior insights.

Amplitude helps product teams understand how users behave β€” and understanding how referred users behave differently from organic users is one of the most valuable insights for your growth strategy. By sending GrowSurf referral events to Amplitude, you can analyze the complete referred user journey, compare feature adoption between acquisition channels, and measure how your referral program affects product engagement.

This guide covers integrating GrowSurf referral events with Amplitude's analytics platform, setting up user properties for referral segmentation, and building analytics charts that reveal actionable insights about your referral program's impact on product usage.

Integration Steps

Step 1: Set Up GrowSurf Event Tracking in Amplitude

Configure the data pipeline that sends referral events from GrowSurf to Amplitude.

  • Get your Amplitude API Key from Settings > Projects > [Your Project]
  • Use Amplitude's HTTP V2 API for server-side event tracking
  • Map GrowSurf events to Amplitude events:
    • PARTICIPANT_CREATED β†’ "Referral Program Joined"
    • PARTICIPANT_REFERRED β†’ "Referral Made"
    • CAMPAIGN_REFERRAL_CONVERTED β†’ "Referral Converted"
  • Use the participant's email as the user_id for consistent identity

Step 2: Enrich User Properties with Referral Data

Set user properties in Amplitude that enable referral-based segmentation across all your analytics.

  • Set user properties via the Identify API:
    • acquisition_channel β€” "referral" or "organic"
    • referred_by β€” referrer email
    • referral_code β€” participant's unique code
    • total_referrals β€” number of referrals made
    • referral_tier β€” new, active, power, champion
  • Use $setOnce for acquisition properties that shouldn't change
  • Use $set for dynamic properties like total_referrals that update

Step 3: Build Referral Event Charts

Create Amplitude charts that visualize referral program activity and trends.

  • Go to Charts > New Chart
  • Create a segmentation chart showing daily "Referral Made" events over time
  • Break down by referral_tier to see which tier of referrers is most active
  • Create a bar chart showing referral events by day of week to find optimal sharing days
  • Add funnel chart: Program Joined β†’ First Share β†’ Friend Signed Up β†’ Converted

Step 4: Compare Referred vs. Organic User Behavior

Use Amplitude's segmentation to compare how referred users engage with your product differently.

  • Create a behavioral cohort: users where acquisition_channel = "referral"
  • Compare against all users or organic users specifically
  • Analyze: feature adoption rate, session frequency, key action completion rate
  • Use Amplitude's Compass feature to find features that correlate with retention for each cohort

Step 5: Integrate with Amplitude Experiment for A/B Testing

Use Amplitude Experiment to test referral program variations with product analytics tracking.

  • Create experiments for: reward amount, referral page design, onboarding flow for referred users
  • Use Amplitude's statistical engine to determine winners
  • Track not just referral conversion but downstream product engagement for each variant
  • This connects referral program optimization with product metrics β€” not just marketing metrics

Step 6: Set Up Automated Insights and Alerts

Configure Amplitude to notify you of significant changes in referral metrics.

  • Set up Amplitude Insights (anomaly detection) on referral events
  • Create alerts for: unusual drops in referral volume, conversion rate changes, user property distribution shifts
  • Monitor "Referral Program Joined" event trends for program growth tracking
  • Set up weekly automated reports sent to stakeholder email addresses

Code Snippets

// Send GrowSurf events to Amplitude HTTP V2 API
const axios = require('axios');

const AMPLITUDE_API_KEY = process.env.AMPLITUDE_API_KEY;

async function trackAmplitudeEvent(userId, eventType, eventProperties, userProperties) {
  await axios.post('https://api2.amplitude.com/2/httpapi', {
    api_key: AMPLITUDE_API_KEY,
    events: [{
      user_id: userId,
      event_type: eventType,
      event_properties: eventProperties,
      user_properties: {
        $set: userProperties.set || {},
        $setOnce: userProperties.setOnce || {}
      },
      time: Date.now()
    }]
  });
}

app.post('/api/growsurf-to-amplitude', async (req, res) => {
  const { event, participant, referrer } = req.body;

  const isReferred = !!referrer;

  switch (event) {
    case 'PARTICIPANT_CREATED':
      await trackAmplitudeEvent(
        participant.email,
        'Referral Program Joined',
        {
          referral_code: participant.referralCode,
          campaign_id: participant.campaignId,
          is_referred: isReferred
        },
        {
          setOnce: {
            acquisition_channel: isReferred ? 'referral' : 'organic',
            referred_by: referrer?.email || null,
            referral_signup_date: new Date().toISOString()
          },
          set: {
            referral_code: participant.referralCode,
            referral_participant: true
          }
        }
      );
      break;

    case 'PARTICIPANT_REFERRED':
      // Track for the referrer
      await trackAmplitudeEvent(
        referrer.email,
        'Referral Made',
        {
          referred_email: participant.email,
          referral_number: referrer.referralCount
        },
        {
          set: {
            total_referrals: referrer.referralCount,
            referral_tier: getReferralTier(referrer.referralCount)
          }
        }
      );
      break;
  }

  res.json({ success: true });
});

Tips

Use $setOnce for Acquisition Properties

Always use Amplitude's $setOnce operator for acquisition_channel and referred_by properties. This ensures the original acquisition source is preserved even if the user later participates in the referral program as a referrer. Overwriting acquisition data corrupts your cohort analysis.

Track Referral Events Alongside Product Events

The real power of Amplitude + GrowSurf isn't just tracking referral events β€” it's analyzing referral events alongside product usage events. You can answer questions like: "Do users who make referrals also use more features?" and "Does being referred correlate with faster onboarding?"

Use Amplitude's Behavioral Cohorts for Targeting

Create behavioral cohorts in Amplitude based on referral activity, then sync these cohorts to your marketing tools (via Amplitude's integrations) for targeted campaigns. For example, sync a "Power Referrers" cohort to your email tool for VIP messaging.

FAQ

Can I use Amplitude's client-side SDK for referral event tracking instead of server-side?

You can use client-side tracking for some events (like referral link clicks and share button clicks), but server-side tracking via webhooks is more reliable for conversion events. The best approach is both: client-side for user interaction events and server-side (from GrowSurf webhooks) for business events like referral conversions.

How do I merge anonymous and identified user events in Amplitude?

Use Amplitude's user_id and device_id for identity resolution. Track anonymous referral link clicks with a device_id. When the user signs up, send an identify event that maps the device_id to their user_id. Amplitude automatically merges the event histories, giving you the full journey from link click to sign-up.

What's the best way to A/B test referral program changes with Amplitude?

Use Amplitude Experiment to run controlled experiments. Create two variants of your referral program (e.g., different reward amounts) and assign users to variants. Track all referral events with the variant as an event property. Amplitude's statistical engine determines which variant performs better across all your product metrics, not just referral metrics.

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