Lessons in this module
Lesson 17 of 20
Point Your Tag At A Tagging Server
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
Normally your GA4 tag sends every hit straight to google-analytics.com. The first move in server-side tagging is one setting: server_container_url. Set it, and the same tag sends the same hits to a tagging server you own instead.
You don't need Cloud Run for this lesson: this site hosts a small pretend collector, and you get your own private URL for it below. Point your Google tag at it, fire the tag, and the Server view panel shows your hits arriving, exactly what you'd see landing at a real server container.
One honest caveat: while server_container_url points here, your hits reach this collector instead of Google, and the collector forwards nothing. Perfect for a practice container; just remember to remove the setting afterwards if the tag is one you care about.
Goal
Set server_container_url on your Google tag and watch your own hit arrive at the collector.
Build it in GTM
Copy your personal collector URL
It's in the card below,https://…/api/sgtm/<your-session>. It's unique to you and remembers hits for about 30 minutes.Add server_container_url to your Google tag
In GTM open your Google tag (the GA4 config one), expand Configuration settings, and add a configuration parameter namedserver_container_urlwith your collector URL as the value. On an older GA4 Configuration tag, use Fields to Set with the same name.Make sure the tag fires on this page
The usual Initialization - All Pages (or All Pages) trigger is perfect: the tag's automaticpage_viewis all the collector needs.Preview the live page
Click Preview in GTM and connect it to this lesson's live URL. When your Google tag fires, your browser sends the hit to your collector, and the Server view below lists it within a couple of seconds.
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
/g/collect now targets your /api/sgtm/… URL instead of google-analytics.com, and the same hit appears in the Server view panel.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