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

ParametersTypeDescription
customersInput.valstringThe value inputted by the customer. This will always be an email address.
onSuccessfunctionThe function to be called if the email is sent successfully
onErrorfunctionThe function to be called if the email is sent unsuccessfully