What are we building?

A referral marketing program! If someone loves your product, they should be referring their friends an colleagues. We're going to build an easy way for then to do that. Here's what our referral marketing program will look like:
  • Everytime a user signs up to our product, we'll generate a unique URL that they can share.
  • If someone signs up through their link, we'll let them know their friend has signed up.
  • We'll keep track of the number of total referrals every user has made
  • At different milestones (5 referrals, 10 referrals, 1000 referrals), we'll send the users cool stuff
For a good introduction to referral marketing, check out this piece on how Morning Brew (a newsletter) built an audience of 1.5M.

Roadmap

Intro

What are we building?

Referral database

Setup Airtable
Leaderboard view

Connecting signups to DB

Auth0 lock setup
Setup ref parameter
Sending sign up from auth0 to email marketing system

The program

Connecting to referral database 💥
Referral email
Emails for a milestone
 

Improvements [time permit]

Random ref parameter

Conclusion

Next week: creating a referral page for each user using Webflow CMS
 

Viewer asks

→ Could we do with a newsletter?
 

Ressources

→ Code snippet for intercom ←→ Auth0
 
function (user, context, callback) { var moment = require('moment-timezone'); user.user_metadata = user.user_metadata || {}; var data = { "user_id": user.user_id, "email": user.email, "name": user.name, "custom_attributes" : { "ref" : user.user_metadata.ref }, "signed_up_at": moment(user.created_at).unix(), "last_seen_ip" : context.request.ip, "last_seen_user_agent": context.request.userAgent, "update_last_request_at": true, "new_session": true }; var accessToken = ''; request.post({ url: 'https://api.intercom.io/users', headers: { 'Authorization': 'Bearer ' + accessToken, 'Accept': 'application/json' }, json: data }); // don’t wait for the Intercom API call to finish, return right away. callback(null, user, context); }
 
→ code for capturing ref parameter
<script> var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } }; ref = getUrlParameter('ref'); if (ref) { $("a[href='/sign-up']").attr('href', '/sign-up?ref='+ref); }; </script>
→ Additional sign up fields
 
additionalSignUpFields: [ { type: "hidden", name: "ref", value: ref } ]
 
badge