Server-side Google Tag Manager (sGTM) is a Google Tag Manager container that runs on a server instead of in the browser. The browser or app sends a hit to your tagging server. A client inside the container turns that HTTP request into event data. Tags then forward the fields you select to analytics and advertising tools.
The container is a router with rules. It does not invent events that nobody sent, and it does not decide that a visitor consented.
How does a server container work?
A server container has three parts you configure.
- The tagging server URL. You host the container and usually map it to a hostname you control, such as
metrics.example.com. The website tag sends hits to that host. - A client. The client claims incoming requests that match its format and parses them into the event data model. The GA4 client claims Google Analytics 4 collection requests.
- Tags, triggers, and variables. A trigger decides when a tag runs. The tag maps event data into the destination's API. A variable reads one field, such as the event name or a consent flag.
Preview mode shows the incoming request, the event data the client built, and which tags fired. Use it before you publish. A tag that never fires is a configuration gap, not missing customer activity.
A concrete example
A site sends GA4 hits to https://metrics.example.com/g/collect. One request includes en=page_view and the GA4 measurement ID. The GA4 client parses that request and sets event_name to page_view.
A GA4 tag, triggered on all events the GA4 client claims, forwards page_view to Google Analytics. A second tag is triggered only when event_name equals purchase. It reads transaction_id, value, and currency from event data and sends a purchase to an ads API. A page view does not fire the purchase tag.
If the same purchase is also sent by a browser pixel, both copies need the same event ID. See event deduplication.
What are the limits?
The server only sees requests that arrive.
- Collection still starts on the device or in your backend. An ad blocker, a closed tab, or a denied permission can stop the hit before your container sees it. Hosting the endpoint on your domain does not guarantee the request is delivered.
- Safari ITP still applies. A first-party hostname does not disable Intelligent Tracking Prevention or grant a longer cookie lifetime than Safari allows.
- Consent is an input, not an output. Google Consent Mode and your consent platform still decide storage and ads behavior. The container should drop or trim fields when the incoming consent state does not allow the destination.
- Duplicate paths double-count. A browser tag and a server tag that both report
purchasefor orderorder-123need one shared ID or the destination may count two purchases. - Diagnostic traffic is not a conversion. A
gtg_health=1request checks that the Google tag loaded. Do not map it to a business event.
Moving a tag to the server can shorten the work the browser does for that tag. It does not repair a wrong event name, a missing transaction_id, or a purchase that the checkout never recorded.
How Hardal handles it
Hardal hosts the server-side GTM container, along with other server destinations, so the tagging server is not a separate cloud project you have to run. The container still forwards only the events your site, app, or backend sends, and only the fields its tags are allowed to use.
For the collection pattern around the container, see server-side measurement. For a direct backend call that never passes through the browser, see server-to-server. The cookieless GA4 setup shows how consent state and the server container fit together.
Related terms: Server-side measurement, Server-to-server, Event deduplication
Frequently asked questions
Is server-side GTM the same as server-side tracking?
Server-side GTM is one way to run server-side tracking. It is a Google Tag Manager container on a server. Other pipelines can collect and forward events without using that container.
Does a first-party tagging domain bypass Safari ITP?
No. Pointing the Google tag at your own hostname does not turn off Intelligent Tracking Prevention, extend a cookie Safari has capped, or make a blocked request succeed.
Does the server container replace a consent choice?
No. The container can read a consent state that arrived with the request and skip a tag when consent is missing. It cannot create a permission the visitor did not give.
What is gtg_health=1?
gtg_health=1 is a lightweight check that the Google tag loaded. That request can still go to googletagmanager.com when your other hits use the server container. It is not a conversion.