Server-side tagging sounds like an infrastructure project, and the first time you set it up it feels like one. But the modern path on Google Cloud is mostly guided, and knowing the few decisions that matter turns a daunting task into an afternoon. Here is how to stand up server-side GTM.

What you are actually building

Server-side GTM adds a tagging server, a small container running on your own cloud infrastructure, that receives data from the browser and forwards it to vendors like GA4 and Meta. Instead of the browser talking directly to every tool, it talks to your server, and your server decides what goes where. That shift is what gives you control over data, cookies, and privacy later.

Prerequisites

Two things must be in place before you start:

  • A Google Cloud project with a billing account enabled, which is required even if you stay within the free usage tier.
  • A subdomain you control, such as sgtm.yourdomain.com, that you can point at the server with a DNS record.

Provision the tagging server

Create a new Server container in Google Tag Manager, then open Admin and Container Settings. The automatic provisioning flow now deploys the server to Cloud Run, which is the recommended option and scales to zero when idle; App Engine remains available as the older scripted path. Choose automatic provisioning and let GTM create and configure the server for you.

Once provisioned, map your subdomain to the server with the DNS record GTM shows you, so data flows to sgtm.yourdomain.com rather than a Google URL.

Point your site at the server

With the server live, tell your GA4 tag to send data to it by setting the server container URL:

// Send the GA4 tag's hits to your own tagging server
gtag('config', 'G-XXXXXXXXXX', {
  server_container_url: 'https://sgtm.yourdomain.com'
});

In a client-side GTM setup you set the same value in the GA4 configuration tag rather than in raw gtag, but the effect is identical: the browser now sends to your domain.

Mind the cost and the redundancy

Cost surprises people less than they fear. A Cloud Run container that scales to zero typically runs about $15 to $80 a month for modest traffic, while the redundant multi-instance setup Google documents for production can reach a few hundred. Start small, scale the instances up only when traffic and reliability needs justify it, and monitor usage in the Cloud console.

Verify before you rely on it

Use GTM Preview on the server container and trigger events on your site, confirming the server receives them and forwards them to GA4. Check real-time reports to see the data landing. Only once you have watched a full event flow end to end should you move production traffic over.

Pick a region close to your users

When you provision, you choose a cloud region, and it is worth a moment's thought. A region near the bulk of your traffic keeps latency low, since every hit now makes a round trip to your server, and it can also matter for data-residency rules if you serve regulated markets. Picking the default without checking is a small decision that quietly affects speed for every visitor.

Plan for the upkeep

A tagging server is infrastructure, so it needs a little ongoing care rather than none. Google periodically updates the server image, so keep it current; watch Cloud Run logs and metrics for errors or unusual cost; and set a billing alert so a traffic spike never becomes a surprise invoice. None of this is heavy, but treating the server as fire-and-forget is how small problems grow unseen.

Server-side tagging looks like an infrastructure project and turns out to be a guided setup with a few real decisions. Enable billing, claim a subdomain, auto-provision the Cloud Run server, point your GA4 tag at it, and verify the flow before you trust it. Do that and the daunting project becomes the foundation every later privacy and data-control win is built on.

Want a stronger data analyst role or a raise? Grab the FREE Product Analyst Playbook and get the exact roadmap to your next offer.