With the out of the box solution, iRefer tracks the referred person's identity for Campaign Sign-up type referrals, but not for the Specific Action type referrals. With Campaign Sign-up type referrals, the referred person has to fill out the referral campaign sign-up form, and iRefer collects these details. But with the Specific Action type referrals, the referred person doesn't have to fill out iRefer form, and so we can't get their details.

It's still possible to capture the referred person's details with a little coding required at your end. You might need a developer for this. The estimated needed coding time is less than half an hour.

Capturing the referred user's email address 

By default, the referred person's identity is not tracked by iRefer for the specific action type referrals. Since the specific action happen on your website without using iRefer form, we can't track it by default. 

To track the identity of the referred user and collect their email address, you need to pass their email id to iRefer. There are two ways you can achieve this. Either option would work fine.  

Option 1 - Using Cookie - You need to write the referred user's email address to vsu_visitor_ext_id cookie for your website.

Here is a sample JavaScript code for adding the user email address to vsu_visitor_ext_id cookie. You need to add this code to your form submit event (change "your-email") to email field name on your form.

var user_email = document.getElementsByName("your-email")[0].value;
var domain_name = window.location.hostname;
if (domain_name.startsWith("www.")){
    domain_name = domain_name.substring(4);
}

var days = 365;
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = "; expires=" + date.toUTCString();

document.cookie = "vsu_visitor_ext_id=" + user_email + expires + "; domain=." + domain_name + "; path=/";

If you also want to pass referred person's name, then use the following sample JavaScript code -

var user_email = document.getElementsByName("your-email")[0].value;
var user_name = document.getElementsByName("your-name")[0].value;
var domain_name = window.location.hostname;
if (domain_name.startsWith("www.")){
    domain_name = domain_name.substring(4);
}

var days = 365;
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = "; expires=" + date.toUTCString();

document.cookie = "vsu_visitor_ext_id=" + user_email + expires + "; domain=." + domain_name + "; path=/";
document.cookie = "vsu_visitor_ext_name=" + user_name + expires + "; domain=." + domain_name + "; path=/";


Option 2 - Using Querystring - You need to pass the referred user's email address to vsu_visitor_ext_id url querystring parameter on the specific action completion page. iRefer can track the URL and hence it can receive the email id. The required query string format is 

?vsu_visitor_ext_id=user@email.address

You can also pass the user's name with the following additional parameter -

&vsu_visitor_ext_name=user-full-name

In this case duplicate customer email check is enabled, and duplicate email entries are blocked.

As long as the specific action page URL (as defined on the rewards setup page) looks like following, we can capture the referred person's details from the URL query string. 

http://yourwebsite.com/specific-action-page/?vsu_visitor_ext_id=user@email.address&vsu_visitor_ext_name=user-full-name

Here is a sample PHP code for adding this querystring to the link to specific action completion page -

<a href="/my-account/?vsu_visitor_ext_id={{currentUser.email}}&vsu_visitor_ext_name={{currentUser.name}}">
   My Account
</a>


If you are rewarding referred users for creating an account with you or filling up a form, here is JavaScript example of redirecting users to a thankyou page after they have completed the sign up form. You need to place this code on form submit event after your current form submit code -

var user_email = document.getElementsByName("your-email")[0].value;

user_email = encodeURIComponent(user_email);

location = 'http://yourwebsite.com/thanks?vsu_visitor_ext_id=' + user_email;


If you also want to pass referred person's name, then use the following sample JavaScript code -

var user_email = document.getElementsByName("your-email")[0].value;
var user_name = document.getElementsByName("your-name")[0].value;

user_email = encodeURIComponent(user_email);

location = 'http://yourwebsite.com/thanks?vsu_visitor_ext_id=' + user_email + '&vsu_visitor_ext_name=' + user_name;


This is a requirement for the referred user's id to be tracked. If the required cookie or query string is not present, you won't see their id in your referral reports, only their IP address will be reported.

If you have any query about this approach, please don't hesitate to reach out to us.

Did this answer your question?