Most people think server-side GA4 is a big, scary project. It is not. On a clean setup, the core of it is one setting in your Google tag and two things in the server container. I have done this on stores in under an hour. The time goes into testing, not building.
How the data flows
- The browser loads your web GTM container as usual.
- The GA4 Google tag sends hits to your server URL (for example
ss.yourstore.com) instead of Google. - The GA4 client in the server container receives the hit.
- A GA4 tag in the server container forwards it to Google Analytics.
Because your server sits in the middle, you can clean, enrich or block data before Google ever sees it.
Step by step
- Have the basics ready. A server container on Stape with a custom domain
- Point the Google tag to your server. In web GTM, open your Google tag (GA4 config) and add the parameter
server_container_urlwith your server URL, for examplehttps://ss.yourstore.com. - Check the GA4 client. In the server container, go to Clients. A GA4 client is usually there by default. Make sure it is active.
- Create the GA4 tag in the server. New tag → Google Analytics: GA4. Leave the Measurement ID empty to use the ID from the incoming hit, or set it directly.
- Trigger it. Use a Custom trigger where Client Name equals GA4.
- Preview both containers. Run web preview and server preview at the same time. You should see the request arrive in the server and the GA4 tag fire.
- Confirm in GA4 DebugView. Events should appear as normal.
Stape Gateway: the even simpler route
If the client only needs GA4 and Google Ads, Stape Gateway is a lighter option. You do not need a separate server GTM container. It is fewer moving parts, but less flexible. If you plan to add Meta CAPI or TikTok later, go with the full server container from the start.
Mistakes to avoid
- Two Google tags fighting. One tag points to the server, another old tag still sends to Google directly. You get double sessions. Keep one Google tag.
- Hardcoded gtag on the site. A theme or plugin adds
gtag.jsoutside GTM. That copy bypasses your server. - Missing consent signals. If you use Consent Mode, make sure consent state still reaches the server. Otherwise the server tag may send data it should not.
- Testing in only one container. Web preview looks fine, but nothing reaches GA4. Always check the server preview too.
A real-world pattern
A situation I see often: a client “moved GA4 server-side” and sessions jumped by about 40%. Nothing was wrong with the server. An old GA4 tag had been left live in the web container alongside the new one. One pause, one publish, and numbers were back to normal.
Bottom line
Server-side GA4 is a small change with a big payoff: longer-lived cookies and full control over what you send. Keep it to one Google tag, test both previews, and you are done.
Source reading: Stape — GA4 with server GTM vs Stape Gateway