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