Web SDK · v0.6.0
Cross-Domain Identity
Keep one visitor identity when customers move between your approved domains.
Cookies do not cross registrable domains, so a visitor moving from brand.example to shop.example would normally start a new anonymous identity. The linker carries the identity across with a short-lived, opaque token.
For subdomains of the same site, such as www.example.com and shop.example.com, use cookieDomain: '.example.com' instead.
Before you start
Add the destination domain to the linker allowlist in your site settings. Tokens are only issued for allowlisted domains.
Source domain: decorate the link
const target = await rtn.decorateLink('https://shop.example/cart');
location.assign(target);decorateLink resolves with the original URL unchanged when consent is not granted or a token cannot be issued, so navigation always continues.
Destination domain: nothing to call
init removes the token from the address bar before anything is recorded and exchanges it as soon as consent is granted. Events from that moment, including the automatic page view, wait for the exchange (at most 2 seconds) so they carry the carried-over identity. On success, the destination continues with the source's anonymous ID and starts a new session; on failure, events continue with the local identity.
The arrival from your own other domain is not recorded as a referral, so it cannot replace the campaign that brought the visitor in. Campaign parameters on the linked URL still count.
To await the result, or after an SPA navigation added a token to the address:
await rtn.acceptLinkerToken(); // true when the identity was carried overToken guarantees
- Opaque: the anonymous ID never appears in the URL.
- Bound to the destination domain it was issued for.
- Valid for 5 minutes and usable exactly once.
- Requires granted consent on both sides.