Module 9
Cross-domain linker configuration
Configure GA4 cross-domain measurement so sessions are not broken when visitors move between domains or subdomains.
What this does
When a visitor navigates from one domain to another (e.g. from example.com to checkout.example.io), GA4 cannot carry the session by default: the _ga cookie is domain-scoped. The cross-domain linker appends a _gl parameter to outgoing links, which the destination domain reads to reconstruct the session.
Without this, multi-domain funnels show inflated new-user counts and break conversion attribution.
GTM configuration (recommended approach)
Configure cross-domain directly in the Google Tag (GA4 Configuration Tag) rather than using a custom HTML tag. In GTM:
Tag: Google Tag (your GA4 Measurement ID)
Configuration parameters:
- linker.domains: ["checkout.example.io", "shop.example.io"]
- linker.accept_incoming: true
- linker.decorate_forms: true
In JSON (for GTM import or reference):
{
"tagType": "googtag",
"measurementId": "G-XXXXXXXXXX",
"configSettingsTable": [
{
"key": "linker.domains",
"value": ["checkout.example.io", "shop.example.io"]
},
{
"key": "linker.accept_incoming",
"value": true
},
{
"key": "linker.decorate_forms",
"value": true
}
]
}gtag.js direct configuration (without GTM)
If you are running GA4 without GTM:
gtag('config', 'G-XXXXXXXXXX', {
linker: {
domains: ['checkout.example.io', 'shop.example.io'],
accept_incoming: true,
decorate_forms: true,
},
});What accept_incoming does
When accept_incoming: true, the GA4 tag reads the _gl parameter from the URL on page load and restores the session from the linker value. Without this, the destination domain ignores the linker parameter and starts a new session.
Both the source and destination domains must have accept_incoming: true configured.
Subdomain tracking (no linker needed)
For subdomains of the same root domain (e.g. www.example.com and shop.example.com), you do not need the linker. Set the cookie domain to the root domain instead:
gtag('config', 'G-XXXXXXXXXX', {
cookie_domain: 'example.com', // Root domain - covers all subdomains
});The default auto value handles this automatically for subdomains, so in practice you only need to set it explicitly if the default is not working.
Verification
- Navigate from the source domain to the destination domain
- In GA4 DebugView on the destination domain, check the
session_id: it should match the session from the source domain - In the URL bar after navigation, you should briefly see a
_glparameter before it is cleaned up - In GA4 Realtime, the visitor should appear as a continuing session, not a new user
Common mistakes
- Listing only the destination domain, not the source domain, in
linker.domains - Forgetting to set
accept_incoming: trueon the destination domain - Using the linker for subdomains (unnecessary: use cookie domain instead)
- Adding the linker but not decorating forms (
decorate_forms: true): form submissions across domains will still break sessions