Referral links, landing page and cookies

This page explains how referral links work: what they look like, which page they open, and how the plugin remembers the referral until the friend buys.

What a referral link looks like

Every advocate has a referral code that starts with ref followed by 7 digits, such as ref1234567. Their link is a page on your site with the code added:

https://example.com/?raf=ref1234567

The ?raf= part is what tracks the referral. Any page on your site works, as long as the link keeps ?raf= and the code, for example https://example.com/shop/?raf=ref1234567.

Customers find their link in My Account → Refer a Friend, on product pages, on the order received page and in emails, depending on your Display settings.

Choose the landing page

By default, links open your homepage. To send friends to a different page, such as your shop or a page explaining the offer:

  1. Go to WooCommerce → Refer a Friend → Settings → Display Settings.
  2. Enter the full address in Referral landing page, for example https://example.com/shop/.
  3. Click Save.

This page is also used for the Shop Now button in the coupon emails.

Two exceptions:

  • Links in the product page Refer a Friend tab always point to that product.
  • A shortcode with a url attribute uses that address. See Shortcodes.

How the referral is remembered

  1. The friend opens the link.
  2. The plugin’s JavaScript saves the code in a cookie named gens_raf in the friend’s browser.
  3. The friend can browse, leave and come back. The referral is remembered for Cookie Time days, which is 7 by default.
  4. At checkout, the plugin reads the cookie, applies the friend discount and saves the referral on the order.
  5. With Delete Cookie after Purchase on, the cookie is removed after the order.

If the friend opens a second advocate’s link, the newer link replaces the older one. The last link clicked gets the credit.

What can break tracking

  • Redirects that drop ?raf=. For example, from http to https, from www to the bare domain, or a landing page plugin. Open the link in a private window and look at the address bar once the page loads.
  • Delayed or blocked JavaScript. The cookie is set by JavaScript. Exclude gens-raf-public.js and jQuery from “delay JavaScript” options in caching plugins.
  • Cookie consent tools that block cookies until the visitor accepts. Mark gens_raf as a functional cookie.
  • Different devices or browsers. The cookie lives in one browser. If the friend opens the link on their phone and buys on a laptop, the referral isn’t tracked. Referral codes typed at checkout work across devices.

See Known compatibility issues for specific plugins.

Check it worked

  1. Open an advocate’s link in a private window.
  2. Open your browser’s developer tools and look under Application → Cookies (Chrome) or Storage → Cookies (Firefox). There should be a gens_raf cookie containing the code.
  3. Add a product to the cart. The friend discount should be applied.

Related

Browse our plugins

Lightweight WooCommerce plugins built for speed. No bloat, no frameworks -- just clean code that works.

View all plugins
Stay in the loop

Get notified when we launch new plugins. No spam, just product updates.