Partner tracking
Add one script to your site and report signups, sales and refunds. Each partner then gets credit, and commission, for the customers they bring you. Set it up in the five steps below, choosing your stack in step 2.
How it works
- A visitor arrives through a partner’s link: the short link
/r/{key}, or your own page with?via={key}. - The script keeps that click in the
pp_clickcookie on your domain. - The visitor signs up, and you report a lead with the click.
- The customer pays, and your server reports a sale.
- Each sale earns the partner a commission.
Only clicks and leads come from the browser. Sales and refunds come from your server, with your API key.
Before you begin
- Tracking ID: in the PartnerPage dashboard, open Settings › Partner program › Partner links and click Copy next to the Tracking ID. It starts with
pp_trk_. Replacepp_trk_…in every sample below with it. The Tracking ID is safe to put on your site. - API key: create one under Settings › Developers. The server samples read it from
$PARTNERPAGE_API_KEY. A read-only key cannot report. See Authentication. - Amounts are in the currency’s minor unit: cents for USD, yen for JPY. For three-decimal currencies (KWD, BHD, …), send a multiple of 10.
Set it up
Turn on partner links
In Settings › Partner program › Partner links, switch Partner links on, set your signup page in Sends visitors to and add your site to Allowed hostnames. Then save. See Partner links settings for each setting.
Add the script to every page
Choose your stack to see where the script goes.
HTML
Google Tag Manager
Webflow
WordPress
Stripe Payment Links
Put this in the <head> of every page. It keeps a visitor’s partner click for the days set in A click counts for (90 by default) and passes it to Stripe Payment Links and Pricing Tables by itself.
Every hostname the script runs on must be in Allowed hostnames. Old data-directory tags keep working.
Check the install: open https://<your hostname>/?via=test and look for the pp_click cookie, or use Verify installation in Settings › Partner program › Partner links. For a hostname written as *.yoursite.com, check www.yoursite.com.
Track leads
After a customer signs up, report the lead. Read clickId from the pp_click cookie. Report the lead only when the cookie holds a click UUID. A customer with no cookie, or with a value that is not a UUID (such as the test that ?via=test writes), has no partner to credit, so skip the call. It would answer 400 on clickId.
To report it from the browser, call trackLead once the script has loaded. It sends nothing when there is no click. Read Security first.
If this can run before the script has loaded, such as inline on a page that has just opened, use the queue instead:
Or from your server, with your API key. This is more reliable. See Track a lead.
The answer is 201 for a new lead and 200 for a customer you already reported.
Track sales
With Stripe connected in Settings › Partner program › Stripe, there is nothing to do. Otherwise report each paid invoice of a customer who has a lead from your server. One sale per invoiceId. See Track a sale.
Send the clickId from the pp_click cookie whenever you have it. A sale without it, for a customer only the script on your site reported, is held until you release its commission. Approving the lead does not release it.
If you send all your invoices anyway, those of customers with no lead answer 404 unknown_customer. That answer is expected and safe to ignore, and it writes nothing. Those calls still count against the rate limit.
Every call is real: there is no test mode, and a sale you report can earn a commission that gets paid out. Try these calls on a test directory first.
The answer is 201 for a new sale and 200 for an invoice you already reported with the same values. A retry may leave out paidAt and eventName; if it sends either with another value than the first call, it answers 409 invoice_id_reused and changes nothing.
To report a refund, send the invoiceId of the sale. See Refund a sale. Because amount is a total, you can safely send a call again: the same total adds nothing, and a higher total adds the difference.
The answer is 200.
Partner links settings
These settings are in Settings › Partner program › Partner links.
- Partner links: on or off. Partners earn on the leads and sales their link brings. To switch them on, set the signup page and save.
- Link format: the short link
yourdirectory.com/r/{partner-key}(recommended), or the query parameteryoursite.com/signup?via={partner-key}. The query parameter needs your signup page’s site in Allowed hostnames, and the script verified there with Verify installation. - Sends visitors to: your signup page, the destination of every partner link. It must be a public
https://address. - Partner key: what
{partner-key}is for each partner: the partner’s name (such asblue-fern) or the partner’s ID. - A click counts for: 1 to 365 days, 90 by default. A customer who signs up within this window is credited to the partner.
- Tracking ID: needed by the script and by the API calls. Click Copy to copy it. Regenerate… makes a new one: your script and API calls stop working until you replace the old ID everywhere.
Allowed hostnames
The script tracks clicks only on these hostnames.
- Add each one as
example.comor*.example.com, up to 20 hostnames. *.example.comcovers the subdomains ofexample.com, notexample.comitself.- A wildcard over a shared suffix, such as
*.co.ukor*.webflow.io, is refused because it covers other companies’ sites. Use your own domain, like*.yoursite.webflow.io. - IP addresses and local names (
localhost,.local,.internal) are refused.
Verify installation
Choose a saved hostname and click Verify installation. PartnerPage reads that hostname’s home page and looks for the script with your Tracking ID. A *.yoursite.com hostname is checked at www.yoursite.com. The check tracks nothing.
Security
When leads come from the browser (trackLead), send clickId on the customer’s sales, or report the lead from your server with its clickId: a lead the browser reported is confirmed by its own click, and a lead planted from the browser is moved to the real click. The move happens only while the lead still awaits your approval, has no sale reported from your server and has not started earning, and only while partner links are on; after that the lead stays with its partner, and a call naming another click changes nothing. Until a call from your server names the lead’s click, the commissions on its sales stay on hold, even after you approve the lead; you release them on the commission. Use a customerId nobody can guess (not an email or a sequential number).
Keep your API key on your server, never in browser code. See Authentication.
Rules
- Every sale inside the earning window earns at the rate locked when the lead was enrolled, at its first sale, except:
- a declined lead earns nothing;
- a lead that already earned on its won deal value keeps that commission and its sales earn nothing more;
- a partner whose listing was removed earns nothing on later sales;
- a lead is enrolled only by a sale reported while the commission program and commissions are on; sales reported before that earn nothing.
- An
invoiceIdis counted once. - A refund before payout lowers the commission, and after payout becomes a recovery.
- A won deal without a sale is a conversion but not revenue.
- Read-only keys cannot report. See Full-access and read-only keys.
- There is no test mode. Every call is real, so try these calls on a test directory first.
Errors
Errors have three shapes, so check the status first:
- A problem with a field answers with that field, as
{"amount": ["…"]}. A body that is not a JSON object answers{"nonFieldErrors": ["…"]}. - An error with a code in the table answers
{"code": "…", "message": "…"}. - A 401, a 403, a 429 and a body that cannot be parsed answer
{"detail": "…"}.