Lesson 1 of 3
Cross-Domain Linker
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
GA4 identifies a session with a client ID stored in a first-party cookie, and cookies don't cross domains. So when a visitor moves from yourdomain.com to a checkout on shop.example.com, GA4 would normally start a brand-new session and lose the source that drove it, attribution broken at the worst moment.
Cross-domain measurement fixes this. List both domains in your Google tag and GA4's linker decorates outgoing links with a _gl parameter that carries the client ID across. The destination reads _gl and continues the same session.
The button below points at a different domain. Configure the linker, then confirm the outgoing URL gains a _gl= parameter.
Goal
Configure cross-domain measurement so the GA4 session survives the hop to a second domain.
Build it in GTM
Open your Google tag
Go to Tags and open your Google tag (or GA4 Configuration). Cross-domain settings live on the tag that loads GA4.Configure your domains
- Open Configuration settings → Configure your domains (under cross-domain).
- Add every domain in the journey, e.g.
yourdomain.comandshop.example.com. - Save. GA4 now decorates links between those domains automatically.
Confirm the
_glparameterHover or inspect a link to the other domain: it should gain a_gl=parameter. That's the linker passing the client ID across.
Debug in Tag Assistant
Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.
- In your GTM, click Preview.
- Paste the live URL above and click Connect.
- Interact with the live page and watch your tag fire in Tag Assistant.
What you should expect to see
shop.example.com carry a _gl= parameter, and GA4 continues one session instead of starting a new one.Verify your container
Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.
Drop your container .json here
or browse · checked in your browser, nothing is uploaded