- Server-side tracking needs a server; with server-side Google Tag Manager (sGTM) you rent and run that server yourself, usually on Google Cloud.
- A Google Cloud setup has five parts: a Cloud project with billing, the server container, a first-party subdomain, the tags that route events, and monitoring.
- It makes sense when you need full control over where data is processed, custom routing to several destinations, or you already run on Google Cloud with developers to maintain it.
- For a store that sends purchases to GA4 and the main ad platforms, a managed server-side setup gives the same events without a server to look after.
- The two can be combined: a managed tool can send its server events into your own container.
Server-side Google Tag Manager on Google Cloud means you run your own tagging server: a Google Tag Manager server container hosted in your own Google Cloud project, on a subdomain of your store. Events from your site go to that server first, and the server sends them on to GA4, Meta, TikTok and other platforms. You get full control over the data, and you also take on the setup, the hosting bill and the maintenance.
Most stores do not need that much control. This guide explains what a Google Cloud setup involves, when it is the right choice, when a managed setup does the same job with less work, and how the two fit together.
What Google Cloud server-side tracking really means
Browser tracking sends events straight from the shopper's browser to each ad platform. Ad blockers, cookie limits in Safari and Firefox, and declined consent stop part of those events. Server-side tracking moves the sending to a server you control, which is harder to block and can add data from your store, such as the order value after discounts.
The catch is easy to miss: server-side tracking needs an actual server, and that server has to live somewhere. There are two ways to get one:
- The tracking tool runs the servers
- You connect accounts and choose destinations
- Hosting and updates are part of the subscription
- Less freedom to add custom logic
- You run a GTM server container in your own Cloud project
- You decide every tag, rule and destination
- You pay Google Cloud for hosting and keep it running
- Needs a developer or a tracking partner
With your own container, events take this route:
The parts of a Google Cloud setup
A working setup is more than one tag. It ties several systems together, and each one has to be right for the tracking to stay stable and lawful.
1. A Google Cloud project
Everything starts with a project in your Google Cloud account, with billing turned on. Google Tag Manager can create the server for you (on Cloud Run) or you deploy it by hand. Access rights (IAM roles) decide who can change the server. A careless setup here either stops the container from running or leaves it open to people who should not have access.
2. The GTM server container
In Google Tag Manager you create a container of the type Server. It receives requests through clients (for example the GA4 client or the Measurement Protocol client), turns them into event data, and passes that data to tags that send it on. This is where custom logic lives: filtering bot traffic, enriching events with data from your store, or adding a user id.
3. A first-party subdomain
To keep the tracking first-party, the container runs on a subdomain of your store, such as sgtm.yourshop.com. That takes a DNS record at your domain registrar and a certificate. Without it, requests go to a Google-owned address and lose much of the benefit against browser limits.
4. Tags that route the data
Each destination needs its own server tag: GA4 receives events in its own format, Meta through the Conversions API, TikTok through its Events API, and so on. Many of those tags come from the community template gallery, so check who maintains each one. Purchases must carry an event id that matches the browser event, or platforms count them twice.
5. Consent and monitoring
The server must respect the visitor's consent choice, just as the browser tags do. It also needs watching: logs to see failed requests, alerts when the server stops, and updates when Google releases a new server image. Plan who does this every month, not only at launch.
When a Google Cloud setup makes sense
Running your own container is the right choice in a few clear cases:
- You need full control over the data path. Legal, contract or internal policy requires that you decide where customer data is processed and what is removed before it leaves your systems.
- You have advanced routing needs. The same event goes to several places at once (GA4, a custom endpoint, a data warehouse), rules differ per language, region or Shopify Market, or one container serves several stores and domains.
- You already run on Google Cloud. If BigQuery, Cloud Functions or other parts of your stack are there, the container fits into the same billing, access rules and monitoring.
- You have developers or a tracking partner. A self-hosted container is a developer project. Someone has to test releases, read logs and fix tags when a platform changes its API.
When you probably do not need it
- You want to go live without a project. A Google Cloud setup takes planning, DNS changes and testing before the first event arrives.
- You watch costs closely. You pay Google Cloud for the server every month, with more instances as traffic grows, plus the hours someone spends maintaining it. Check the current price with the Google Cloud pricing calculator before you decide.
- You send standard events to standard platforms. If you need purchases and the usual shopping events in GA4, Meta, Google Ads and TikTok, a managed tool already does that server-side.
| Question | Managed setup | Own sGTM on Google Cloud |
|---|---|---|
| Who runs the server? | The tracking tool | You or your partner |
| Hosting bill | In the subscription | Google Cloud, monthly, grows with traffic |
| Custom logic per event | Settings the tool offers | Anything you can build in tags |
| Updates when a platform API changes | The tool updates | You update the tags |
| Who it suits | Most stores | Stores with strict data rules or custom pipelines |
How to plan a Google Cloud setup
- Write down the requirement
Name the rule or pipeline that a managed tool cannot meet. If there is none, a managed setup is simpler.
- Decide which events go where
List each event (page view, add to cart, checkout, purchase, refund) and each destination, with the event id that ties browser and server together.
- Set up the project and the container
Create the Cloud project with billing and access rules, provision the server container, then map the subdomain and wait for the certificate.
- Add clients, tags and consent checks
Configure the clients that receive data, one tag per destination, and the consent rules that stop events for visitors who declined.
- Test in preview, then watch
Use the server preview to check every event, compare purchases with your orders for a week, and set alerts for failed requests.
How ROASaurus fits, with or without your own container
ROASaurus runs server-side tracking for you: it sends paid orders from your store's order data to 16 ad platforms, GA4 and Klaviyo, with the same event id as the browser event, so nothing has to be hosted. If you also run your own container, add it as a destination under Connections › Tracking & destinations as Server-side GTM. You enter the Container URL (an https:// address such as https://sgtm.yourshop.com), the Client path of your Measurement Protocol client (default /mp/collect) and, if you want, a GA4 Measurement ID, an API secret and a preview header for testing.
ROASaurus forwards page views, product views, add to cart, checkout, purchases, leads and refunds this way. Events from visitors who declined marketing consent are not forwarded, because your container's tags could send them anywhere. Each delivery and the container's response appear in Data quality › Deliveries, so you can see what reached the server. Two things are not built yet: a storefront data layer for your own browser GTM container, and ready-made GTM templates for the ROASaurus events.
Next step
Sources
- Google Tag Manager: An introduction to server-side tagging
- Google Tag Manager: Set up server-side tagging with Cloud Run
- Google Tag Manager: Map a custom domain to your tagging server
- Google Tag Manager: Send data to server-side Tag Manager
In ROASaurus
- Server-side tracking in ROASaurus
- What is server-side tracking?
- Server-side tracking glossary entry
- GA4 integration