Setting up a tagging server is the first step if you want to implement server-side tagging. Tagging server works as a proxy and communicates between the data source (website, CRM, etc.) and the analytics platform. In this blog post, I want to talk about what tagging server is and how to set up a tagging server URL for the server Google Tag Manager container.
Third-party cookies and javascripts have been used for years to track user interactions on your website, but with the rise of tracking restrictions and concerns about user privacy, these are no longer enough. To get around these problems, most platforms started to recommend switching to a server-side type of tracking.
With the help of ss tagging, you can set first-party cookies, make your website work faster by removing 3rd party javascripts, and keep user data secure.
Tagging server works as an intermediary between your data source (website, CRM, etc.) and tracking platforms. The data source firstly sends information about users and events to the tagging server, and then tagging server distributes information to the tracking platforms.
For now, the most popular and the easiest way to integrate server-side tagging is server Google Tag Manager container. You can connect web and server GTM containers and use web GTM as a data source for the sGTM.
When the tagging server URL for sGTM is located in the same domain hierarchy as the website sending the requests, it sets first-party cookies and loads scripts from your domain. It helps to reduce the impact of tracking restriction and increase cookie lifetime.
Server GTM tagging uses concepts familiar to web GTM:
But there are also brand new features:
To get started with server-side tagging using server Google Tag Manager, you need:
The first step is easy to do - you just need to open the Google Tag Manager and create a new container.
Tagging server URL works as a proxy in-cloud environment. After tagging server receives requests it distributes them further to other platforms (like Facebook, Google Analytics, etc.).
With Stape, you can create a tagging server URL for your server Google Tag Manager container in one click. When you create a server GTM container on Stape, we automatically set up a cloud server on Google Cloud.
Stape sGTM hosting has these benefits:
1. Open tagmanager.google.com → Admin → click + in the Container section → Add container name → select Server in the Target platform.
2. Choose Manually provision tagging server, copy your container config and paste it in any text editor. We will need it for the next steps.

3. Open your Stape account.
4. Click Create Container and add your Container Name, Container Configuration that you copied from your Google Tag Manager Server Container, and select server location. Click Create Container.

It can take up to 10 minutes to set up a tagging server for you. Once a container status is Running, it means that tagging server for sGTM was created successfully.
5. This step is highly recommended but not required.
Once the container is running, you will see the Tagging Server URL; this URL is located within the stape.io domain by default. We highly recommend setting up a custom domain located within your site domain. It will allow you to set first-party cookies and make tracking more resistant and secure.
We will cover custom subdomain setup:
Сhoose your container on Stape, scroll down, and click Add custom domain.

Add Subdomain name - it can be any name that works for you, just be sure to avoid using phrases specific to advertising or tracking: ad, gtm, stgm, tracking, analytics, metrics, stape, gtag, etc.
A Content Delivery Network (CDN) distributes your website's assets across a global network of servers to reduce latency and improve load times for users in different locations. It is useful if your audience is geographically distributed or if you want to improve cookie tracking and data accuracy.
By default, the CDN is disabled, which means JavaScript files (like gtm.js, gtag.js, and analytics.js) are served directly from the server location where your sGTM container is hosted. Effectively, it bypasses both Stape Global CDN and Own CDN options and gives you a direct, unproxied connection between your site and the sGTM container.
| Important: please consider your country's privacy regulations before setting up a CDN. |
To enable the CDN, click the Add CDN toggle and select one of the following options:


Next, in the How to connect section, there are two ways of connecting a custom domain to your container:

The easiest way to connect domains. Log in with your DNS provider details via Entri, and give us one-time permission to connect your domain. That's it, you can proceed directly to Step 5 to verify your domain; no manual configuration is required.

With this option, you have to add DNS records manually to your hosting provider to connect your subdomain to Stape.

After you add a custom subdomain to your container, you will see DNS records that should be created to verify the custom domain. The DNS record depends on the server location and the CDN option you choose. In the next step, we show how to add DNS records.
By default, subdomain verification is performed with CNAME records, but you can verify your subdomain with A and AAAA records if you need to (usually in cases when you need to avoid adding duplicated records).
We will cover both options below with a step-by-step guide on how to create records using Cloudflare. But you can use any other provider.
| Please note that A/AAAA records are incompatible with enabled CDN. |
Once you've entered the DNS records to your DNS provider, return to the Stape container page where you've been configuring the custom domain and click Verify.

Wait for Stape to finish verifying your custom domain (when the container status bar changes from Verifying to Ready). Usually, it takes 2-3 hours to verify the custom domain. For some DNS providers, verifying records might take up to 72 hours. We will email you once the custom domain is verified or any error is detected.
If you face any problems with domain verification, please follow our guide on troubleshooting a custom domain.

Go to your Google Tag Manager server container → Admin → Container Settings → change Tagging server URL to your subdomain.

Update the script
If you use a custom domain, updating the Web GTM script on your website is highly recommended. This tweak will load gtm.js from your domain. To do so, replace the default domain googletagmanager.com with the custom domain you set up in the previous step.
Alternatively, you can automate this process with the Custom Loader power-up. Instead of manually editing the GTM script, Custom Loader generates a ready-to-use code snippet that loads GTM and GA4 scripts directly from your custom domain. This saves your time, makes your tracking scripts more resilient to ad blockers, and assures all cookies are treated as first-party.

That's it! The tagging server URL for the sGTM is set up. Now you can proceed with setting up server-side tagging in sGTM. This list of platforms that can be moved to the server-side can help you to get started.
Stape’s hosting for Google Tag Manager is the easiest and most affordable option around. We offer many features that make your tagging experience simple straightforward - and let you get back to what really matters: having proper tracking.
All you have to do is to click Get help, fill-up the form, and we will send you a quote.
Comments