When a visitor crosses from your site to another domain and back, analytics sees two visitors unless you tell it otherwise. The classic case is a hosted checkout, booking page or payment provider on its own domain. This guide covers how GA4 and Google Ads stitch sessions across domains, exactly what to configure, the cases where it is not possible, and how to verify it.
When You Need It
- Store on
example.com, checkout oncheckout.provider.comorexample-checkout.com. - Booking on a vendor domain such as
cliniko.comoracuityscheduling.comwhere you can install your tags. - A marketing site on one domain and the app on another.
- A multi-brand group sharing one property across different root domains.
You do not need it for subdomains of the same root domain.
How It Works
GA4 appends a _gl parameter to links pointing at configured domains. It contains the client ID and session information, plus Google Ads click data when the Conversion Linker is configured for cross-domain. The destination page's GA4 reads the parameter and continues the session instead of starting a new one.
Step 1: Configure GA4
In GA4 Admin, open the web data stream, then Configure tag settings, then Configure your domains. Add every domain the visitor can cross between, including your own. Use the match type contains with the root domain, for example example.com and checkout-provider.com. Save.
This setting is read by the Google tag on every page, so both domains must run the same measurement ID.
Step 2: Configure the Conversion Linker
In GTM, open the Conversion Linker tag, enable Enable linking across domains, and list the same domains. This passes the Google Ads click ID across so a conversion fired on the second domain still attributes to the ad.
If the second domain has its own GTM container rather than yours, its Conversion Linker needs the same configuration.
Step 3: Unwanted Referrals
In GA4, Configure tag settings, then List unwanted referrals, add the other domains. Otherwise a visitor returning from checkout can be attributed to checkout-provider.com as a referral, overriding the original campaign.
Step 4: Install Tags on the Other Domain
Cross-domain only works if GA4 with the same measurement ID runs on both sides. Options:
- The vendor lets you add GTM or a tracking snippet: install your container there.
- The vendor has a GA4 integration field: enter the same measurement ID, and configure the domain list as above; the vendor's implementation must honour the linker parameter, which most official integrations do.
- The vendor allows nothing: cross-domain is impossible. Track the hand-off as an event on your site, use a redirect back to a thank-you page on your domain for the conversion, or listen for postMessage if the vendor is embedded. The Iframe Tracking guide on this site covers those patterns.
Step 5: Forms and JavaScript Navigation
The linker decorates standard links automatically. For forms that post to the other domain, enable Decorate forms in the Google tag's configuration. For navigation done in JavaScript, such as window.location.href = checkoutUrl, decorate the URL yourself:
// With the Google tag loaded, request a decorated URL
gtag('get', 'G-XXXXXXX', 'client_id', function () {});
// Simpler: use the linker API if available, otherwise let GTM decorate anchors and avoid JS redirects for cross-domain hops
In practice, the cleanest fix is to make cross-domain hops real anchor links or form posts, which the tag decorates reliably.
Subdomains and Cookie Domain
GA4 sets its cookie on the highest-level domain by default, so subdomains share sessions with no configuration. If a previous setup forced a cookie domain to a specific subdomain, remove that override.
Iframes
An iframe from another domain is not a navigation, so the linker does not apply. If you control the iframe page, install the same GA4 there and pass the client ID into the iframe URL as a parameter you read on load, or use postMessage from the parent to hand it over. For third-party iframes, see the Iframe Tracking guide.
Verification
- On your site, hover a link to the other domain. Click it and check the destination URL for
_gl=. If it is missing, the destination domain is not in the list or the link is built with JavaScript. - In GA4 DebugView, follow the session across domains: the same debug device should show page views from both hostnames in one session.
- In GA4 Realtime, after returning from the other domain, the session source should still be the original campaign, not the other domain as referral.
- For Google Ads, arrive with a test gclid, cross domains, fire a test conversion on the second domain, and after a day confirm it attributes to the campaign in Google Ads.
- Check for the
_glparameter on links to domains that should not have it, such as external partners; it should not be there.
Common Problems
- Parameter present, session still splits. The destination's GA4 is a different measurement ID or a vendor implementation that ignores the linker.
- Referral from the checkout domain. Unwanted referrals not configured.
- Conversions on domain two show no campaign. Conversion Linker cross-domain not enabled on one side.
- Parameter stripped. A redirect on the destination removes query parameters. Ask the vendor to preserve them, or land on a page that does not redirect.
- Works on desktop, fails on Safari. Safari may strip link decoration in some private modes; the parameter is also time-limited, so slow redirects can expire it. Keep hops direct.
Outcome
One session from landing to conversion across every domain in the journey, campaign attribution preserved in GA4 and in Google Ads, and checkout or booking domains no longer appearing as the source of your own sales.
