LW IT Solutions logo LW IT Solutions logo LW IT Solutions
« Blog Overview /Digital Analytics / Hosting Google Tag Manager on Cloud Run:...
Read this article in other languages:

Hosting Google Tag Manager on Cloud Run: Planning Capacity, Reliability and Costs

Part 3 of 5 in the series From pixel to server: tracking that holds

Hosting Google Tag Manager on Cloud Run: Planning Capacity, Reliability and Costs

Management Summary

Cloud Run is a Google service that runs applications and adjusts available capacity as demand changes. It can host server-side Google Tag Manager, which receives and forwards website measurement data. This suits traffic that varies over time, but readiness has a cost: keeping capacity available reduces startup delays, while strict limits can cause failures during busy periods. The article explains this balance so operating costs and reliable measurement can be planned together.

Contents
  1. Architecture before tuning
  2. Warm capacity and scaling limits
  3. CPU, memory and concurrency
  4. A practical tuning cycle
  5. Questions and answers
  6. Sources

Server-side Google Tag Manager (ssGTM) receives measurement requests and sends configured events to selected destinations. Cloud Run supplies the container infrastructure and adjusts the instance count to demand. An instance is a running copy of the server application. Reliable operation still depends on the tags, consent rules, resource settings and monitoring. A successful browser response alone does not prove delivery to every destination.

Architecture before tuning

Google’s Cloud Run setup separates a preview server from the tagging server for live traffic. The official provisioning guide covers both. A manually created tagging service needs the actual CONTAINER_CONFIG from GTM and the correct PREVIEW_SERVER_URL; a fabricated Base64 string is not a working configuration. Public reachability, the custom domain and the web container’s transport settings also require verification.

The published server container controls which clients claim requests and which tags run. GA4, Meta and TikTok forwarding require separate configuration and applicable consent controls. Cloud Run alone adds none of these integrations. The official image’s stable tag can change; an update needs deployment and validation, rather than an assumption that running instances automatically refresh.

ssGTM on Cloud Run: measure before scaling; Separate services; Preview and live tagging; Minimum instances; Warm capacity, not zero cold starts; Maximum instances; Scaling limit, not a spending cap; CPU + memory + concurrency; Test representative traffic; A browser 200 does not confirm every destination
ssGTM on Cloud Run: measure before scaling.

Warm capacity and scaling limits

Minimum instances keep capacity warm and reduce startup delays. Additional instances during a surge, replacement instances and new revisions can still start cold: the application must start before it can process requests. Neither a fixed startup duration nor a response time below 50 ms follows from setting the minimum to one. Google’s ssGTM guide recommends at least two instances to reduce outage risk; the appropriate capacity depends on availability requirements and measured traffic.

Maximum instances constrain scaling but are not a hard spending cap. The limit can be exceeded temporarily, and revision-level limits differ from a service-wide limit. A low maximum can leave requests waiting or failing during a surge. Traffic limits, downstream quotas and a billing alert therefore belong in the operating plan. An alert does not itself stop spending.

CPU, memory and concurrency

The ssGTM guide describes a starting configuration with one vCPU and about 0.5 GB of memory per instance, using CPU allocation outside active requests. The corresponding --no-cpu-throttling setting selects instance-based billing: idle time is billed too. Available background CPU does not make an outbound request durable across shutdowns or guarantee successful vendor delivery.

Concurrency limits simultaneous requests per instance. A value of 80 is a ceiling, not a promise that scaling starts only at request 81. CPU utilization and concurrency both influence scaling. Higher concurrency can improve utilization, but payload size, tag execution and slow destination APIs can increase memory use and latency. CPU and memory limits need measurement; there is no basis for declaring memory the first bottleneck in every 512 MiB deployment.

A practical tuning cycle

  1. Inventory: deployed image, revision, billing mode, instance limits, CPU, memory and concurrency, with preview capacity recorded separately from live tagging capacity.
  2. Controlled tests: representative payloads and tags, including a slow destination and a realistic traffic spike. Synthetic purchases belong outside production reporting.
  3. Evaluation: the slower response times, such as the 95th percentile (a value at or above 95% of measured response times), error rate, CPU, memory, instance count and destination acknowledgements. An out-of-memory termination is an infrastructure failure to investigate, not an invisible analytics discrepancy.
  4. Iteration: one changed constraint, a repeated test and a comparison of total cost, including logging, networking, preview service and any load balancer. Rollback requires an available, tested previous revision.

Questions and answers

Is lower concurrency always cheaper?

No. Lower concurrency distributes work across more instances and can improve response time, but can raise cost. Increasing memory may be the better choice for some workloads. Representative measurements decide the trade-off.

Can minimum instances be reduced overnight?

A schedule can reduce standing capacity, but also reduces spare capacity for unexpected traffic or restarts. Time zones, failed schedule runs and the morning increase need monitoring. The decision follows an accepted latency and availability target, rather than a blanket distinction between conversions and other events.

Does a region change require browser changes?

A new region requires another regional deployment. A stable custom domain behind an appropriate load balancer can preserve the browser endpoint while the backend changes. Region selection should consider audience latency, data-location requirements, connected services and current network pricing. One European region alone does not determine every destination’s processing location.

From pixel to server: tracking that holds

  1. The Evolution of Web Tracking: From Log Files to the Server-Side Future
  2. Moving GA4 Visitor IDs to the Server: The Tag Manager Migration Option
  3. Hosting Google Tag Manager on Cloud Run: Planning Capacity, Reliability and Costs
  4. Reporting Later CRM Sales to GA4: Using the Measurement Protocol
  5. Matching Meta Purchase Events Correctly: Preparing Customer Data and Avoiding Duplicates
Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in touch

A question or an idea for a web project? Tell me a little about it. This form uses reCAPTCHA and formconfirmed to protect against spam.

Write a comment

Differing figures from other accounts and questions about the setup are welcome here.

The email address is not published. Required fields are marked with an asterisk.

LUKASWOJCIK.COM · NEWSLETTER

Fresh ideas in your inbox

New articles, practical tools and updates from the projects.

Choose topics (optional)
No selection: all topics.

Subscription starts after confirmation by email. · Privacy

Privacy · Newsletter

Email address, language, selected topics and subscription/confirmation dates are stored to deliver the newsletter. Double opt-in is required. Every issue includes an immediate unsubscribe link. Formconfirmed checks the signup for spam. No email open or click tracking.

Read the full privacy policy ↗