Click Tracking
Overview
Click tracking records every time a visitor arrives on your site through a partner's referral link. This data powers your conversion metrics — you can see how many people clicked each partner's link versus how many actually purchased.
How clicks are recorded
When a visitor lands on a page with ?ref=partner-slug in the URL, the tracking script sends a beacon to the Affihub API:
POST https://api.affihub.com/track/click
Content-Type: application/json
{
"program_id": "prog_abc123",
"ref": "partner-slug",
"landing": "/pricing",
"referrer": "https://twitter.com/partner/status/123"
}The beacon is sent using navigator.sendBeacon, which:
- Is non-blocking (doesn't affect page load)
- Survives page navigation (the request completes even if the user navigates away)
- Sends as a POST with
application/jsoncontent type
What data is captured
| Field | Description | Example |
|---|---|---|
program_id |
Your program identifier | prog_abc123 |
ref |
The partner's slug | john |
landing |
The page path the visitor landed on | /pricing |
referrer |
The referring URL (where the click came from) | https://twitter.com/... |
The click is stored as an event in the Affihub events table with type: "click".
Click vs. conversion
A click is recorded when someone visits your site with a ?ref= parameter. A conversion is recorded when that visitor completes a purchase (via a Stripe or Paddle webhook).
The conversion rate is:
conversion_rate = (conversions / clicks) × 100This metric appears on both the provider dashboard and partner portal.
Dashboard metrics
Provider dashboard
The provider sees aggregate click data:
- Total Clicks — All clicks across all partners
- Total Conversions — All successful referral transactions
- Conversion Rate — Overall click-to-conversion percentage
Partner portal
Each partner sees their own metrics:
- Clicks — How many visitors used their referral link
- Referrals — How many of those visitors converted
- Conversion Rate — Their personal conversion percentage
Deduplication
Click tracking does not deduplicate. If the same visitor refreshes a page with ?ref=partner three times, three click events are recorded. This matches the standard behavior of analytics platforms.
Attribution (which partner gets credit for a sale) is handled separately and always resolves to a single partner per transaction.
Privacy considerations
Click events contain:
- Partner slug (not visitor identity)
- Landing page path (not full URL with query params beyond
ref) - HTTP referrer (standard browser header)
- No cookies, no IP addresses, no fingerprinting
The click beacon is a simple POST request with no tracking pixels or third-party scripts.