If you want to reward your referrers when referred person performs a specific event on your website, there are 2 ways you can trigger this referral.

  1. Track it using specific page url that referred person visits. (See http://help.irefer.io/how-to/referral-program-rewards/reward-for-a-specific-action for more details)
  2. Track it on specific UI event like button click or form submit. 

If you don't want to trigger your referrals on a specific page visit, but want to limit it to any specific UI event like button click or form submit, you can follow this article to do the required setup and code integration. This is done thru an API call from the client side code. The same can also be done using server side code but you need to convert this code to your server side language. 

First of all, in your campaign reward setup page, set the specific action url as "/event/event_name" ( for example "/event/payment-made").

Then you need to add the following JavaScript code to the button click or the form submit event. This can be done using GTM (google tag manager) if you are familiar with it, or you would need a developer's help.

Please don't forget to change the variables such as campaign id, license key, event name etc as commented in the code below.


function readRefCookie(name) {
    var nameEQ = name + "="; var ca = document.cookie.split(';');
    for (var i=0;i < ca.length;i++) {
        var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }  return null;

var referrer_code = readRefCookie('vsu_referer_hash');
//use this if user email is already set in the vsu cookie, or you need to populate it using cookie or variable available to you.
var user_email = readRefCookie('vsu_visitor_ext_id');

var event_name = '/event/event-name'; //replace it with event name as defined in rewards setup.

var campaign_id = '10007'; //replace it with your campaign id
var license_key = 'W4qL7xxxxxxxxxxxxx8484fk'; //replace it with your license key

var api_url = "https://api.irefer.io/v1.0/" + license_key + ".js/newSpecificAction?campaign_id=" + campaign_id + "&external_id=" + user_email + "&action=" + event_name + "&referrer_code=" + referrer_code + "";

var xhr = new XMLHttpRequest();
xhr.open("GET", api_url, false);
json_result = xhr.responseText;

if(xhr.status == 200){
else {
Did this answer your question?