In the milestone referral template (or any other Viral Loops sign-up tracking template) a successful referral happens when the invitee makes a registration.
In some cases a different behavior might be desired.
- User makes a purchase
- After a custom conversion action
For cases like these you can use our API to completely control and change the flow of the referral program.
Let's get to it!
Note: the following can be applied to any Viral Loops sign-up tracking template.
First you will need to capture the 2 query parameters that all users have when they land on your page through a referral invite.
These should be saved alongside any new user that registers on your platform so their referrer can be properly rewarded later when they make their action.
After a successful action
After a successful action the following API call should be run:
Content-Type: application/json is needed.
"firstname": "the user's firstname",
"lastname": "the user's lastname",
"email":"the user's email"
"referralCode": "the referrer's referralCode saved on signup"
"refSource": "the refSource saved on signup"
apiTokenis availabe in the installation step of the campaign wizard.
- firstname and lastname are optional
- the referrer and the refSource can be omitted if not available(the user didn’t come from a referral)
- The call can be safely run multiple times so no extra logic needed to track if this is the first action or not (no extra rewards will be given).
The referralCode of the new participant will be returned along with the eventId of the transaction.
The referral dashboard
In a page available only to members (these are users that completed their action using the above call) you might want to show our 2 widgets so they can check their milestone progress and invite more friends.
- add the 2 widget
divanywhere in the page you would like the widgets to appear
email: "the user's email"