/Journal

Setting up server-side GTM: the four decisions that matter

GuideServer-side2026.11.04
Freek Kampen
Freek KampenCo-founder, New North Digital

Creating the server container takes a few clicks. Hosting, domain, routing and testing decide whether it works in production.

The easy part

In Tag Manager you create a new container and pick Server as the platform. Tag Manager then asks how you want to provision the tagging server. Most tutorials spend their time on these clicks, and they're the quick part.

The work is in the four decisions below. They decide whether the setup holds up in production.

1. Where the server runs

Tag Manager offers to provision a server for you on Google Cloud. Google itself says that setup is for testing only. It runs in us-central1 in Iowa, whatever country your visitors are in, and it doesn't support a production workload. Fine for learning, not for a shop.

For production there are two routes. You run it yourself on Cloud Run: Google recommends at least two instances, each with 1 vCPU and 0.5 GB of memory, at roughly $45 per instance per month. Or you choose manual provisioning and paste the config string into a hosting service such as Stape or Taggrs.

We compared both routes, costs included, in Cloud Run or Stape.io and Taggrs or Stape.io.

2. Which domain it sits on

On its default run.app address the server can't set server-side cookies at all. Then you've paid for server-side tagging and kept the browser's limits.

Google's best practice is same origin: the server answers on a path of your own site, such as example.com/metrics, through a CDN or load balancer. The alternative is a subdomain like metrics.example.com, pointed at the server with DNS records. Either way, enter the URL in the server container under Container Settings.

3. How data gets there

Your web container keeps doing the collecting. Add a Google tag configuration variable with the parameter server_container_url set to your server's URL, attach it to the Google tag, and fire that tag on Initialization. The GA4 client in the server container picks the requests up.

From there you add a tag per platform in the server container: GA4, Google Ads, Meta and so on. You decide per platform what goes out.

4. Testing before anyone depends on it

A broken server container breaks every platform at once, including the conversions your ad campaigns bid on. Open preview mode in the web and the server container together and follow one event all the way through. Add /healthy to your server URL: it should answer "ok".

If you run Cloud Run yourself, set a maximum number of instances to cap costs, and consider switching request logging off above about a million requests a month. Google warns that logging adds significant cost at that volume.

The full click-by-click walkthrough is on newmetrics.io. If you'd rather have it set up for you, see server-side tagging.

Want to talk about this?

Do your numbers add up?

One call is usually enough to see where it breaks.

Takes 1 minute