# Refer-a-friend

Custom landing page to collect references

An optional method of acquiring users is to create a landing page with a sign-up form. The form should be sent as JSON using the POST method.

affiliation

Url: https://api.edrone.me/affiliation

Field Description
app_id Required; See Trace API below
email Required; Customer email address.
e_ref Required; A unique referral code for the referring user. It can be send from any other engagement.
first_name Optional; Customer first name.
last_name Optional; Customer last name.

Example form code:


<div id="refer-a-friend-form">
  <input type="hidden" id="app_id" name="app_id" value="your_app_id">
  <label for="e_ref">Refferal code</label><br>
  <input type="text" id="e_ref" name="e_ref"><br>
  <label for="email">Email</label><br>
  <input type="text" id="email" name="email"><br>
  <label for="first_name">First name</label><br>
  <input type="text" id="first_name" name="first_name"><br>
  <label for="last_name">Last name</label><br>
  <input type="text" id="last_name" name="last_name"><br>
  <button>Confirm</button>
</div>
<script>
  $('#refer-a-friend-form button').on('click', function (event) {
    var data = {}
    $('#refer-a-friend-form input').each(function() {
      data[$(this).attr('name')] = $(this).val()
    })
    $.post("https://api.edrone.me/affiliation",  JSON.stringify(data));
  })

  $( document ).ready(function() {
    var urlParams = new URLSearchParams(window.location.search);
    $('input#e_ref').val(urlParams.get('e_ref'))
  });
</script>