Tracking and data

Server-side GTM on Google Cloud

Running server-side GTM directly on Cloud Run gives you full control of the infrastructure. It suits sites with specific data requirements or high traffic.

You need

  • Billed Google Cloud account
  • GTM admin rights
  • DNS access
  • gcloud basics

EU regions

  • europe-west1 Belgium
  • europe-north1 Finland

Cloud Run or Stape

  • Cloud Run 5 to 15 USD
  • Stape 20 to 50 USD

Why Google Cloud for server-side GTM?

Google publishes sGTM as an official Docker image for Cloud Run. You manage region, scaling, logging and security, and Cloud Run costs nothing when idle. A typical cost is 5 to 15 USD per month for normal traffic.

Technical requirements

You need a billed Google Cloud account, a GTM account with admin rights, DNS access for your domain and basic familiarity with Cloud Console or the gcloud CLI.

Setup, step by step

  • Create the server container in GTM.
  • Deploy the Cloud Run service with Google's image and your container config.
  • Run a separate preview server.
  • Map a custom domain with a CNAME record.
  • Update the GA4 transport URL.

Local test environment with Docker

A Docker Compose stack from December 2025 (by Simo Ahava) runs sGTM locally, including preview. It is useful for testing client templates and consent flows without touching production.

Cost: Cloud Run vs Stape

Cloud Run is about 5 to 15 USD per month and cheaper if you are comfortable with Google Cloud. Stape costs 20 to 50 USD per month but adds power-ups, support and a simpler interface.

Frequently asked questions

Which region should I choose?

An EU region such as europe-west1 (Belgium) or europe-north1 (Finland), to keep data in the EU under GDPR and reduce latency for Swedish sites.

What does Cloud Run cost for sGTM?

Roughly 5 to 15 USD for 100,000 sessions per month, billed per CPU-second and network traffic.

Can I move from Stape to Cloud Run?

Yes. The GTM container is independent of hosting. Provision a new Cloud Run instance, update the server container URL in GTM and repoint DNS.

What if the Cloud Run service fails?

Tracking data is lost during the outage. For critical tracking, run at least two instances and set up health checks.

Want to talk it through?

Tell me what you are working on and I will get back to you with straight answers.

Let's talk