WordPress Plugins
Free Tools
Claude Skills
Resources
Pricing Agencies Support My Account Cart
Support / Royal Affiliate Pro / Tracking & Attribution

Tracking & Attribution

First-party cookie tracking, direct link matching, standalone conversion pages, and configurable attribution models for affiliate referrals.

Referral Tracking

Royal Affiliate Pro uses cookie-based tracking to attribute sales to the correct affiliate.

How It Works

  1. Visitor clicks an affiliate link: yoursite.com/?ref=affiliatecode
  2. The plugin sets a rafp_ref cookie containing the affiliate ID, campaign ID, and timestamp
  3. The cookie persists for a configurable duration (default: 30 days)
  4. When the visitor makes a purchase, the cookie is read and a referral is created

From 2.6.26 the cookie is signed. A cookie that has been edited, for example to name a different affiliate or campaign, is ignored and the sale is not credited from it. Cookies set before you updated keep working until they expire.

URL Parameters

Parameter Purpose
?ref=code Main referral parameter
?affiliate=code Alternative referral parameter
?campaign=slug Campaign tracking
?creative=id Creative tracking

Tracking Settings

Setting Default Description
Cookie Duration 30 days How long the tracking cookie persists
Referral Code Format Username Username-based or random code
Link Format Pretty Query string (?ref=code), or cloaked links under /recommend/
Cross-Subdomain Off Share cookies across subdomains
Clear After Conversion Off Remove cookie after first purchase
Cookie Consent Track referrals right away Wait for marketing consent before tracking (see Cookie consent)
Referral Tracking Settings

Attribution Models

Choose how Royal Affiliate Pro attributes sales when a customer clicks multiple affiliate links.

Available Models

  • First Click - The first affiliate to send the customer gets credit for all purchases. The original cookie is never overwritten.
  • Last Click (Default) - The most recent affiliate click overwrites the cookie. The last affiliate to send the customer gets credit.

Excluded Pages

Block referral tracking on specific URLs. Supports wildcards and regex patterns to exclude checkout pages, admin areas, or any URLs where tracking should not apply.

Forced Landing Pages

Designate specific pages as forced landing pages. When an affiliate link lands on these pages, the cookie expiration is refreshed, extending the tracking window.

Who gets the order

The affiliate is saved on the order at checkout. Whoever marks the order paid later (you, a payment webhook or a scheduled task) does not change who gets the commission.

Coupon or link

When a buyer came through one affiliate's link and uses another affiliate's coupon, Settings → General → Coupon or Link decides who gets the sale. The default is The coupon wins. Choose The link wins to credit the affiliate whose link the buyer followed. An inactive affiliate's coupon never earns.

Visits on your other sites

If your sales pages live on another site (for example a marketing site on its own domain), add that site under Settings → General → Script Sites and put the tracking script from that screen on every page of it.

What the script does

  • When a visitor lands on that site through an affiliate link, the visit is counted right away, even if they never reach the store
  • It keeps the referral code and adds it to every link to the store, so the store sets the referral cookie and reuses the same visit
  • With Cookie Consent on, it stores and reports nothing until the visitor accepts
  • Safari keeps what a script saves for at most 7 days, so on Safari a saved referral code from a script site can expire sooner than your cookie duration

Sites with a Content Security Policy

If the other site sends a Content-Security-Policy header, allow your store's address in both script-src (to load the script) and connect-src (to count the visit):

script-src 'self' https://store.example.com
connect-src 'self' https://store.example.com

Standalone Conversions

Track affiliate referrals without WooCommerce by placing the [rafp_conversion] shortcode on any thank-you or confirmation page.

Agency Feature

This feature requires an Agency license.

How It Works

Place the shortcode on a confirmation page that visitors reach after completing an action (purchase, signup, form submission). The shortcode reads the affiliate tracking cookie and creates a referral.

Works With

  • Stripe Checkout
  • PayPal
  • ThriveCart
  • Gumroad
  • Any external checkout that redirects back to your site

Amount and reference

Set the sale amount and a unique reference in the shortcode:

[rafp_conversion amount="99.99" reference="INV-001"]

Values in the page address (?amount=, ?reference=) are ignored by default, because anyone can change an address. Developers who sign or check those values themselves can allow them with the rafp_conversion_query_values filter. Conversions are recorded as pending, and the page is never served from a page cache.

Standalone Conversion Setup