Server-side GTM (sGTM) is a Google Tag Manager container that runs on a server you host instead of in the visitor’s browser. Your site sends requests to that server, usually on a subdomain such as data.yourdomain.com. Inside the container, clients turn each request into an event and tags forward that event to GA4, Google Ads, Meta, TikTok or any other API. Same Tag Manager interface, different place it runs.

This guide covers the mechanics: how clients and tags divide the work, how the Google tag reaches the server, what one purchase looks like on its way through, and what hosting costs. If you are still deciding whether server-side tracking is worth it at all, start with the server-side tracking guide. It covers what the server path fixes, what it doesn’t and the decision checklist.

I’ve run client containers on managed hosting and on our own Docker servers, and I’ve retired two of them. The examples below come from those containers, with client names removed.

Clients take requests in, tags send them out

A server container has two halves.

Clients receive. Each incoming HTTP request is offered to the clients in priority order, highest first. A client that recognizes the request claims it, and Google’s server-side tagging introduction is explicit that claiming “prevents subsequent clients from running.” The claiming client parses the request into event data. Server containers come with a Google Analytics client pre-installed, and it handles the GA4 format the web Google tag sends.

Tags send. Triggers examine each event and fire tags when their conditions match. A GA4 tag forwards the event to Google Analytics, a Meta tag maps it to a Conversions API call, a TikTok tag to the Events API. Each tag decides what its destination receives.

Client priority is where custom setups go wrong. If you add a webhook client or a custom loader client with a higher priority and loose matching rules, it can claim requests your GA4 client was meant to get, and the GA4 tag never fires.

Route the Google tag to the server

The web container decides where browser hits go. Google’s send-data guide (updated 2026-10-13, checked 2026-10-17) describes the current way:

  1. In the web container, create a user-defined variable of type “Google tag: Configuration settings”.
  2. Add the parameter server_container_url with your server container URL as its value.
  3. Select that variable in the Configuration settings of the Google tag or the Google Analytics destination tag.
  4. Fire that tag on the Initialization - All Pages trigger, so the route is set before other tags run.

GA4 event tags that share the measurement ID inherit the route. On a travel client’s container I audited in October 2026, the Google tag set server_container_url from a variable still named transport_url, an older label for the same idea, and both GA4 event tags (generate_lead and view_item) inherited it. The name of the variable doesn’t matter. What reaches the browser’s Network panel does.

On the server side, the GA4 client claims the request and a GA4 tag forwards it. Google notes that this option “doesn’t send events to the Measurement Protocol endpoint”. The Measurement Protocol is for backends and webhooks that call GA4 directly. Either way there is one path to GA4. Don’t run a separate browser GA4 tag to the same property beside it: GA4 deduplicates only purchases, by transaction_id, and only on web streams (Google Analytics Help). Every other event would count twice.

Event ID deduplication is a Meta and TikTok concept. There you send the same event from the browser pixel and from the server with a shared event_id, and the platform keeps one.

The GA4 client can own the visitor ID

The same travel client’s GA4 client was set to manage the cookie on the server: cookieManagement: server, cookie name FPID, max age 34,560,000 seconds (400 days), set as HttpOnly on the site’s domain. That means the client ID GA4 receives is derived from a cookie page scripts can’t read.

That matters when you leave. On 2026-10-09 I compared the two IDs in a real browser before retiring the container. The browser’s Google tag sent one client ID, and the server forwarded a different, FPID-derived one. Going direct to GA4 would hand it the browser’s ID instead, so a visitor whose two IDs differ shows up under an ID GA4 hasn’t seen and splits from their earlier history. The client accepted that break before the switch. If you make the same move, compare your user metrics for the weeks after it rather than assuming the size of the effect. If you inherit a container, read the GA4 client’s cookie settings before you change the route in either direction.

One purchase, traced through the container

Here is the path of one purchase in a typical container. Use it as a checklist in server Preview.

  1. The browser sends a collect request with en=purchase, the transaction ID, value and items to data.yourdomain.com. Check its host and status code in DevTools.
  2. In server Preview, the request appears in the left panel. The Request tab shows which client claimed it. It should be the GA4 client.
  3. The Event Data tab shows event_name: purchase, transaction_id, value, currency and the items array the client parsed.
  4. The Tags tab shows which tags fired. A typical trigger is Client Name equals GA4 plus Event Name equals purchase.
  5. Back in the Request tab, the outgoing HTTP requests list what each tag sent to GA4, Meta, Google Ads or TikTok, with the response status.

A 200 from a destination proves it accepted the request, nothing more. Confirm receipt and parameter values in the destination’s test view (Meta Test Events, GA4 DebugView). Confirm deduplication where the destination reports it, such as Meta’s Test Events and Events Manager. Attribution is a separate question, answered later in the platform’s attribution and campaign reports.

Flow diagram: a web GTM container feeds a server GTM container, which forwards to Meta CAPI, GA4, Google Ads and TikTok Events API.
The browser talks to one server container you own, and the container talks to each platform. Where you host it doesn't change that routing.

If Preview stays empty while the web tag fires, the sGTM debug ladder checks each layer in order.

Server-side GTM vs client-side GTM

Web container Server container
Where it runs Visitor’s browser A server you host
Talks to platforms from The visitor’s device Your infrastructure
Ad blockers Frequently blocked Less affected; path-based rules can still block a custom subdomain
Cookies in Safari Set by JavaScript: deleted after 7 days without interaction Set in the HTTP response: longer-lived, unless WebKit detects CNAME or IP cloaking (7-day cap)
Page weight One script per platform Lighter only for tags moved fully to the server
Data control Each tag takes what it collects You choose every field per platform
Running cost Free Hosting, see below

The Safari row follows WebKit’s tracking prevention rules (checked 2026-10-17). Verify the expiry in Safari’s Web Inspector on your own domain a week after go-live rather than trusting the table. The first-party vs third-party cookies guide explains the rules in detail.

Where to host it, and what it costs

The container is free to create in GTM. Hosting is the bill.

Google Cloud Run is the documented path. Google’s Cloud Run setup guide (checked 2026-10-17) prices its configuration, 1 vCPU and 0.5 GB of memory per instance with CPU always allocated, at approximately US$45 a month per server, and recommends a minimum of two instances to reduce the risk of data loss during an outage. That is roughly US$90 a month before traffic and networking. You may run one instance for less, accepting the outage risk. The guide also has you deploy a separate preview server, which Tag Manager’s Preview mode needs. You own load balancing or domain mapping, certificates, logs and scaling.

To see that bill next to the Stape plan your traffic needs, run your monthly requests through the sGTM hosting cost calculator.

The server container ships as a Docker image, so it runs anywhere that keeps an always-on HTTPS endpoint. One of our own content sites ran it on a Docker Swarm cluster behind a Cloudflare Tunnel: one service for the tagging server, one for the preview server, one for the tunnel connector, and an uptime probe on the /healthy path. The operations work is the same as on Cloud Run, only on hardware you already pay for.

A managed host runs the container, the custom domain and certificates for you, and gives you readable logs. I run client containers on Stape. Its plans, checked 2026-10-17: Free up to 10,000 requests a month, with the container paused and disabled once you exceed the limit until you upgrade (Stape helpdesk); Pro at US$20 a month, or US$17 a month billed annually, for up to 500,000 requests; Business at US$100, or US$83 billed annually, for up to 5 million. Read Stape’s own definition of a request before you size a plan from your GA4 event counts.

Your time is the larger cost. Mapping parameters, deduplication and webhook validation take far longer than provisioning. Price the build against the events you are actually missing: measured missing purchases times their value, against hosting plus setup plus monitoring.

Before you go live

What the server path fixes, and the things it can’t fix (dirty data layers, consent, attribution), are covered in the server-side tracking guide. Purchases should come from a confirmed payment webhook instead of the thank-you page, as the Stripe conversion tracking guide shows. Platform tags with browser twins need deduplication: the Meta Conversions API guide and the TikTok Events API guide cover each side. For a durable record of what the container received after Preview closes, the sGTM event database guide logs selected events to Postgres.

If you set up sGTM across several sites, the ATA Tracking Toolkit membership includes a library of server GTM containers as a bonus.

For partner delivery, see one dynamic sGTM tag with a tenant-scoped lookup. It covers which webhook events qualify and why browser-only partner codes stay out of affiliate delivery.

If LinkedIn is one of your destinations, use the LinkedIn Conversions API setup guide to check the outgoing rule, timestamp and event ID against its own request contract.