Connecting Visits Across Domains in GA4: Handling IDs and Payment Providers Correctly

Summary
A purchase journey can cross several website addresses, for example from a shop to a separate checkout. Cross-domain measurement helps Google Analytics recognise that journey as one connected visit. This makes marketing results easier to interpret. Excluding a payment provider as a traffic source serves a different purpose: it prevents the payment step from appearing to have brought the customer. Connecting visits and identifying their source therefore require distinct settings and appropriate consent.
Contents
A shop at example.com sends checkout traffic to example.net. Without shared identifiers, GA4 can count the journey as separate visits. Cross-domain measurement passes identifiers during that move. The unwanted referrals list has a different purpose: a payment provider should not become the apparent source of a purchase simply because the confirmation page opens after payment.
What _gl carries
With appropriate consent, GA4 stores identifiers in cookies. A client ID identifies a browser, not a verified person. A page at example.net cannot simply read the cookie belonging to example.com. The relevant context is the page running the script. A JavaScript file downloaded from another server normally runs in the context of the page embedding that file.
When a matching link is clicked, the Google tag adds _gl to the destination address. This linker parameter carries measurement identifiers. The destination tag can store corresponding cookies and connect the visit. Google documents a two-minute lifetime. A saved address with an old parameter is therefore unsuitable for a fresh test. An invalid parameter does not always create a new identity: the destination may already have a valid cookie.
The parameter does not replace consent or guarantee a complete journey. Missing tags, blocked requests and expired cookies can still leave gaps. The internal character sequence in _gl should not become a hard-coded value in links or analysis code.

Connecting the two websites
Both websites need the same Google tag with the same G-ID from the same web data stream. The data stream is the shared input for website events in GA4. The configuration is available under Admin, then Data streams and the relevant web stream. The tag settings contain the domain configuration. The domain list covers the participating websites. Testing then covers both directions.
An exact match is easier to inspect for known full hostnames than a broad “contains” rule. For example, example.com.unrelated-domain.test also contains the text example.com. Additional subdomains need suitable rules. Actual links and forms must match the configuration.
JavaScript navigation and scripts that intercept clicks can prevent automatic linking. A manual linker configuration also needs attention to forms: decorate_forms defaults to false there. An iframe embeds another page, such as a booking form, inside the current page. The standard domain configuration does not automatically solve that case. postMessage can pass messages between windows but does not configure GA4 by itself. A custom solution needs an exact target origin and checks on the sender and message contents; origin means the protocol, hostname and port.
What unwanted referrals change
A referral here means the previous website that GA4 can identify as a traffic source. Under tag settings → Show all → List unwanted referrals, suitable payment-provider domains can be added. GA4 adds ignore_referrer to matching events so that the referrer does not count as a source. This setting does not pass a client ID or connect separate cookies. The older name “Referral Exclusions” is therefore no substitute for checking today’s domain configuration.
For example, a shop sends a payment to an external provider and receives the return to its confirmation page. Without access to the provider’s tags, a shared measurement setup cannot be implemented there. The shop cookie may nevertheless remain available on return. A missing _gl on that return path is therefore not proof of failure.
An active session can continue. After 30 minutes of inactivity by default, a new session can begin; the timeout is configurable. That new session is not necessarily reported as direct. Previous sources and the report metric can affect attribution. The exclusion list also does not guarantee that all purchase value returns to the original campaign. Earlier referral assignments can remain visible in later reports.

Checking a specific test journey
- A permitted measurement test in the same browser, with a quick move from example.com to example.net, creates comparable conditions. The return journey is tested separately.
- The “Preserve log” option in the browser developer tools must be enabled so that the network log remains available after navigation. The clicked link and each redirect show whether
_glsurvives. Depending on the address, the separator can be a question mark or an ampersand; a custom linker configuration can also use the fragment after #. - Measurement requests from both pages are compared. The destination G-ID and page address must belong to the test. Client and session identifiers are often visible as
cidandsid. This network representation is not a permanently guaranteed API format. - Matching identifiers in the short test support successful transfer. Expected events must also arrive. An identifier accidentally hard-coded across all browsers would not be a success. A different session ID after a long pause can instead be correct.
If values differ, troubleshooting follows the journey: domain rule, click or form, redirects, parameter age, destination tag, cookie settings and consent state. An address-bar screenshot alone cannot show whether GA4 actually accepted the identifiers.
Questions and answers
Do shop.example.com and blog.example.com always need _gl?
With automatic cookie-domain configuration, both subdomains can use the same cookie on example.com. Different cookie domains or cookie names can prevent that sharing. Google’s help also recommends domain configuration for relevant subdomain cases. The identifiers actually used remain the decisive check.
What about caching and redirects?
A cache stores ready-made pages to answer repeated requests faster. The cache key consists of the features used to decide whether a stored copy matches a request. The query string is the parameter part of the URL. If the cache key includes the full query string, differing _gl values can create extra entries. That does not mean every request must miss the cache. Excluding _gl from the cache key is appropriate only when the response remains unchanged; personal pages still need their own safeguards. The browser address must retain the required parameter until the destination tag processes it. Redirects must not accidentally discard the transfer.
Sources
- Google Analytics Help: Set up cross-domain measurement
- Google Tag Platform: Measure activity across multiple domains
- Google Analytics Help: Identify unwanted referrals
- Google Analytics Help: About Analytics sessions
- Google Tag Platform: Configure and customize cookies
- MDN: Same-origin policy
- MDN: Window.postMessage()
- IETF RFC 9111: HTTP Caching
- Google Analytics Help: Tag Manager consent mode support
- Google Analytics: Developer documentation


