Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Customer.io's power lies in its event-driven data model β every action a user takes can be tracked as an event and used to trigger campaigns, build segments, and analyze behavior. By sending GrowSurf referral events to Customer.io, you create a complete picture of each user's referral journey that powers intelligent automation and precise targeting.
This guide focuses on the data architecture side of the Customer.io + GrowSurf integration. You'll learn how to structure referral events, set up customer attributes, build event-based segments, and create data-driven campaigns that respond to referral behavior in real time.
Design the events and attributes you'll track to ensure maximum utility for segmentation and campaigns.
referral_program_joined β with attributes: campaign_name, sourcereferral_shared β with attributes: share_method (email, social, link)referral_friend_signed_up β with attributes: friend_email, referral_codereferral_converted β with attributes: conversion_value, productreferral_reward_claimed β with attributes: reward_type, reward_valuereferral_code, referral_link, total_referrals, referral_tier, referred_byBuild the integration that sends GrowSurf events to Customer.io's Track API.
track endpoint to record eventsidentify endpoint to create/update customer profilesCreate Customer.io segments using referral events for precise campaign targeting.
total_referrals >= 5referred_by exists AND did NOT perform "purchase"Build campaigns that use event data for intelligent triggering and personalization.
total_referrals = 1 (first referral ever)Use Customer.io's outgoing webhooks to trigger actions in GrowSurf or other tools based on Customer.io campaign engagement.
Use Customer.io's analytics to understand referral behavior patterns.
// Complete Customer.io event tracking for GrowSurf
const { TrackClient, RegionUS } = require('customerio-node');
const cio = new TrackClient(
process.env.CIO_SITE_ID,
process.env.CIO_API_KEY,
{ region: RegionUS }
);
// Event tracking with rich attributes
async function trackReferralEvent(participant, eventName, extraData = {}) {
// Ensure customer profile exists with latest data
await cio.identify(participant.email, {
email: participant.email,
first_name: participant.firstName,
last_name: participant.lastName,
referral_code: participant.referralCode,
referral_link: participant.shareUrl,
total_referrals: participant.referralCount || 0,
referral_tier: getReferralTier(participant.referralCount || 0)
});
// Track the specific event
await cio.track(participant.email, {
name: eventName,
data: {
campaign_id: participant.campaignId,
referral_code: participant.referralCode,
...extraData,
tracked_at: Math.floor(Date.now() / 1000)
}
});
}
function getReferralTier(count) {
if (count >= 10) return 'champion';
if (count >= 5) return 'power_referrer';
if (count >= 1) return 'active';
return 'new_participant';
}
// Webhook handler with complete event mapping
app.post('/api/growsurf-to-cio', async (req, res) => {
const { event, participant, referrer } = req.body;
switch (event) {
case 'PARTICIPANT_CREATED':
await trackReferralEvent(participant, 'referral_program_joined', {
referred_by: referrer?.email,
source: referrer ? 'referral' : 'organic'
});
break;
case 'PARTICIPANT_REFERRED':
// Track for the referrer
await trackReferralEvent(referrer, 'referral_friend_signed_up', {
friend_email: participant.email,
friend_name: participant.firstName
});
break;
case 'CAMPAIGN_REFERRAL_CONVERTED':
await trackReferralEvent(participant, 'referral_converted', {
referrer_email: referrer?.email
});
break;
}
res.json({ success: true });
});When possible, track how participants share their referral links (email, Twitter, Facebook, WhatsApp, link copy). This data reveals which sharing channels drive the most conversions, letting you promote the most effective sharing methods in your referral emails and prompts.
Build a referral engagement score based on event frequency. A participant who shares once is less engaged than one who shares weekly. Use Customer.io's event count and recency in your segment definitions to differentiate between one-time participants and consistent advocates.
When you first set up the integration, backfill historical GrowSurf participant data into Customer.io using GrowSurf's API. This ensures your segments and campaigns have accurate data from day one, not just from the integration start date.
Events are timestamped actions ("referral_made at 2pm on Jan 5") that can trigger campaigns and be counted in segments ("performed X event in last 30 days"). Attributes are persistent properties on a customer profile ("total_referrals = 5") that are always current. Use events for tracking behavior and attributes for current state.
Customer.io supports anonymous events using a device ID. When someone clicks a referral link, track the event with an anonymous identifier. When they later sign up and you identify them, merge the anonymous and identified profiles to get the complete journey. This requires client-side JavaScript tracking.
Customer.io retains event data based on your plan β typically 90 days to unlimited. Attributes on customer profiles are retained indefinitely. For long-term referral analytics, store aggregated data in attributes (total_referrals, first_referral_date) rather than relying on event queries for historical data.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
