How To Qualify Your Referred Users Using JavaScript

You can install a Javascript Snippet on your website or landing page that will allow you to automatically qualify a referral when that user converts.

 
The ability to qualify your referred users when they convert will make managing your referral program easier because it allows you to see in real-time how many referrals you have, and how many of those have converted/qualified.
 
Screenshot showing The ability to qualify your referral program referred users via JS.
 
Important: you must have the redirect option toggled on in Step 2 For Person Invited inside the Pages For Person Invited if you want to use Javascript to qualify the person invited when they convert. This is because when the user is redirected to your website, we pass their CODE in the URL that they are redirected to. You will need this code to insert into the Javascript snippet you fire back to Referral Factory when the user converts. 
 
This is how to setup your campaign on Step 2 For Person Invited inside the Pages For Person Invited👇
 
Screenshot showing how to setup your referral program software campaign on Step 2 For Person Invited inside the Pages For Person Invited
 
 
If you follow the steps above, your campaign will now be setup to redirect the person invited to your website 👏
 
Once the user is redirected they will be sent to the 'Redirect URL' you setup on Step 2  For Person Invited inside the Pages For The Person Invited. Referral Factory will also pass the users data into the URL as a GET parameter.  
 
So if you set your redirect URL as this: 
https://www.yourwebsite.com/start-free-trial
The referred user will be redirected to this URL: 
https://www.yourwebsite.com/start-free-trial?first_name={firstname}&email={email}&code={code}

Your developer can then see the referred users first name, email, and code - which they can save into your system to pre-pouplate any forms the user needs to fill in to complete their registration / sign up / purchase on your system. 

You can store the users code either directly into your database (recommended) or into the users local browser storage.  
 
Once the referred users converts, all you need to do is fire the below snippet as an event in your code 👇
 
<script type="text/javascript" src="https://js.referral-factory.com/assets/js/qualification.js"></script> <script type="text/javascript"> if (window.RF) { window.RF.qualify({ code: "{code}" }); } </script>
 
Once this JS code is fired, the referred user will then become qualified 👏
 
Screenshot 2023-02-16 at 7.05.59 PM
 
 
Below are some additional resources provided by our developers if want to use the 'local storage' option mentioned above, to store the users code. 
 
This is how to use local storage to store the referred users code:
<script type="text/javascript"> let params = new URLSearchParams(window.location.search); // get params from current URL let code = params.get('code'); // get code from all params localStorage.setItem('rf_code', code); // set code to local storage as rf_code </script>

Once a referred user has successfully converted, they should see a "Thank You" or "Success" page in your environment. On this page, you can get the referred user's code by calling it from your local storage, in the case of our code example we use `rf_code`.
<script type="text/javascript"> let code = localStorage.getItem('rf_code'); // get code from local storage localStorage.removeItem('rf_code'); // remove code from local storage </script>

Now that the user has converted, they will need to be marked as ‘qualified’ on the Referral Factory system. To do this you will need to qualify the referred user using their {code}, please see how to do that below.
<script type="text/javascript" src="https://js.referral-factory.com/assets/js/qualification.js"></script> <script type="text/javascript"> if (window.RF) { let code = localStorage.getItem('rf_code'); // get code from local storage localStorage.removeItem('rf_code'); // remove code from local storage window.RF.qualify({ code: code }); // qualify referral using `code` variable from local storage } </script>

We hope this guide is helpful!
 
If you have any technical difficulties during your setup, please schedule a call with our technical support team.