Identity tracking is currently only available for select Dub
Enterprise customers. Reach
out if you’d like access.
Prerequisites
- You’ve set up a partner program on Dub.
- You’ve enabled client-side click tracking on your site.
- 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 thedub_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: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.
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
dubAnalytics.trackIdentity() the same way. It returns right away when there is nothing to identify, so other visitors don’t wait.