spyc.ai

Free tool

Cross-Domain Tracking Generator

List your domains and get the GA4 gtag linker config, the Admin steps and a referral exclusion checklist.

How it works

What is the Cross-Domain Tracking Generator?

The Cross-Domain Tracking Generator is a free tool that writes the GA4 linker configuration for a list of domains. Enter your measurement ID and the domains, and it returns the gtag('config', ...) snippet with linker.domains, the equivalent steps for the Configure your domains setting in GA4 Admin, and a referral exclusion checklist.

How to use the Cross-Domain Tracking Generator

  1. Enter the measurement ID that every domain shares.
  2. List the domains, one per line. Protocols, paths and www. are stripped for you.
  3. Tick Decorate forms if visitors cross domains by submitting a form.
  4. Copy the gtag snippet, or follow the Admin steps if you deploy through Tag Manager.
  5. Work through the checklist to confirm the setup.

What is cross-domain tracking in GA4?

GA4 identifies a browser with a first-party cookie, and a cookie belongs to one domain. When a visitor moves from example.com to example-shop.com, the second site cannot read the first site's cookie, so GA4 sees a new user and a new session whose source is the first site.

Cross-domain measurement fixes this by adding a _gl parameter to links between your domains. The destination reads the parameter and reuses the same IDs, so the journey stays one user and one session.

How do I set up cross-domain tracking in GA4?

There are two ways, and you need only one. In GA4 Admin, open Data streams, select the web stream, then Configure tag settings, then Configure your domains, and add each domain. Or set it in code with gtag('config', 'G-XXXXXXXXXX', { linker: { domains: [...] } }), which this tool writes.

Either way, every domain must load the same Google tag with the same measurement ID. If the tag runs through Google Tag Manager, use the Admin setting.

Do subdomains need cross-domain tracking?

No. www.example.com, blog.example.com and shop.example.com share one cookie, because the Google tag sets it on the highest-level domain it can. They are measured together without any linker.

The tool removes a subdomain from the list when its parent domain is already there, and tells you when the list contains only one root domain, since there is then nothing to link.

Why does my own domain show up as a referral?

It means the linker is not working for some path between the domains. Common causes are a redirect that drops the query string, a link built by JavaScript after the tag ran, a form submission without form decoration, or one domain loading a different measurement ID.

Google's documentation says domains in your cross-domain configuration are not counted as referrals. Adding your own domain to the unwanted referrals list hides the symptom while users are still split in two, so fix the linker instead.

What belongs on the unwanted referrals list?

Third-party sites that visitors pass through and return from in the middle of a session: payment processors, hosted checkout pages, login providers, booking engines. Without an exclusion, the return trip credits the sale to the payment provider. The setting is under Configure tag settings, Show more, List unwanted referrals.

To check campaign links that cross domains, run them through the UTM Governance Validator. To test for dropped query strings on redirects, the Broken Link Checker shows where a link ends up.

Questions

What is the _gl parameter?
It is the linker parameter the Google tag appends to links between your configured domains. It carries the client and session IDs so the destination can keep the same visit.
How do I test cross-domain tracking?
Click from one domain to the other and look for _gl in the landing URL. Then check GA4 Realtime or DebugView to confirm it stays one user and one session.
Does cross-domain tracking work across different GA4 properties?
No. The domains have to send data to the same web data stream, with the same measurement ID.
Should I use both the code and the Admin setting?
No. Pick one. Two configurations that disagree are hard to debug.
Is the Cross-Domain Tracking Generator free?
Yes, with a free spyc.ai account. It runs entirely in your browser, so nothing you type or paste is sent to a server.

Analytics Tools

More in Analytics Tools

GA4 Event Generator

Pick a GA4 recommended or custom event, add parameters, and copy the gtag snippet and dataLayer push.

Generate event

GA4 Measurement Protocol Builder

Build a GA4 Measurement Protocol request: JSON body, collect and debug URLs, and a curl command.

Build request

GTM dataLayer Generator

Write dataLayer.push code for GA4 ecommerce and custom events, with the GTM variables to create.

Generate dataLayer

Ready when you are

Before your next buyer asks AI about you, ask AI about yourself

One check, four engines, about twenty seconds. We show you the answers before we ask for anything.