Recipe: Referral Program
A step-by-step guide to designing a viral referral loop that converts free users into paying customers.
Ingredients
- Unique referral codes tied to user accounts
- Double-sided incentive structure
- Fraud detection rules
- Email or in-app share surface
- Attribution tracking pixel or webhook
Step 1 — Define the incentive
Pick a reward that costs you less than the LTV of a new customer. Common patterns: 1 month free for both parties, $10 account credit, or exclusive feature unlock. Keep it simple — one reward per successful conversion.
Step 2 — Generate codes
Issue a short, human-readable code per user (8-10 alphanumeric characters). Store it in your users table alongside a usage count and a cap (e.g., 10 successful referrals). Never use sequential IDs — they leak user counts.
Step 3 — Build the claim flow
Add a referral code field to your signup or checkout page. On successful payment, look up the code, validate it hasn't hit its cap, and credit both the referrer and the new user. Run this inside a database transaction to prevent double-crediting.
Step 4 — Fraud guardrails
Self-referrals are the most common abuse vector. Block claims where the referrer and referee share an IP, payment method fingerprint, or device ID. Rate-limit code usage to 3 claims per hour. Flag and review any account with >80% referral-sourced revenue.
Step 5 — Surface sharing
Give users a dashboard panel with their code, a copy button, and pre-built share links for email and Twitter. Show a live counter of successful referrals and rewards earned. Visibility drives participation.
Pro tip: The best referral programs don't feel like marketing. Frame the share action as “give a friend free access” rather than “earn a reward.” Altruism outperforms greed in click-through rates by 2-3x.