Cross-domain linking
Use cross-domain linking when a user journey spans multiple domains that do not share a cookie base domain (for example, store.example → example-checkout.com). The d8a web tracker can preserve client and session continuity by decorating outbound URLs with a short-lived _dl parameter.
Installation
Cross-domain linking requires the web tracker to be installed on both the source domain and the destination domain.
Follow the Web tracker quick start on each domain first, then configure the linker.
Configuration
Configure the linker using set('linker', ...):
// Decorate links that point to these domains.
d8a('set', 'linker', {
domains: ['example-checkout.com'],
// Optional:
// decorate_forms: true,
// url_position: 'query', // default
// accept_incoming: true, // default when domains is non-empty
});
Options:
domains(required): Destination domains that should be decorated when a link or form submits to a matching hostname.decorate_forms(optional, default:false): When enabled, the tracker also decorates form submissions.url_position(optional, default:'query'): Where to place_dl('query'or'fragment').- Example (
'query'):https://example-checkout.com/checkout?_dl=<payload> - Example (
'fragment'):https://example-checkout.com/checkout#_dl=<payload>
- Example (
accept_incoming(optional): Whether the destination site should accept incoming_dl.- Default: enabled when
domainsis non-empty. - If you only want to accept
_dl(but not decorate outbound links), setdomains: []andaccept_incoming: true.
- Default: enabled when
Cookie overwrite behavior is controlled by cookie_update (see Configuration):
- If
cookie_update=false, existing cookies are not overwritten, but missing cookies can still be created.
How it works (technical overview)
At a high level:
- Outbound: When the user clicks an outbound
<a>(and optionally submits a form), the tracker checks whether the destination hostname matcheslinker.domains. If so, it appends a_dlparameter.- If multiple tracker instances (
d8a1,d8a2, …) run on the same page, they share one linker and still produce a single_dlvalue. The payload includes cookies for all configured properties / cookie prefixes across those instances. - Decoration is performed lazily on user interaction by listening to
documentevents:mousedownandkeyupfor links, andsubmitfor forms. Additionally, programmatic form submissions are handled by patchingHTMLFormElement.prototype.submit.
- If multiple tracker instances (
- Payload:
_dlcarries a compact, URL-safe encoding of the serialized d8a cookies (client + session cookies). The payload is:- short-lived (about 2 minutes), and
- protected by a non-secret fingerprint/hash (UA + timezone + language + time window + payload) to reduce accidental corruption.
- Inbound: On the destination domain, the tracker reads
_dlfrom the URL, validates it, and then strips_dlfrom the URL (usinghistory.replaceState) to keep the URL clean. Stripping happens regardless of whether validation succeeds. - Applying identity:
- If
analytics_storageconsent is denied, the tracker does not write cookies and instead keeps the incoming client id in memory for sending hits. - If consent allows cookies, the tracker writes incoming cookies using the current cookie settings (domain/path/prefix/etc.) and respects
cookie_update. - If not enough configuration is available yet to recognize the cookies contained in
_dl(for example, before property cookie prefixes become known), the tracker keeps the incoming payload and applies cookies incrementally as configuration becomes available. - When an incoming session cookie is applied, the tracker also seeds the in-memory session state so that an immediate
page_viewdoes not accidentally start a new session.
- If