Skip to main content

The attribution flow

Dub uses a multi-stage attribution model that tracks the complete customer journey from initial click to final purchase:

Stage 1: Click tracking

When a visitor clicks a partner’s referral link, Dub captures the click server-side before redirecting to your website. This happens automatically and cannot be blocked by ad blockers.
Diagram showing how click events are tracked
Data captured at click:
  • Unique click ID
  • Timestamp
  • Geographic location (country, city, continent)
  • Device type (mobile, desktop, tablet)
  • Browser and operating system
  • Referrer URL
  • UTM parameters
  • Whether the click came from a QR code or a short link
The click is appended to your destination URL as a dub_id query parameter:
Then, the Dub Analytics script detects the dub_id parameter and stores it as a first-party cookie.
Why first-party cookies?
  • Persist across page navigation and sessions
  • Not blocked by ad blockers (unlike third-party cookies)
  • Compliant with privacy regulations
  • Work reliably across all browsers
The default cookie lifetime is 90 days, meaning conversions within this window are attributed to the original click. You can customize this with the expiresInDays parameter.

Stage 2: Lead tracking

Diagram showing how lead events are tracked
When the visitor takes a qualifying action (signup, booking, form submission), you track a lead event. This links the customer to the original click.
The lead event is automatically deduplicated based on customerExternalId + eventName. Only the first event for each combination is recorded, preventing duplicate attribution.

Stage 3: Sale tracking

Diagram showing how sale events are tracked
When the customer makes a purchase, you track a sale event. Dub automatically links this to the customer’s previous lead event.
The sale is attributed to the partner who drove the original click, and a commission record is automatically created based on your program’s reward rules.

Attribution models

Dub supports two attribution models:
  1. Last-click attribution (default)
  2. First-click attribution

Last-click attribution (default)

All credit goes to the most recent partner link the customer clicked before converting.
Pro-tip: Last-click attribution is the most commonly used attribution model when it comes to affiliate attribution, since it gives the most credit to the final partner that got the customer to convert.

First-click attribution

All credit goes to the first partner who introduced the customer, regardless of subsequent clicks.
When a customer clicks multiple partner links: Each click is still recorded in analytics, so you can see the full customer journey even if only one partner receives the commission.

Attribution window

The attribution window is the timeframe during which a conversion can be credited to a click. In Dub, this is controlled by the cookie lifetime:
If the customer converts after the cookie expires, the conversion event will not be attributed to the original click.

Cross-domain attribution

If your customer journey spans multiple domains, Dub supports cross-domain tracking as well:
  • yoursite.comapp.yoursite.com
  • app.yoursite.comcheckout.yoursite.com
  • yoursite.comanothersite.com
Learn more in the cross-domain tracking guide.

Partner commission flow

When a sale is attributed, Dub automatically calculates and records the partner’s commission:
  1. Sale event received with customerExternalId
  2. Customer lookup finds the associated lead and original click
  3. Partner identified from the click’s referral link
  4. Commission calculated based on the reward rules for the partner’s group
  5. Commission created with pending status

Direct sale attribution

For scenarios without a signup flow (e.g., one-time purchases), you can track sales directly with the click ID:
Learn more about direct sale tracking.
Direct sale tracking bypasses the lead event. This means lead-based rewards are not created—only sale commissions.

Deferred lead tracking

For products with qualification periods (trials, approvals), Dub supports deferred lead tracking:
This ensures partners are only rewarded when customers reach a meaningful milestone. Learn more about deferred lead tracking.

Troubleshooting attribution

Common issues

Verifying attribution

  1. Check the cookie: Inspect browser cookies for dub_id
  2. Test the flow: Click a partner link, sign up, and verify the lead appears in your dashboard
  3. Review analytics: Check the Events tab for click → lead → sale progression