Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Segment is the central hub of your data infrastructure β every customer interaction should flow through it, and your referral program is no exception. By routing GrowSurf referral events through Segment, you automatically distribute referral data to every tool in your stack: analytics platforms, CRMs, email tools, data warehouses, and more. One integration replaces dozens.
This guide shows you how to send GrowSurf referral events to Segment using the Track and Identify APIs. You'll learn how to structure referral events for maximum downstream utility, set up identity resolution for referred users, and configure Segment destinations to route referral data where it needs to go.
Plan which GrowSurf events to track in Segment and what properties to include with each event.
Referral Program Joined β when a participant is createdReferral Made β when a participant refers someoneReferral Converted β when a referred user convertsReferral Reward Earned β when a participant earns a rewardparticipant_id, campaign_id, referral_code, timestampCreate a webhook handler that receives GrowSurf events and forwards them to Segment's Track API.
npm install @segment/analytics-nodeUse Segment's Identify call to enrich user profiles with referral data so downstream tools have complete context.
analytics.identify() alongside each Track eventreferral_source, referred_by, referral_code, referral_countacquisition_channel trait to "referral"Enable the Segment destinations where referral data should flow.
Use Segment's Debugger and Protocols to ensure referral events are structured correctly.
Use the referral data flowing through Segment to build analytics across your connected tools.
// Send GrowSurf events to Segment
const { Analytics } = require('@segment/analytics-node');
const analytics = new Analytics({ writeKey: process.env.SEGMENT_WRITE_KEY });
app.post('/api/growsurf-to-segment', async (req, res) => {
const { event, participant, referrer } = req.body;
// Map GrowSurf events to Segment events
const eventMap = {
'PARTICIPANT_CREATED': 'Referral Program Joined',
'PARTICIPANT_REFERRED': 'Referral Made',
'CAMPAIGN_REFERRAL_CONVERTED': 'Referral Converted'
};
const segmentEvent = eventMap[event];
if (!segmentEvent) return res.json({ skipped: true });
// Identify the participant with referral traits
analytics.identify({
userId: participant.email,
traits: {
email: participant.email,
firstName: participant.firstName,
lastName: participant.lastName,
referral_code: participant.referralCode,
referral_count: participant.referralCount || 0,
referral_source: 'growsurf',
referred_by: referrer?.email || null,
acquisition_channel: referrer ? 'referral' : 'organic'
}
});
// Track the referral event
analytics.track({
userId: participant.email,
event: segmentEvent,
properties: {
participant_id: participant.id,
referral_code: participant.referralCode,
campaign_id: participant.campaignId,
referrer_email: referrer?.email,
referrer_id: referrer?.id,
referrer_referral_count: referrer?.referralCount,
timestamp: new Date().toISOString()
}
});
await analytics.flush();
res.json({ success: true, event: segmentEvent });
});Use consistent event naming across all your Segment sources. If you already track "User Signed Up" from your app, your GrowSurf "Referral Program Joined" event should follow the same naming convention (Title Case, past tense). This makes cross-source analysis much easier.
Always set an acquisition_channel trait on the Identify call for referred users. This single trait lets every downstream tool segment users by acquisition channel β enabling referral vs. organic comparisons across your entire stack without custom integration work.
Define a tracking plan for your referral events in Segment Protocols. This catches schema violations (missing properties, wrong types) before bad data reaches downstream tools. Data quality issues in referral tracking are hard to fix retroactively, so prevent them upfront.
Segment saves you from building and maintaining separate integrations for each downstream tool. One webhook handler sends data to Segment, and Segment distributes it to 300+ destinations automatically. If you add a new analytics tool or CRM, you just enable the destination β no new code needed.
Use Segment's anonymous ID for users who clicked a referral link but haven't created an account. When they sign up, call analytics.alias() to merge their anonymous activity with their identified profile. This gives you a complete view of the referral journey from click to conversion.
Not directly from Segment, but you can use Segment's webhook destination to call GrowSurf's API when specific events occur. For example, when a "Payment Completed" event flows through Segment, use a webhook destination to call GrowSurf's participant conversion endpoint.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
