A new way to track data in Google Tag Manager - Server-Side Tagging

In this article I want to tell you about a new feature from Google Tag Manager - Server-Side Tagging - tracking data on the server side. This functionality, according to its developers, allows you to hide business logic in server code, speed up site loading and improve user data protection by restricting access to third-party scripts.

Let's take a closer look at how this works.

What is the difference between Client-Side and Server-Side Tracking


Most existing tag managers, analytical systems and advertising services collect data using the Client-Side Tracking method, that is, on the client side. How it works? There is a website or application that has a specific browser installed, and there is a third-party service, such as Google Analytics. The browser sends the request directly to this service and, if necessary, receives a response. That is, the interaction occurs between two parties: a browser and a third-party service.


When tracking data on the server side (Server-Side Tracking), an intermediate point is added. In the case of Google Tag Manager, it is a cloud server. From the client side, the request goes first to the cloud server, then the server processes this request and sends it to a third-party system (Google Analytics). That is, instead of the client’s browser, the request is made by the cloud server.


Now let's take a closer look at the main advantages and disadvantages of both methods of data collection.

Client Side Tracking


This is the most common way to collect data from a site. Tracking on the side of the user’s browser allows you to receive data from cookies, URL parameters, referring sources, user device information, IP address, etc.

Benefits

  1. This is the standard that is used by all tag managers known to you and which most analysts are used to.
  2. Client-side tracking is easy to configure. Many systems provide ready-made code fragments that you just need to copy and place on the pages of the site.
  3. . , , Chrome Google Tag Manager.
  4. Client-Side Tracking, , Server-Side Tracking, .



  1. . , .
  2. , , . ITP — Safari , cookie .
  3. Data is less secure than with Server-Side Tracking. So, you cannot transfer confidential information from the site in this way, for example, email and user phone numbers or margins.

Server side tracking


Server-Side Tracking is an alternative to the usual client-side tracking method, which allows you to solve the problem with ad blockers, the transfer of confidential data and page loading speed.

Benefits

  1. Sending requests does not depend on the version or on the type of your browser. All requests are processed on the server side, so ad blockers, ITP, ETP or an interrupted connection do not affect the quality of your data.
  2. , , c Google Analytics , , , .
  3. Server-Side Tracking , .
  4. . , , . Server-Side Tracking .



  1. .
  2. . .
  3. Not suitable for collecting information from SPA or PWA pages.
  4. Not all systems use tags that are available for server-side tracking.
  5. The method is not convenient for collecting URL parameters. They are much easier to collect on the client side, as this data appears in the browser.

Now let's look at the benefits of Server-Side Tracking that the Google Tag Manager team has focused on.

GTM Server-Side Tracking: Claimed Benefits


Server-side tracking allows you to hide the business logic of your site interacting with third-party applications by moving it to the backend. That is, the user will not be able to access the information and logic that you use to transfer data. For example, you can send honest margins to GA and on the client side in the user's browser there will not even be such a variable.

This method is safer in terms of data movement. The information that you want to send for analytics, for example, a segment from CRM, gender or something else related to the user, now does not need to be sent to the browser. Accordingly, this will not be available to other JS scripts in the browser.

As it happened before: let's say you want to get the hash of the phone number or gender or user address in GA. To send this information, you must make it available in the DataLayer. And the information from the DataLayer is available to all JavaScript that loaded in the browser. This is a common scope, there are no private variables, unlike Python, for example. If you pass this information through the backend, then it is not available in the user's JavaScript browser environment.

In addition to data security, among the advantages of Server-Side Tracking, the Google team also highlights the opportunity to increase the speed of loading the site.

How to try Server-Side Tagging in Google Tag Manager


Unfortunately, there is no way to share with you instructions on how to configure server-side tracking, as this is a beta version with limited access. To access it, you need to fill out and submit a Whitelist form to Google .

After you get permission and instructions from Google, to configure Server-Side Tracking you will need:

  1. Google Cloud Platform Account
  2. Access to your site’s domain name registrar
  3. Access to publish content on your site, since the method requires the placement of a GTM container

We at OWOX BI have already managed to test the new functionality. In a nutshell, how it works and what is the difference from standard tracking using Google Tag Manager.

How Client-Side Tracking Works : We have a website or application. We install the container on the GTM website and configure the tags in it. The container then sends the data to GA.



How Server-Side Works : We have a website or application. Again, we are setting up a GTM web container with all the tags. Next, we set up the environment on a dedicated domain. Set up a container for this environment. And the request already leaves not directly from the browser through a web container, but through an intermediate link in the form of a cloud server:



After the standard configuration of the Google Analytics resource, data begins to be collected into it:



There is an additional charge for using a cloud server, which depends on the number of users and requests on your site.

findings


Should I use server-side tracking? The answer to this question depends on what data you want to collect and for what purposes; what is more important for you is the opportunity to save time and money or the ability to transfer sensitive data to the analytics system.

Since the functionality is still in beta, switching to it completely and disabling regular tracking is not worth it (and it won’t work out). However, you can now request access from the Google team to test Server-Side Tracking and decide if it will be useful for your business.

All Articles