Server-side tracking: everything you need to know
4 October 2022
Everything is evolving – marketing and analytics are no exception.
Since some browsers have already started eliminating third party cookies, we need to start looking for a solution to keep collecting data and ensure that our data is reliable.
The traditional way to collect data – client-side tracking – is becoming limited due to the privacy issues and browser restrictions. Server-side tracking offers an answer to this problem. In this blog post, we’ll tell you more about the pros and cons of server-side tracking, how to set it up, what the best practices are and what it costs.
A few large advantages to server-side tracking
Moving the tracking mechanism for browser scripts to your own server brings you many benefits:
The first important advantage is performance gain. Instead of sending the requests to the user, they can now be sent to the server. That lowers the load time, which increases your website’s speed.
The second analytics advantage is the increased data accuracy. Because many browsers are already blocking third party cookies or because users use an Adblocker, third-party cookie data will be less accurate. With server-side tracking, that isn’t the case: all cookies can be put in a first-party context – something browsers and adblockers don’t affect.
A better grasp on security
Adding third-party scripts to your website always carries some risks. When you migrate these scripts to a server, you get a better handle on which data is collected and which data is sent to an external party such as Google and Facebook. This way, you can prevent an unwanted leak of personal information.
Client-side vs. server-side tracking: all the pros and cons
Every configuration has its pros and cons, which is why we have compiled them all in a nice overview.
How to get started with server-side tracking
Now that you know all the pros and cons of server-side tracking, the next question is: how do you get started? There are a few steps you need to take to turn your server-side project into a success. In our example, we assume you’ll be working with the Google tool stack, but there are of course other providers, such as Amazon.
1. Setting up a server environment
A server environment consists of two parts: a server container that you create in Google Tag Manager’s interface and a tagging server that, in our example, is set up in Google Cloud. The tagging server will be the place you’ll be sending data to. And don’t forget to link a billing account in Google Cloud, or your data won’t be stored.
2. Creating a client in Google Tag Manager
A Client is an element specific to a server-side Google Tag Manager container. A Client “listens” to the incoming HTTP requests and does something with them. A GA4 Client, for instance, would listen to incoming requests from Google Analytics 4 and turn the data into an event used for server-side tags.
3. Creating your first tag in the server container
After creating a Client, the next step is creating a tag. Like Google Tag Manager’s client-side version, the server-side gives you many options. Which option you pick depends on the platform collecting the data: Google Ads, Facebook, Google Analytics …
The advantage of these tags is their user-friendliness and simple interface you have known and loved for years. Just add your server endpoint and trigger to your tag, and you’re good to go!
Best practices for your server-side setup
Technically, you should have a working server-side tracking setup by now. But you can take a few optional steps to implement all the best practices.
Collecting browser data
In a server-side container, you can only receive HTTP requests, which don’t contain that much data. The advantage of client-side tracking is that you can collect data from the browser automatically, giving you more reporting options. Do you want to save your browser data and send it to your server-side container anyway? Check your existing tags in your client-side Tag Manager. For GA4 tags, the option “Send to server container” exists, which forwards the entire payload from the browser to your server container.
A personal domain for greater data ownership
When you use a standard server-side tagging implementation, your data is forwarded to a Google domain: .appspot.com. Consider creating a custom domain, which implies you will be using one of your own domain’s subdomains. In our case, that could be measurement.iodigital.com.
Costs connected to server-side tracking
Server-side tracking is, unfortunately, not free – there’s a cost connected to using a server. There are 3 things that could cost you money, which we will explain in detail below.
If you use Google Cloud for server-side tracking, you need to consider the number of instances you need. We recommend using three instances, adding an auto-scaling of a maximum of six. Three instances cost about € 100 a month. You can always adjust the number of instances if they don’t suit your needs anymore.
Every time you send data from your server to an external platform like Google Analytics, you need to pay a small amount. The cost is next to nothing, even for sites that process up to 500.000 visits per month.
When you use Google Cloud’s App Engine, every incoming request is logged automatically. You get 50 GiB a month for free, which is enough for many companies. As soon as your credit is gone and you collect, let’s say, 100 GiB a month, that could add up to a considerable amount of your total monthly expenses.
Advice on server-side tracking
Do you want to get started with server-side tracking? Contact our data team!