Open Tracked/Guides/Server side cross domain tracking using cookie restore tag

Server side cross domain tracking using cookie restore tag

To follow a visitor across domains on the server, pass the ID in the link and set a first-party cookie for it on the second domain.

4 min read · Updated October 26, 2026

DDomain A cookieIID passed in linkDDomain B cookie set by its own server
In this guide
Key takeaways
  • Pass the client ID from domain A to domain B in a link parameter.
  • On domain B, set the first-party cookie from its own tagging subdomain, so it lasts and is not third-party.
  • For payment redirects, store the ID before the visitor leaves, and send the purchase from the server with it.

Browser rules treat each domain as separate, and a server container does not change that. What it adds is a way to set cookies that last, from each domain's own subdomain, and to join the pieces on the server. This page explains the technique for a typical two-domain set-up and the special case of off-site payments. It builds on multi-domain tracking, extending cookie lifetime and Safari ITP.

The standard route: linker parameter

1

Configure the domains in GA4

So the Google tag adds _gl to links from domain A to domain B.

2

Domain B reads _gl

The tag on domain B reads the client ID and uses it for its session.

3

Send events to domain B's tagging subdomain

The GA4 client there sets the first-party cookie in an HTTP response.

4

Check the client ID

It should match on both domains.

Trusted

Brands that grow on cleaner data

Stores and agencies use Open Tracked to see which ads earn the sale.

Restoring cookies on the second domain

If a returning visitor arrives on domain B without the cookie, the server can restore it. Open Tracked's Cookie Keeper keeps platform cookies on the server under a hash of an identifier (a customer ID, a cookie or a variable) and gives them back when the visitor returns. It works per container and domain, so use an identifier that is the same on both sites, such as a logged-in customer ID. It is on every plan and needs the Data Store. Use it only with consent.

Payment redirects

When a visitor leaves for a payment page on another domain and returns, the cookie and the parameters may be lost. Handle it like this:

  • Before the redirect, save the client ID, click IDs and fbp in the order or the payment metadata.
  • On the payment provider's success webhook, send the purchase from your server with those values. See Stripe purchase tracking.
  • On the return page, use the provider's return parameters, if any, and restore the cookies from the server.
Ask AI

Ask Ari instead of digging through reports

Ari reads your tracking and ad data and answers in plain words.

What to watch

SymptomA new session starts after payment
Likely causeThe return page has no linker parameter.
FixRely on the server-side purchase with the stored ID.
SymptomThe second domain shows referral from the first
Likely causeCross-domain is not configured.
FixAdd both domains.
SymptomCookies on domain B last only a week in Safari
Likely causeSet by a script.
FixSet them from the tagging subdomain.
SymptomConsent is missing on the second domain
Likely causeIt was given on the first.
FixPass or re-ask consent on the second.

Test

  1. Start on domain A from a tracked link.
  2. Click through to domain B and check _gl and the client ID.
  3. Complete a test purchase and watch both server Previews.
  4. Clear cookies on domain B, return and check that the cookie is restored (with consent).
  5. Compare the number of sessions and sources in GA4.
0 of 6 done
Data in, clean out

Raw events in. Clean events out.

Open Tracked collects each event on your own domain, removes the noise and sends what is left to Meta, Google Ads, TikTok.

Frequently asked questions

How do I track across domains with server-side tagging?

Pass the client ID in a linker parameter, and set first-party cookies on each domain from its own tagging subdomain.

How do I handle payment redirects?

Store the IDs before the redirect and send the purchase from the server on the payment webhook.

Can Cookie Keeper restore cookies across domains?

It restores per container and domain, using an identifier you share, such as a customer ID, with consent.

Why does the second domain start a new session?

The linker parameter is missing or the domain is not configured.

Is consent shared between domains?

Not automatically. Plan how to carry or re-ask it.

Do I need spreadsheets to read my results?

No. Once tracking is live, the Open Tracked analytics shows spend, revenue, ROAS and profit, and you can ask Ari, the built-in AI assistant, questions about your own numbers in plain words. Ari's allowance depends on your analytics plan.

Is Open Tracked different from Open Track or Open Space Track?

No. Open Tracked is the official name of our server-side tracking platform, and the website is opentracked.io. Many people search for it as Open Track, OpenTrack or Open Space Track. All of them lead to the same product: server-side Google Tag Manager hosting, first-party analytics and a CRM pipeline.

Fix your tracking at the source

Open Tracked hosts your server-side Tag Manager, keeps first-party cookies alive and shows what each ad is really worth.

Open Tracked
Written by

The Open Tracked team

We build Open Tracked: server-side tracking hosting, analytics and the tools around them, for stores that spend on ads. Questions about this guide, or an idea for the next one?

Write to us Read the docs

Was this article helpful?

Comments

Loading comments...

Turn better tracking into better marketing performance

Start free