webtracking.org

Google Tag Manager (Server-Side)

A server container for Google Tag Manager that receives event streams on your own domain and fans them out to vendors from infrastructure you control.

Pricing
free
Open source
No
Self-hostable
Partial

INTEGRATES: google-tag-manager · google-analytics-4 · stape · bigquery

ALTERNATIVES: segment · rudderstack · snowplow · tealium-iq

Server-side GTM moves tag execution off the page. A server container running on your subdomain receives requests — typically from a slimmed-down web container — where clients parse them into a common event model, transformations reshape them, and server tags forward the result to vendor endpoints. Because the endpoint is first-party, you can set HttpOnly cookies, strip or hash fields before anything leaves your perimeter, and hide vendor destinations from the browser entirely.

How it models data

Google’s docs describe clients as “adapters between the software running on a user’s device and your server container”: each incoming request is claimed by whichever client can parse it, and the client turns it into one or more events. From there the familiar GTM model takes over — triggers examine each event and fire server tags that forward the data. Containers ship pre-configured with a GA4 client and tags, which is why GA4-to-server migrations are the common on-ramp.

Between client and tags sit transformations, and they are the privacy lever most teams under-use. Three types exist: Allow parameters (only explicitly listed parameters reach tags — everything else is dropped), Exclude parameters (strip specific fields), and Augment event (modify or add parameters). Each can be scoped to all tags, a tag type, or individual tags, gated by matching conditions, and ordered by priority. This is how you enforce “vendor X never sees email” as configuration rather than convention.

Implementation notes and gotchas

  • Production requires a custom (first-party) subdomain in front of the container; the default ownership-style URL is fine only for testing.
  • Google supports three deployment paths — Cloud Run, App Engine, or manual setup on any platform via the Docker image. Cloud Run is the current default recommendation.
  • Sizing, from Google’s own Cloud Run guide: run a minimum of 2 instances to reduce data-loss risk, at roughly $45/month (USD) each (1 vCPU, 0.5GB, CPU always allocated); autoscaling 2–10 servers handles about 35–350 requests/second depending on what your tags do.
  • Preview mode needs a separate preview server provisioned alongside the tagging server — a step people routinely miss, then wonder why debugging doesn’t work.
  • Vendor coverage depends on server-side tag templates, which still lag the client-side gallery; check that your critical vendors have server templates before committing.

The trade is operational: you now own an ingestion service. Someone has to size it, monitor it, patch the container image, set billing alerts, and pay the cloud bill. Managed hosts like Stape exist precisely to absorb that overhead.

Use it when you want first-party collection, control over what each vendor receives, and less JavaScript on the page — while keeping GTM’s authoring model. Look past it when nobody can own the infrastructure, or you actually want a warehouse-first event pipeline, where Snowplow or a CDP-style collector is the better shape.

Visit site → Docs