GA4 & Tracking

GA4 Cross-Domain Tracking: Setup, Testing and Common Failures

When GA4 cross-domain tracking is needed, how to configure your domains and the _gl linker, handle iframes and payment gateways, and fix what breaks it.

GA4 Cross-Domain Tracking: Setup, Testing and Common Failures
Quick answer

GA4 cross-domain tracking keeps one user and one session when visitors move between separate domains you own, such as a main site and a checkout domain. Add every domain under Configure your domains in the Google tag settings, so links carry the _gl parameter. Subdomains do not need it; payment gateways belong in unwanted referrals.

Key takeaways
  • Cross-domain measurement is for separate domains you control, not subdomains.
  • Configure it in GA4 Admin under the Google tag's Configure your domains setting.
  • The _gl parameter must survive redirects until the destination tag reads it.
  • Iframes and booking widgets need postMessage or vendor events instead.
  • List payment gateways as unwanted referrals so they stop taking credit for sales.

A visitor clicks your Google ad, browses your main site, then moves to a checkout, booking or funnel page on a different domain to pay. In GA4 that purchase often shows up as a brand-new session with your own website as the referral source, and the ad that started the journey gets no credit. Your reports look as if your homepage is your best marketing channel.

That is what GA4 cross-domain tracking fixes. In this guide I explain when you actually need it, how to set it up in the Google tag settings, how the _gl linker parameter works, and the failures I find most often when I audit a broken setup.

What is GA4 cross-domain tracking?

GA4 cross-domain tracking, which Google calls cross-domain measurement, lets GA4 treat a visitor moving between two or more of your domains as one user in one session. Without it, each domain sets its own first-party _ga cookie with its own client ID, so GA4 sees two different users.

Cross-domain measurement solves this by passing the visitor's identifiers from one domain to the next in a URL parameter called _gl. The destination domain reads _gl, reuses the same client ID and session, and the journey stays connected.

When do you need cross-domain tracking in GA4?

You need cross-domain tracking when one user journey crosses separate registered domains that you control and that run the same GA4 property. Typical cases I see:

  • A marketing site on brand.com with a checkout on brandshop.com.
  • A service business site that sends visitors to a booking or quote page on a separate domain.
  • A main site linked to a funnel builder or landing page on its own domain, for example a GoHighLevel funnel. My GoHighLevel conversion tracking page covers that setup.
  • Separate country domains, such as brand.com and brand.co.uk, that share one property.

When you do not need it

You do not need cross-domain tracking for subdomains of the same domain. www.brand.com, shop.brand.com and book.brand.com share cookies automatically, because the Google tag sets the _ga cookie on the top-level domain by default.

You also cannot use it for domains you do not control. If a payment gateway or booking vendor will not let you add your Google tag, cross-domain measurement has nothing to connect on the other side. That case needs the referral settings below or a different tracking method.

Situation Cross-domain needed? What to do instead
brand.com → checkout.brand.com No Nothing, cookies are shared
brand.com → brandshop.com (your tag on both) Yes Configure both domains
brand.com → PayPal or Stripe hosted page No List them as unwanted referrals
Booking widget in an iframe from a vendor Usually no Use postMessage or vendor events

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

You set up cross-domain tracking in the GA4 Admin by adding every domain to the Configure your domains list in your web stream's Google tag settings. Google recommends this Admin method over editing tag code, and it works whether you install the tag with gtag.js or Google Tag Manager (GTM).

  1. Make sure the same GA4 measurement ID, or the same Google tag, loads on every domain in the journey.
  2. In GA4, go to Admin → Data streams, and open your web stream.
  3. Click Configure tag settings, then Configure your domains.
  4. Add a condition for each domain, for example "contains" brand.com and "contains" brandshop.com.
  5. Save. The setting applies to the Google tag, so you do not need to republish anything in GTM.

Once saved, the Google tag automatically decorates links and forms that point to the listed domains with the _gl parameter. GA4 may also show an "additional domains detected" notification in Admin when it sees your tag firing on domains you have not listed. That is a useful hint, but check each suggested domain before adding it.

Do you still need the Conversion Linker in GTM?

If you run Google Ads tags through GTM, keep a Conversion Linker tag firing on all pages, on every domain. The GA4 domain setting handles the GA4 identifiers. The Conversion Linker stores ad click information, such as the gclid, in first-party cookies for Google Ads conversions, and it has its own option to enable linking across domains. If you are still building your Google Ads conversion actions, my guide to Google Ads conversion tracking with GTM covers the Conversion Linker in detail.

How does the _gl linker parameter work?

The _gl parameter is a short, encoded value the Google tag adds to the destination URL, containing the visitor's Google cookie values and a timestamp. A decorated link looks something like this:

https://brandshop.com/checkout?_gl=1*abc123*_ga*MTIzNDU2Nzg5LjE3MDAwMDAwMDA.*_ga_XXXXXXX*...

When the page on brandshop.com loads, its Google tag reads _gl, sets the same _ga cookie values on that domain and continues the session. A few things to know:

  • The parameter is time-limited by design, so a link copied and opened later will not link the session. This is intentional, to stop shared URLs from merging different people.
  • The tag adds _gl when the user interacts with the link, not when the page loads. Viewing the page source will not show it.
  • The destination page must keep _gl in the URL until the Google tag has read it.

What about iframes and booking widgets?

Cross-domain measurement does not automatically work inside iframes. An embedded booking widget, calendar or payment form from another domain is a separate document, and the Google tag on your page does not decorate the iframe's source URL.

You have three realistic options:

  1. Use the vendor's own tracking. Many booking and scheduling tools send events to the parent page or offer a GA4 or GTM integration. Check that first.
  2. Listen for postMessage events. If the widget sends a browser message when a booking completes, a listener on your page can push a dataLayer event and fire your GA4 and Google Ads tags on your own domain. I explain this in my guide to tracking bookings from transportation booking software, and the same approach works for any widget.
  3. Decorate the iframe URL yourself. If you control the iframe content and it runs the same tag, you can append the linker parameter to the iframe source with custom code. This is fragile, and I only use it when the first two options are not available.

For most small businesses, tracking the confirmation on the parent page is cleaner than trying to merge sessions inside the iframe.

How do you exclude payment gateways from referrals?

You exclude payment gateways by adding them under List unwanted referrals in the same Google tag settings. When a customer pays on PayPal, Stripe or a local gateway and returns to your thank-you page, GA4 can record the gateway as a referral, and the purchase gets attributed to paypal.com instead of your ad.

  1. Go to Admin → Data streams → your web stream → Configure tag settings.
  2. Click Show all, then List unwanted referrals.
  3. Add a condition for each gateway domain, for example "referral domain contains" paypal.com.
  4. Save, and add any other gateways or third-party checkout domains you use.

This does not fix past data, only traffic from the moment you save. It also does not replace cross-domain measurement: an unwanted referral only stops a domain being credited, it does not join two of your own domains into one session.

How do you test cross-domain tracking?

You test cross-domain tracking by following a real journey across your domains and confirming the same client ID and session continue on the other side. My routine:

  • Open your site from a test ad URL or a link with UTM parameters, using my UTM builder if needed.
  • Click through to the second domain and check the address bar for _gl.
  • In Google Tag Assistant, confirm the _ga cookie value is the same on both domains.
  • In GA4 DebugView, confirm events from both domains appear in one stream for one device.
  • Complete a test conversion and check it carries the original source and medium.
  • After a few days, check the Traffic acquisition report for your own domains or payment gateways showing up as referrals.

Why does cross-domain tracking still break?

Cross-domain tracking usually breaks because something removes _gl or stops the tag from decorating the link. The failures I find most:

  1. Redirects that strip parameters. An http to https, www or language redirect on the destination drops the query string. Make sure redirects keep all URL parameters.
  2. Links fired by JavaScript. Buttons that navigate with window.location instead of a normal link are not decorated. Use real <a href> links where you can.
  3. Forms that submit through script. Standard forms pointing to a listed domain are decorated, but forms submitted by custom JavaScript or AJAX often are not.
  4. Different measurement IDs. Each domain sends to a different GA4 property, so there is nothing to join.
  5. Consent banners reloading the page. A banner that reloads after consent can drop the parameter. Check how consent affects tag loading in my Consent Mode v2 guide.
  6. Missing tag on the destination. The second domain never loads the Google tag on the first page the visitor lands on.

Final thoughts

Cross-domain measurement is a small setting with a big effect on attribution: one list of domains, one list of unwanted referrals, and a careful test of the real journey. If your GA4 reports still credit your own site or PayPal for sales, my advanced conversion tracking service includes a full journey audit, or you can book a free tracking audit.

Related
Chamok Mahonto
Written by Chamok Mahonto

I'm a conversion tracking & google ads specialist from Rangpur, Bangladesh. I set up GA4, GTM, server-side tracking and Meta Conversion API, and manage Google Ads for businesses worldwide. More about me

FAQ

Frequently asked questions

Do I need cross-domain tracking for subdomains in GA4?

No. By default the Google tag sets its cookies on your top-level domain, so www.brand.com and shop.brand.com share the same client ID automatically. You only need cross-domain measurement when the registered domains are different.

Why does my own domain show up as a referral in GA4?

Self-referrals usually mean the session broke between two of your domains, either because cross-domain measurement is not configured or because the _gl parameter was lost. A page on your site that loads without the Google tag and then links back can cause it too.

Can I set up GA4 cross-domain tracking in Google Tag Manager?

You can, but Google recommends configuring the domains in GA4 Admin under the Google tag settings, which applies to tags deployed through GTM as well. In GTM itself, keep the Conversion Linker tag running on all domains for Google Ads.

Does cross-domain tracking work with Consent Mode?

Yes, but what gets passed depends on consent. If analytics cookies are denied, there are no _ga cookie values to share. Make sure your consent banner does not reload the page or strip URL parameters on the destination domain.

Is the _gl parameter bad for SEO?

It is added only when a user clicks a link, not to the links search engines crawl in your HTML, so it does not normally create duplicate URLs. If decorated URLs appear in your analytics or search reports, check that your canonical tags point to clean URLs.

Keep reading

Related articles

Ready to fix your tracking and scale your ads?

Get a free audit of your tracking and ad account. Usually replies within 1–2 hours.