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/?r=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?

If you're finding that referrals aren't getting counted during your tests, or if a user reports such, the reason could be one or more of the following:


Did you have double opt-in enabled?

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.

Prefinery recommends enabling Double Opt-in for your project as it improves your email deliverability, increases engagement with your users, and leads to better overall email marketing. 


Was the Prefinery Javascript Snippet properly installed on the website, especially on the referral link page? 

The JavaScript snippet is responsible for recording shares and referrals. It needs to be installed on your site, even if you're using the API, preferably before the closing </head> tag. 

This is especially important if your Referral URL is set to a page (e.g. example.com/landing/?r=FgHiJ) different from where your signup form is at (e.g. example.com/signup/) since you'll want to get the user tracked the first time they arrive on any page in your website. 

Prefinery's JavaScript Snippet automatically records the referrer's code in a cookie, which your domain can access. As soon as the user navigates to a different page, the change in the URL will not carry over the referral code parameter, but since the referrer's code was already recorded anytime the user eventually signs up on your website the referral gets attributed to the referrer.


Is the set Referral URL not the final URL?

Following the previous item, your Referral URL (as you've set in Referral Page > Settings) shouldn't be a temporary redirect link (e.g. if you were looking to use a URL shortening service). It should be the actual, final landing page. 

The problem with using redirects or URL shorteners in this manner is that they aren't designed to pass URL parameters which means the referral code gets stripped off in the process. 


Did the user signup through the referral link, or directly and not through any referral?

Perhaps the copied & shared link did not include the referral code parameter (e.g. ?r=AbCde if the referral link is example.com/?r=AbCde) in which case no referral is tracked. 


Did the referred user use plus-addressing for the same email address the referrer used?

You cannot use plus-addressing for referred users (e.g. name+test123@yourdomain.com) with the referrer using the same email address (e.g. name@yourdomain.com) to test out referrals as Prefinery doesn't count referrals using this method to prevent potential abuse. Instead, use a different email address that you own or have access to.


Referral is recorded in the project, but integration or webhooks isn't returning the referrer's email address?

Following the previous point regarding double opt-in, the referral is only established once the referred user is in the  Applied status at which point we will fire the tester_referred event once. This event includes the information on both the referring and referred users. 

If using integrations or webhooks, make sure to use the user/tester_applied (completed opt-in confirmation) event as your trigger if you're looking to capture the referrer's information. 


Perhaps the Fraud Protection System kicked in?

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?


Are you testing on your website builder platform's staging URL?

Some website builder platform like Ghost allows you to publicly access your website from the front-end through a staging URL (e.g. `https://mywebsite.ghost.io/`), but the top-level domain (e.g. `.ghost.io`) for these staging URLs is rejecting cookies from being written on it

This is resolved by setting up your custom domain on your website at these website platforms (like this one from Ghost). You can find instructions on how this is done through your platform's help docs or by reaching out to their support representative. 


Are you using a CDN (Content Delivery Network) like Cloudflare?

Perhaps you are proxying everything through your CDN and have disabled cookies on your CDN settings? If so, to resolve this you'll only need to enable cookies. 

Or, it could be that the page(s) in question are being reverse proxied to different domains (behind the scenes), thus the browser blocks what it sees is a cross-domain cookie. 

Also, if you are using Cloudflare you might want to check and try this as well: How to Disable CloudFlare Caching of the Prefinery JavaScript Widget

If you are still unable to identify why referrals aren't getting counted in your project, feel free to contact us using the message button at the bottom-right corner of your screen.

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