---
title: Server-Side Container Architecture — GTM Server-Side Module 2 — RGM Training
url: https://realgrowthmatters.com/training/gtm-server-side/server-side-container-architecture/
updated: 2026-06-10
source_html: https://realgrowthmatters.com/training/gtm-server-side/server-side-container-architecture/
---

RGM° · Training

# Server-Side Container Architecture

Server-side container architecture is more powerful than client-side but requires deliberate design. This module covers the hosting, the components, and the architecture decisions that determine cost and capability.

### What you will learn

1. Server-side container architecture in detail
2. Cloud hosting: Google Cloud Run, AWS, self-hosted
3. Subdomain setup and first-party data flow
4. Clients, tags, triggers, variables in the server container
5. The GA4 client and the Web Container client
6. Custom clients for non-Google events
7. Data enrichment in transit
8. Filtering, transformation, redaction
9. Logging and monitoring
10. Cost optimization at scale
11. Common architecture mistakes

## 1. Server-side container architecture

A server-side container is a server (or serverless function) running Google Tag Manager's server logic. It receives HTTP requests from clients, processes them through tags, and sends data to destinations.

## 2. Cloud hosting

- **Google Cloud Run:** The reference platform; Google's recommended setup.
- **Stape:** Managed Cloud Run with simpler UI.
- **AWS / Azure:** Possible via Docker container.
- **Self-hosted:** On VPS or on-prem (more setup, more control).

## 3. Subdomain setup

Best practice: route requests through your own subdomain (analytics.yourdomain.com or similar). Benefits:

- First-party cookie domain.
- Avoids ad-blocker domain blocklists.
- Improves data persistence in Safari.
- Brand control over the request URL.

## 4. Container objects

- **Clients:** Listen for incoming requests (GA4 Client, Web Container client, custom clients).
- **Triggers:** Same concept as web container, server-side.
- **Variables:** Server-side data references.
- **Tags:** Send data to destinations.

## 5. The GA4 and Web Container clients

The GA4 client receives data from gtag.js / GA4 events. The Web Container client receives data from a client-side tag manager. Most production setups use both.

## 6. Custom clients

Custom clients enable bespoke event collection. Example: a backend system sends purchase events server-to-server; a custom client receives them and forwards to vendors.

## 7. Data enrichment

Server-side processing can enrich events with: server-side user IDs, customer data from CDP, normalized product data, hashed PII for vendor matching.

## 8. Filtering and redaction

- Drop events that should not be sent to specific vendors.
- Strip PII before forwarding.
- Apply consent-mode rules server-side.
- Normalize event names across vendors.

## 9. Logging and monitoring

- Cloud Run logs for debugging.
- Vendor delivery success rates.
- Event volume monitoring.
- Latency monitoring.
- Alerts on data anomalies.

## 10. Cost optimization

- Cloud Run autoscaling: pay only when handling requests.
- Min-instance tuning.
- Event batching where vendors support it.
- Concurrency settings.

## 11. Common mistakes

Hosting the container without a custom subdomain. Sending raw PII to vendors. Not setting up vendor delivery monitoring. Treating sGTM as a fire-and-forget setup; ongoing tuning is required. Letting consent-mode rules apply only client-side.

**How to use this module:** The hosting options (Section 2), the subdomain principle (Section 3), and the common mistakes (Section 11) are the planning artifacts.

### Sources & further reading

- [Google sGTM developer docs](https://developers.google.com/tag-platform/tag-manager/server-side)
- [Stape](https://stape.io/)
- [Simo Ahava sGTM articles](https://www.simoahava.com/analytics/server-side-tagging-google-tag-manager/)
- [MeasureSchool sGTM guides](https://www.measureschool.com/server-side-google-tag-manager/)
- [Google Cloud Run docs](https://cloud.google.com/run/docs)
- [Analytics Mania sGTM](https://www.analyticsmania.com/server-side-google-tag-manager/)
- [BounceX server-side guides](https://www.bouncexbouncex.com/server-side-gtm/)
- [Playbook of the Month (Loves Data)](https://playbookofthemonth.com/)
- [Bounteous sGTM resources](https://www.lunametrics.com/)
- [DMI server-side](https://www.digitalmarketing.org/server-side-tagging)
- Books: Yehoshua Coren, *Web Analytics 2.0*; Avinash Kaushik essays
- [MeasureCamp talks (recorded)](https://measurecamp.org/)

---

Part of the [GTM Server-Side](/training/gtm-server-side/) series · RGM Training
