What Triggers a Referral?

When a person follows a friend's unique referral link and lands on your website, a Share is recorded and attributed to the owner of the referral link. A Referral is recorded if the person is subsequently added to your campaign.

Terminology: The referring user's unique referral code is known as the referrer_code.

How do I add users to my campaign?

There are various ways to add users to your campaign and ensure that the person who referred them is credited with the referral:

1. Embedded Signup Form

When using Prefinery's embedded Signup Form a referral will be recorded automatically if the form is submitted after a person follow's a friend's unique referral link. 

There is nothing you need to do to configure this behavior. We use cookies so that the referral is tracked even if the person submits your form days or weeks later.

2. JavaScript Web API

You can connect your own form to Prefinery using our JavaScript Web API. For details, see the JavaScript Web API documentation.

3. Raw HTML Form

If you choose to build and design your own HTML form and submit signups to Prefinery via your project's unique action URL, then you will need to manually attribute the referral. 

To do this, set the referral_token input field to the referrer_code (the referral code of the user to whom you want to credit the referral).

<form action="YOUR-UNIQUE-PROJECT-ACTION-URL" class="pfy-signup-form" method="post">
  <input id="referral_token" name="referral_token" type="hidden" value="SET-THIS-VALUE">
  <input autocomplete="email" type="email" name="user[profile][email]">
  <input type="submit" value="Submit">


When using Prefinery's API, you will need to manually attribute the referral. To do this, set the referrer_id parameter when creating the new user via the testers#create endpoint to the referrer_code.

How do I keep track of the referring user's unique referral code?

When using Prefinery's embedded signup form, you do not need to keep track of the referrer_code (the referring user's unique referral code). As mentioned above, a referral will automatically be recorded when the Signup Form is submitted.

However, when using your own form or our API, you will need to keep track of the referrer_code. For example, let's say that Mark is referring Mary to your website. Mark's unique referral link is https://yoursite.com/?ref=ABC123. He shares that link with Mary, who clicks it, and lands on your website. You need to know that she was referred by ABC123 in order to properly credit Mark with a referral.

Prefinery's JavaScript snippet automatically records the referrer_code in a cookie, which your domain can access. The cookie is named in the format _pfy_{your-project-id}_referrer_code. For example, if your Project ID (found inside your Prefinery account by clicking on the Settings menu and then Project Settings) is 4z9l85sf then the cookie will be named _pfy_4z9l85sf_ABC123 where the referrer_code is ABC123.

Alternatively, you can use the JavaScript Web API in order to retrieve the referrer_code.

Why are referrals not getting counted?

A referral is only counted if the referred user's status becomes Applied, or goes through it.

With double opt-in enabled, a new user goes through the Unconfirmed status first (or Imported status in the case of imported users), then once they confirm via email opt-in it changes to Applied. With double opt-in disabled, the same status change happens (they go through Unconfirmed then Applied), except that it happens automatically.

Another reason why a referral isn't getting counted is due to possible fraud or a user gaming the system. If you are trying to test referrals, we highly recommend that you follow along our referral testing guide here: How can I test referrals?

Still need help? How can we help? How can we help?