# Affiliates

> Track ?ref= referral links, register affiliates with a commission rate, credit revenue to the last affiliate a buyer came through, and share a read-only portal with each affiliate.

An affiliate is anyone who sends you visitors through a link that names them, such as `https://example.com/?ref=jane`. PilotFox records which affiliate each visit came through and, with [a payment provider connected](https://pilotfox.app/docs/revenue), which payments followed and what commission they earn.

## Referral links

A visit is credited to an affiliate when its page URL carries one of the site's affiliate parameters. The parameter is `ref` by default; on the Affiliates page, *Tracking settings* can change it or add others (up to 5 names).

- The value is turned into a **slug**: lowercased, with every character other than a–z, 0–9, `_` and `-` removed, up to 64 characters. `?ref=Jane Doe` and `?ref=janedoe` are the same affiliate, `janedoe`.
- If a URL carries several of the parameters, the first one in the URL with a non-empty slug counts.
- A session's affiliate is the first one it carries; later pages of the session keep it.
- The parameter is read from the full page URL before any query-string privacy rule applies, so it is recorded even when you store no query strings. It needs the tracker option *Query strings* to stay on (Site settings → Tracking code): with it off, the script never sends the query string. To keep query strings out of your data and still track affiliates, leave the option on and set *Store query string parameters* to *None* (Site settings → Privacy & identity).

Affiliate links are separate from the *Affiliate* traffic channel, which comes from campaign tags (`utm_medium=affiliate`).

## Registering affiliates

The Affiliates page lists your registered affiliates and, below them, slugs seen in traffic that nobody registered yet (the 100 with the most visits). Registering a slug (editors and above) gives it:

- a **name** (up to 80 characters) and its **slug**;
- a **commission rate**, from 0 to 100 % with up to two decimals;
- a **report**: visits, visitors, payments and revenue over time, its commission, and its top landing pages, referrers and countries and latest payments;
- a **portal link** you can share with the affiliate (below).

Deleting an affiliate keeps its recorded visits and payments: they show again as the unregistered slug.

## Revenue and commission

With a payment provider connected, a payment linked to a visit is credited to the last affiliate link that visit's visitor (the same browser) came through within the **attribution window** before the payment: 30 days by default, 1 to 365 in *Tracking settings*.

Only that browser's own visits count, also for signed-in users you identify on several devices: an affiliate link opened on a phone does not earn a payment made from a laptop. Anyone can send another user's id from their own browser, so a visit under the same user id in another browser never takes the credit. See [what a visitor can claim](https://pilotfox.app/docs/revenue#what-a-visitor-can-claim).

| Figure | Definition |
| --- | --- |
| Visits | Sessions that came through the affiliate's link. |
| Visitors | Distinct visitors of those sessions. |
| Payments, revenue | Payments credited to the affiliate in the period, in the site's default currency; revenue is net of refunds. |
| Commission | Revenue × the affiliate's commission rate, rounded to the currency's smallest unit; 0 for unregistered slugs. |
| Conversion rate | Paying visitors ÷ visitors. Payments from visits before the period can make it exceed 100 %. |

Changes to the parameters or the window apply to new visits and newly imported payments; what was already recorded keeps its affiliate. Report filters do not apply on the Affiliates page.

## The affiliate portal

On an affiliate's page, *Create portal link* makes a link of the form `https://pilotfox.app/a/…`. The link is shown once (PilotFox keeps only a hash of it); *Regenerate link* replaces it and *Revoke* turns it off. Creating one needs the editor role and the permission to see revenue, because the portal shows revenue.

The portal needs no account. It shows the affiliate's name, commission rate and referral link, and for the last 7, 30 or 90 days their visits, visitors, payments, revenue and commission, with a daily chart and their top landing pages. It shows totals only, never individual visitors, payments or emails. Treat the link like a password: anyone who has it can open the portal.
