Google Tag Manager (GTM) is popularly known as a solution for managing tags and tracking codes operating in a client-side environment. However, Google offers another way to implement GTM called GTM server-side tagging. In this article, we will explore the concept of GTM server-side tagging as an alternative to the traditional client-side approach. We will discuss the benefits of this approach and provide a step-by-step walkthrough on how to set it up.
What is GTM client-side tagging?
GTM client-side tagging offers flexibility and ease of implementation for data collection, as you can manage and update tags without modifying the underlying website code. However, it relies on the user’s browser to execute the tags.
What is GTM server-side tagging?
GTM server-side tagging is an alternative approach to implementing tracking tags using Google Tag Manager (GTM). Unlike traditional client-side tagging, where tags are executed on the user’s browser, server-side tagging involves executing tags on the server before delivering the web page to the user’s browser.
In GTM server-side tagging, the GTM container is hosted on a server or cloud environment instead of being embedded directly in the web pages. When a user requests a web page, the server-side container processes the tags and sends the necessary data to analytics and marketing platforms.
The GTM server-side container acts as an HTTP API endpoint that receives HTTP requests. The client in the server receives these requests, manages and processes the event data. The different components (tags, triggers, variables) react to the event data similarly to regular Google Tag Manager(client-side).
GTM server-side tagging provides a more robust and flexible approach to data collection compared to traditional client-side tagging.
Benefits of moving from client-side to server-side
Server-side tagging offers advantages over client-side tagging. One benefit is enhanced data privacy and security. By processing tags on the server, sensitive data is less exposed to potential security risks, you have more control over data handling and can implement additional security measures. Server-side tagging also improves performance and page load speed by shifting the burden of tag execution from the user’s browser to the server. This results in a smoother user experience and faster page load times.
Furthermore, server-side tagging is compatible with ad blockers and tracking prevention technologies. By executing tags on the server, these blockers do not affect data collection. Additionally, server-side tagging provides flexibility and control in managing and modifying tags. Changes can be made without relying on client-side updates, allowing for more efficient tag management and deployment.
Lastly, server-side tagging allows for centralised tag management, making maintaining and updating tags across multiple websites or applications easier.
Overall, moving from client-side to server-side tagging offers enhanced data privacy and security, improved performance and page load speed, and compatibility with ad blockers and tracking prevention technologies. These advantages make server-side tagging an attractive option for organisations seeking to optimise their data collection and improve the user experience.
Drawbacks of moving to GTM server-side
While GTM server-side tagging offers numerous benefits, it also has potential drawbacks. One drawback is increased complexity, as it requires technical expertise and configuration. This includes setting up server infrastructure, managing containers, and integrating with platforms and APIs. Another drawback is higher initial setup and maintenance costs; these include cost for server hosting, infrastructure, scalability, and cost of a developer resource.
Server-side tagging can also introduce potential latency, as processing tags on the server before sending data to analytics platforms may impact real-time data availability.
There is a dependency on server infrastructure, as any issues with hosting or infrastructure can impact data collection. There is also a risk of data loss if the server-side container fails to capture events or if there are implementation issues. Lastly, transitioning from client-side to server-side tagging requires a learning curve and effort to understand the infrastructure, configure the container, and migrate existing tags and triggers.
List of hosts for GTM server-side
There are several server hosting platforms you can use to host your server when implementing GTM server side. Let’s take a quick look at a few different platforms where you can host your server when using GTM server-side implementation.
Google Cloud Platform (GCP), Stape.io, Addingwell, Amazon Web Service (AWS), and TAGGRS are all reliable and scalable server-side tagging platforms for hosting GTM. They offer auto-scaling, user-friendly interfaces, integration options, and support. While some are more affordable and easier to set up, these platforms provide efficient solutions for GTM server-side tagging, with features like multi-domain mapping and high event processing scalability. Your choice of host depends on your preference and the platform’s cost.
|Google Cloud Platform||Varies based on use||High||Extensive||Comprehensive|
|Stape.io||Free plan available, pricing tiers based on requests and other features||High||Popular tools integration||Email, Knowledge base|
|Addingwell||Pricing tiers based on features||High||Popular tools integration||Email, Knowledge base|
|Amazon Web Services (AWS)||Pay-as-you-go pricing, varies based on services used||Moderate||Wide range of tools integration||Documentation, Community forums, Paid support plans|
|TAGGRS||Free plan available, pricing tiers based on request and other features||High||Popular tools integration||Knowledge base, Community forums, Customer support|
How to set up Google Tag Manager server-side tagging
You can follow the steps below to set up GTM (Google Tag Manager) Server-Side Tagging:
- Create a GTM server container
- Choose a suitable hosting option
- Configure your server, map a custom domain to the server, configure DNS
- Set up data forwarding from your website or app to the GTM Server Container
- Set up data forwarding from GTM server side to the vendor’s platform
- Test and Publish
Let’s look at these steps in detail.
- Create a GTM Server Container
In your Google Tag Manager account, where you already have a web container, create a new Server Container that will handle the server-side tagging. Simply go to your accounts, click the ellipsis, and then click Create a Container. Select server as the type of container.
- Choose your hosting option
The following prompt helps you choose if you want to create your server in the Google Cloud or any platform you desire. Selecting the “Automatically provision tagging server” provisions a server on Google Cloud Platform. While the “Manually provision tagging server is the option you should choose if you decide to host your server on another platform other than GCP.
In our example, we will use the automatic provision option.
- Create a billing account
Create a billing account on Google Cloud Platform by entering all the necessary billing details or simply select an existing billing account.
- Wait for a few minutes until Google creates the server
Afterward, a prompt showing the provisioned server’s Project ID and configuration URL is displayed.
- Configure your server: map a custom domain to the server and configure DNS.
Use the Project ID link provided after the server has been provisioned to go to the Project in GCP and carry out further configurations. One of the key things you will need to do is to map a custom domain to the server. This custom domain should be a subdomain of your website where you can send your data. What this does is it uses your domain name for the server-side data collection endpoint. By mapping a custom domain to your Server container endpoint, you ensure that the cookies are considered first-party cookies and are not blocked by browsers. This allows for more reliable and accurate data collection. Here’s Google’s documentation on it showing how to achieve it.
- Set up data forwarding from your website or app to the GTM Server Container.
You can do this by creating a configuration variable for the server container URL. To do this, create a new user-defined “Google Tag configuration settings” variable in the web container. You can use “server_container_url” as the parameter name and then set the server URL as the value. Next, create a tag or use an existing one, preferably your configuration tag. Add the variable created above in the configuration settings, use the Initialization – All pages trigger, and set the tag to fire before all other tags. Google’s documentation shows detailed instructions on sending data from a website through GTM or GTAG.js.
- Test your setup
Test your setup to ensure data is sent correctly from your website or app to the GTM Server Container. You can use the GTM preview mode or server logs to do this.
- Configure a tag on the server side to send the data to the vendor’s platform
We will use GA4 for our example. To set up a GA4 tag, go to Tag, create new, choose GA4, click on triggers, select the custom trigger type, select some events, choose the built-in variable “Client Name,” and specify that it triggers when your client name contains GA4.
Save your trigger and then the Tag. In our example, we named the tag “GA4 Requests data”. See detailed article on how to set up GA4 server side.
Now test this to ensure data is being sent from the server to GA4. You can use the GA4 DebugView or GTM preview mode to verify this.
Please refer to the GTM documentation when setting up your server-side tagging. If you require assistance from GTM experts, feel free to contact us. We can handle the task of setting up your server-side tagging and ensure a smooth and seamless setup process for you. If you would also like to understand the distinctions between GTM and GA4, you can read this article: Google Tag Manager vs. Google Analytics.
Frequently Asked Questions
In GTM server-side tagging, a server hosts the GTM container, this server processes the tracking tags and sends the data to the analytics and marketing platforms (like the company that provides the software).
The costs associated with transitioning to GTM server-side include the cost of hosting a server, data transfer, and the involvement of a developer. The hosting cost varies depending on the hosting provider you select. For instance, if you choose to host the GTM container on Google Cloud Platform, you can expect to pay approximately $120 monthly.
In the GTM client-side setup, the tracked data is sent directly from the user’s browser or app to the vendor (analytics or marketing platform). In contrast, on the server side, the tracked data goes through an intermediary server first, and then it is sent to the analytics or marketing platform from the server.
Go to the accounts section of your GTM, select the ellipse, choose the create container option, select the server option and follow the instructions.