Browser tracking protection mechanisms are getting more robust, 3rd party cookies are blocked by some browsers, Chrome plans to phase out 3rd party cookies by 2022, Apple implemented their tracking restrictions for iOS users. All these changes affected web analytics.
We used to consider website tracking a front-end thing, but web tracking is getting more challenging with all the new restrictions. Some say that server-side tracking will become a new standard.
One of the easiest and cheapest ways to implement ss tagging is using server Google Tag Manager. After you set up sGTM hosting, the next question would be how to deliver data to the server-side GTM. Do you need to create a data layer similar to the web container, or is there another way?
In this blog post, I want to discuss creating a data layer for the server-side Google Tag Manager.
In the web Google Tag Manager data is collected from the client-side. You use the DOM elements or scrape data from the site using CSS selectors. But in some cases, these methods can be unstable.
The golden rule of web GTM tracking is building a reliable data layer. Creating a proper data layer structure and implementing it on the website takes some time, not only for marketers but also for developers. But it’s worth the time. With the data layer, you get more data, and this data is reliable.
There is a new object added to the server-side GTM; it’s called Client. The Client’s primary purpose is to transform request data into the event data inside the server GTM.
How does the Client understand what request to claim and process? It checks the request’s path. For example, Universal analytics sends requests that contain /collect. The Client reviews the incoming HTTP requests path, and if the request path has its “key”, the Client transforms request data to the event data in the sGTM.
Another essential purpose of sGTM Clients is to handle outgoing HTTP requests. Once the tag is triggered in the sGTM, the Client sends an outgoing HTTP request to summarize all requests sent by each tag. If there was an error with the tag, you would see the reason for the error if you click on the outgoing HTTP request and scroll down to the response body.
Let me show an example. I will use Data Tag/Data Client for it. In the web GTM container, I configured a Data Tag that sends requests to the server container.
Data Tag requests path contains /data.
In the sGTM, I have a Data Client that listens to all requests that have /data in the Incoming HTTP request.
There are two tags (GA4 and Klaviyo active on-site) in the server GTM that triggers whenever Data Client is claimed, and the event name is page_vew. Let’s see what happens in the server GTM when it receives an incoming request with /data and event name page_view. Both tags are triggered, and the Data Client sends an outgoing HTTP request.
If you click on the Incoming HTTP requests, you will see what data was sent to the server container. If you click on the Outgoing HTTP request, you will see what information Data Client sent about the execution of the triggered tags.
When you click on the event data, you will see what information from the incoming HTTP requests Data Client mapped to the event data.
Data Layer does not exist in the server Google Tag Manager in a way we used to have it in the web Google Tag Manager. You will usually build tags in the sGTM based on the event data and the requested data.
Most likely, we won’t be able to switch to server-side tracking only for the next couple of years. In the meantime, a hybrid approach will be used – combining web and server tracking. Some tags will still run on the client-side (either because platforms do not support ss tracking yet, or simply because it can’t be moved to the ss, it relates to tools like HotJar), and other tags will be set up on the server-side. There will be one Tag/Client responsible for sending specific data or the whole data layer from the web to the server GTM container.
The scheme below shows how the process of delivering data to the sGTM works. Web GTM has a data layer, UA, and FB pixel use web tracking. Then we have a GA4 server-side tag that is responsible for delivering data from web to server GTM. Based on the data GA4 tag provided to sGTM, we can set up ss Adwords and FB CAPI tags in the server GTM.
For me, the two most frequently used methods of sending data from web to server GTM are:
1. Send data layer to server GTM using Google Analytics 4.
You can send User Properties and Event Parameters from the web to server GTM using GA4. Inside the web GA4 tag, you will see predefined fields for this data, and you can add data layer variables to each parameter individually.
Google Analytics 4 and UA have different eCommerce data layer standards (UA data layer, GA4 data layer). So if you have an ee data layer on the site built for UA, make sure you modify it for GA4. The good thing is that you can use variables in the GTM template gallery that convert UA events and variables to the GA4 standards.
This option works best if you plan to set up server-side tracking for Google Ads or Floodlight since these two work only based on GA4 tags.
2. Use Data Tag/Data Client to send data layer from web to server GTM.
The most significant benefit of using Data Tag/Data Client is that DT automatically sends data layer and other common data from web to server GTM. If you enable two checkboxes, Send common data and Send all from DataLayer, it will parse data in the web GTM and send all information it could find to the server GTM. No need to configure each parameter manually.
This is how you will see eCommerce data in the sGTM. You can use the event data variable to extract it and use it for server tags, and I have a more detailed post that describes Data Tag/Data Client.
Server GTM container does not have something similar to the data layer we used in the web container. But there are several ways of passing event and user parameters or event the whole data layer from the web to server Google Tag Manager.
All it takes is a few simple questions. Click Get A Quote, fill up the form, and we will send you a quote.
What cost can you expect for server Google Tag Manager hosted on Google Cloud? Is it a good idea to use a test environment on the productions site. Why stape’s hosting for server GTM is cheaper and how we secure our user’s data.Dec 18, 2020
Shopify allows changing “transportUrl” in GA settings. It means that you can set up a Google Tag Manager Server container on Shopify instead of a GTM Web container. I hope that this will help you solve all your tracking problems.Oct 22, 2021
Server-side tracking technology is a growing trend in website analytics. It allows for improved data analysis, faster website page loads, and more secure user information storage while maintaining accurate tracking. The most popular implementation of server-side tracking so far has been server Google Tag Manager (GTM). More and more vendors have started to support server-to-server tracking and released tags for sGTM. Using these tags, you can share website or app events and user data directly from your server GTM container to the vendor’s server.