Stape
Search
Try for free

How to set up tagging server URL for server GTM

Updated
Jul 24, 2024
Published
Mar 2, 2022
Also available in

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. 

What is server-side tagging, and why is server Google Tag Manager the best way to implement it?

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:

  • Tags are activated by triggers and extract data from variables.
  • Before publishing a new container version, you can test the setup in Preview mode.
  • The template gallery is available.

But there are also brand new features:

  • Requests are handled by a new type of GTM entity: the client.
  • Instead of trigger events, processes are triggered by incoming HTTP requests.

What is tagging server URL?

To get started with server-side tagging using server Google Tag Manager, you need:

  1. Create a server container in Google Tag Manager.
  2. Set up a tagging server URL.

The first step is easy to do - you just need to open the Google Tag Manager and create a new container. While tagging server is a new thing for most web analytics.  

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.). 

Using 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.io sGTM hosting has these benefits:

  1. One-click setup.
  2. 6 times cheaper then GCP.
  3. Custom gtm.js loader - helps to make tracking more resistant.
  4. Preview header - helps to debug requests sent from non-web GTM.
  5. Faster gtm.js/gtag.js/analytics.js loading time - increases website pagespeed.
  6. There is no need to run scripts if you want to upgrade to the production environment - a quicker setup.
  7. No additional configuration in the server GTM container.
  8. Autoscaling - if website traffic increases, servers will scale automatically.
  9. Access and billing - easily share access with your team members and clients.
  10. Logs - helps to debug the setup with the help of logs of incoming and outgoing requests, as well as responses from stape sGTM tags.
  11. API - automate integration with stape.
  12. Multiple server zones.

How to set up a tagging server URL using Stape

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.

manually provision tagging server

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.

create container in stape

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:

1. Open your sGTM container on Stape, scroll down to “Domains” and click Add custom domain

2. Write a custom domain.

3. You will see DNS records that you should add.

The DNS record depends on the server location and CDN option you choose. 

  • Disable CDN - choose not to use any type of CDN.
  • Stape Global CDN - loads scripts from a server closer to a user visiting your website.
  • Own CDN - helps to tag server URLs from the same IP as your website. It gives the ability to set cookies that Safari can not shorten.

The DNS records you should configure vary depending on the server location and your selected CDN settings. You will see DNS records that you should add inside your stape.io container.

4. Log in to your DNS account and add records you see in your stape.io account. Below is an example of DNS setup for CloudFlare. Open the DNS setting of the required domain and click Add record.

Then, write the records you see in your stape.io account. Ensure that the proxy is turned off.

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 there is an error with the verification, please follow this instruction on how to verify custom domain verification.

5. Once the custom domain is verified, go back to the Google Tag Manager Server container → Choose your server container → Admin → container settings → paste tagging server URL.

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.

7. Add tagging server URL to the Google Tag Manager Server container. Admin -> settings -> container settings. 

container settings

8. That's it! 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. 

Conclusion:

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.

Tagged with:gtm server

Host your GTM server at Staperight now!