What is Server-Side Measurement
Pavel Šabatka
29.11.21
reading for 10 minutes
Have you heard of Google Tag Manager measurements (GTM) running on the server? And do you know that this is the ideal way to speed up your website loading, increase the privacy of your users, or improve attribution evaluation for your marketing campaigns? See together with us what server-side measurement is good for and how it differs from classic metering.
How ordinary measurement works
Most websites today use Google Tag Manager (GTM) to manage measurements. The GTM code is inserted into the HTML of the web page, and if the user comes to the site, then approximately this happens:
- The client browser (that is, the web visitor's browser) downloads the GTM code.
- The browser processes the GTM code and executes other measurement codes from the individual platforms (Facebook, Sklik...) to which you want to send data from the site.
- Most of the measurement codes of each platform run in this way download their own javascript code, which then finds and processes the data it needs and then sends it to its platform.
In addition, some measurement codes wait for user actions on the site (such as downloading a file, scrolling, submitting a form) and then trigger additional measurements.

As mentioned above, this all runs in the client browser and puts a fairly large load on it. Only the basic measurement codes on websites have a size of at least 20 KB per platform, but Facebook, for example, downloads 130 KB of data when the website loads.
Processing takes some time, and sending increases the volume of data used by the site. Which is a problem for a lot of reasons - it slows down the loading of the site (mainly on slower devices or mobiles, the slowdown can be significant), it increases the volume of downloaded data (mobile users with a limited monthly amount of data will not thank you for this), it worsens the position in search (for SEO, speed is one of the key attributes), measurement scripts have access to all the information on the web and the theory they can do anything with them (even if it's personal data).
What is server-side measurement?
As the name suggests, server-side metering is a way of using GTM, where GTM is not part of the HTML page and does not run in the users' browser. On the contrary, it runs on a server, such as Google Cloud. And it is only on this server that the individual measurement codes are executed.
The standard GTM remains in the client browser, which sends data to the server GTM. And this only solves the sending of data to platforms such as Google Analytics, Facebook, etc.

In order to run server-side GTM, you always need some machine - either your own or in the cloud. And you need to adjust the settings of your measurement.
In addition to the fact that this solution does not force the user's browser to download and send a lot of data, there are still a number of other advantages why you might be interested in. Let's zoom in on them.
What are the advantages of server-side GTM
speed
Speed is very important for sites in general. Google has been mentioning it for years as one of the factors that influence the web's position in search. Fewer measurement codes on the page means higher speed and thus better search position and more visitors.By the way, try to test how much time it takes to process measurement scripts on your site with the help of PageSpeed Insights - look for third-party code information:

Data protection
If you write sensitive data on the page (e.g. phone, address...), third-party scripts (Facebook, Sklik...) inserted in standard GTM can access it. On the contrary, when measuring in server GTM, you are assured that they will not reach any data other than that you explicitly pass on to them. Individual platforms only communicate with GTM on the server and do not access the raw data that GTM collects in the client browser.
And by the way - whether we want it or not, platforms always see at least the IP address of the user. If you use server-side GTM, platforms won't even get to it unless you hand it over to them.
Reasonably set Content Security Policy
Your website may use the Content Security Policy (CSP) security settings. This typically applies to sites that work with sensitive or personal data. This setting tells the browser from which domains (Facebook, Google Analytics, Sklik...) it can download and run scripts at all. And you need to list them all here. Do you suspect a problem? If you use multiple platforms, the CSP settings might look like this:

In such cases, the management of all domains is complex, often forgetting to add or remove something. By using GTM on the server, the list of domains will be shortened and you will not have to worry about it.
Security
If you put some script on the site, it can do a lot of things to the site. Including the bad ones like changing the content of a site, redirecting it to another site, sending sensitive data from the site to China. This may be due to confusion or negligence. And believe us, we've seen enough of these things. Server-side GTM cannot happen to you because the codes are on the server and cannot reach the user's browser at all.
Data Validation or Enrichment
If you want to validate and correct the data somehow, you have an extended option in server-side GTM. It is also a suitable solution if you want to enrich the data, for example, by margin on specific products. You typically do not want to send this to platforms from client GTM, where anyone can access such information.
Retention of data for evaluation of attribution
If you deal with attribution over a longer period of time as a marketer, switching to server-side can be an advantage for you. In fact, some browsers (Safari or Firefox) typically aggressively delete after 1 or 7 days cookies that are not HttpOnly (so it is obvious that they are intended for marketing purposes and not for the technical functioning of the website). As part of the server side, you store such a cookie yourself, so you do not have to worry about losing data from customers using stricter browsers.
Measurement of 100% data
If you wish, you can send data to server-side GTM directly from the server and not from the client browser (see figure below). Thanks to this, you can have virtually all the data at your disposal.
However, please note that in the case of processing personal data, it is still necessary to respect the GDPR and the user's wishes should not be measured. That is, it is not advisable to bypass users' consent by downloading data directly from the web server.

Why not server-side GTM?
Of course, the use of server-side metering also has disadvantages.
- Price - as mentioned above, in order to run server-side GTM, you always need some machine - either your own or in the cloud. However, both approaches cost money.Using e.g. The price of Google Cloud is usually in the range of free (for small sites) up to 10 thousand CZK per month (sites with tens of thousands of visits per day). To this you must add the cost of commissioning and more complex adjustments to the measurements that require a programmer or analyst.
- Doesn't work for all platforms - not all platforms currently support server-side metering and require running in a browser - e.g. Slick. Of the frequently used platforms, server-side measurement supports Google Analytics, Facebook, Mailchimp and several others.So you often end up in a state where there is only part of the codes in the server container, the rest remain in the classic GTM. However, even just part of the measurement running on the server side can make sense to you - consult with your analyst.
We anticipate that in the future, platform support will increase and server-side will make more and more sense.
Does that make sense to me?
Can't imagine if this is for you? We think it definitely does if:
- You send data to a large number of platforms (most often different GA accounts), which slows down your site.
- You need to work with extremely sensitive data (e.g. birth number, ID number...) and you want to protect it.
- A lot of your visitors use Safari or Firefox, which complicates your longer-term attribution.
- You need to operate with the margin of the products in the evaluation.
- You need server measurement codes (typically for affiliate platforms), but you don't want to annoy programmers with it all the time.
Do you see yourself in part of the cases, but you are still not sure if the server-side solution is for you?
Let us know! We will consult with you the advantages and disadvantages in your case and if it makes sense, we will be happy to help you with setting up server-side metering.
Jsme vám k službám
Pomůžeme vám, aby počet vašich poptávek nestagnoval, ale neustále rostl
Dáme řád vašemu marketingovému oddělení, procesům i metodám
Vzděláme vás ve výzkumu, designu, i strategickém plánování