Building a referral system with Mailchimp
How to quickly grow the user base of your email campaigns? By building a referral system with Mailchimp! We explain everything to you.
Referral systems are always an effective way to grow your user base quickly. If you signed up for Growth Room, you were able to experience it. If you haven't registered, it's not too late;)
To do this referral system, I first thought of using KickoffLabs and then, for fun, I asked myself if it was complicated to do it with Mailchimp. However, it turns out not. So here's a step-by-step look at the Growth Room referral system, made with nothing but Mailchimp and a few lines of code.
Setting up the Mailchimp list
The first step takes place in Mailchimp. Start by selecting your list in the “List” tab, then click Settings > List fields And Merge Tags. This is where you choose what information to store in your list. In a way, these are the columns in our database.
The only mandatory one is the email but by default, Mailchimp adds the first and last name. You can keep them but uncheck the “visible” box, so the user won't see them on the welcome email. Why keep them? Because there may always be time to enrich leads later;)
However, for our sponsorship system, we will need 3 other fields:
- The invitation code : it is the unique code of each registrant. This will generate a style link yoursite.com? code=xxx and thus to track all those who register through this user.
- The referral code : it is the sponsor code of the user in question. Of course, if the sponsor does not have a sponsor, this field will be empty.
- The number of sponsorships : quite transparent;)
So, if I register with my come@growthroom.co address, I will have an invitation code xxx and my number of referrals will be 0. Then let's say I invite bidule@growthroom.co. So, bidule@growthroom.co will have an invitation code yyy, a referral code xxx (the one from come@growthroom.co) and a number of referrals of 0. The number of sponsorships from come@growthroom.co is increased to 1.
Finally, each field has a merge tag, i.e. a variable name that I can reuse in my Mailchimp emails. As an example, here is the structure of my list:
The code
Now you have to write the code that will register and update each user. On growthroom.co, I chose to retrieve only one email.
Note: the following code is in PHP but it should not be difficult to transpose it into another language.
For each registrant, I therefore get a POST variable whose name is $email.
If the user is sponsored by someone, I also get a GET variable that I call $ref.
In addition, to generate a referral code specific to each user, I use the MD5 of his email. There are two reasons for this. On the one hand, the md5 of each email is unique to it, so I have a unique code for each user. On the other hand, I can find any user on my Mailchimp list by their md5 (cf. the API), which is useful for tracking who referred who and counting the number of referrals from each one.
So, each time the form is submitted, I run a script that consists of 3 parts:
- The initialization : I include the Mailchimp API and give me my API key (you can find yours in Account > Extras > API keys).
- User registration : to do this, I am doing a POST on the lists/myList/members endpoint. Here is the code (commented out):
- If the user has been referred, updating the sponsor's account : to do this, I retrieve the sponsor's information with a GET (easy, since his referral code corresponds to the md5 of his email), then I PATCH the information concerning him by incrementing his number of sponsorships by 1. Here is the code:
The full code can be found here: https://gist.github.com/c2prods/8e4cac2eff4b59141479926e0dd4e057
Automatic emails
So here we are with a system capable of counting the sponsorships of each user. You still have to talk to them! To do this, go back to Mailchimp with a very practical function: automation. It is thus possible to send emails based on user behavior.
For this purpose, I have defined 4 emails in particular:
- Welcome email : it is the email that the user receives when he is added to the list.
Trigger: Immediately after subscribers join your list. - First sponsorship : when someone registers with their link, the user receives a thank you email and a reminder of their unique sharing link.
Trigger: Immediately after subscribers list field, Number of sponsorships, changes to 1. - Bonus 2 ref : same when the number of sponsorships increases to two.
Trigger: Immediately after subscribers list field, Number of sponsorships, changes to 2. - Email bonus : when the number of sponsorships reaches 3, I then send this bonus email containing my 10 favorite growth tools.
Trigger: Immediately after subscribers list field, Number of sponsorships, changes to 3.
The first 3 emails have two particularities:
- On the one hand, they do not use a Mailchimp template but a template coded in HTML. This allows for a better deliverability. By changing the welcome email from a classic newsletter template to an html template, my opening rate went from 50 to 80%!
- On the other hand, they make use of the famous Merge Tags so that each user has their referral link in the email. In fact, by writing www.growthroom.co/r=*|code|*, Mailchimp replaces *|CODE|* with the relevant merge tag and therefore with the user's referral code. See HERE to find out more.
A few words to conclude
What about the effectiveness of this system? After one week, 48.3% of Growth Room subscribers came through the referral. Of course, there are plenty of other versions of this system: unlocking bonuses as you go, doing a leaderboard...
In any case, in my opinion, 3 things should be kept in mind when building a system of this kind:
- Always find the right way to get the referral. It should provide value without appearing to be exclusive to those who do not share.
- Pay close attention to opportunistic behavior, especially when giving money. I have had a few and it is not very serious since I only give one email. It wouldn't be the same story with credits;)
- Nothing beats organic word-of-mouth. Shitty product = shitty growth — that rule still holds true!