swellAPI.identifyReferrer()

This method takes an email address as a string to identify the email to attribute referred emails to. This is useful if you are building a custom referral program experience in which logged out customers can still participate.

$(document).on("swell:setup", function() {
  var customersInput = $("#customers-input");
  var sendEmailBtn = $("#customers-send-btn");

  $(sendEmailBtn).click(function() {
    onSuccess = function() {
      $("#success").show();
    }

    onError = function() {
      $("#error").show();
    }

    swellAPI.identifyReferrer(customersInput.val(), onSuccess, onError);
  });
})

Parameters

Parameters

Type

Description

customersInput.val

string

The value inputted by the customer. This will always be an email address.

onSuccess

function

The function to be called if the email is sent successfully

onError

function

The function to be called if the email is sent unsuccessfully