Skip to main content
Identity tracking is currently only available for select Dub Enterprise customers. Reach out if you’d like access.
The Dub Analytics script also supports identity tracking for partner risk monitoring. The identity variant of the script identifies the visitor’s device on the paths you configure, and links it to the corresponding partner click, to help you monitor your partner-driven traffic for fraud and abuse.

Prerequisites

  1. You’ve set up a partner program on Dub.
  2. You’ve enabled client-side click tracking on your site.
  3. You’ve enabled risk monitoring in your partner program.

How identity tracking works

Identity tracking only runs for partner clicks, when the click ID in the dub_partner_data cookie matches the dub_id cookie. Other clicks that come from non-partner links are skipped. It runs once per click, on the first page load and on client-side navigation to a matching path. A path matches exactly, and a trailing /* also matches everything under the path (for example, /checkout/*). After identifying, the script appends the device’s visitor ID to the dub_id cookie (<clickId>_<visitorId>). Lead and sale tracking send the full value, so pass the cookie as is when you track conversions from your server too. If identification fails, dub_id keeps its original value and conversions are still attributed to the partner.

Setting up identity tracking

Here’s how you can set up identity tracking with the Dub Analytics script:
If you also track conversions on the client, don’t replace your conversion tracking script with script.identity.js, or trackLead and trackSale stop working. Use the combined variant script.conversion-tracking.identity.js with your existing data-publishable-key, plus any other variants you use. The DubAnalytics component picks the combined variant for you, unless you set scriptProps.src.
We recommend loading the script through a reverse proxy, so ad-blockers don’t stop identification.

Identifying visitors conditionally

If you want to conditionally identify visitors instead, set the paths to an empty list (trackIdentityPaths={[]} or data-track-identity-paths='[]') and call dubAnalytics.trackIdentity() (or trackIdentity from useAnalytics()) yourself. Identification takes a few seconds. If a button on the page sends the visitor to another site right away, like “Sign in with Google”, the visitor can leave before it finishes. Wait for trackIdentity() before the redirect, with a time limit so sign-in never waits long:
React/Next.js
With the script tag, call dubAnalytics.trackIdentity() the same way. It returns right away when there is nothing to identify, so other visitors don’t wait.