Client-side tracking: measurement in the browser
With client-side tracking, all measurement scripts run in the browser. A typical setup: Google Tag Manager loads the tags for Google Analytics, Google Ads, Meta and perhaps an affiliate network on every page. Each script collects data about the visit and sends it to its own provider.
To recognise returning visitors, the scripts store cookies or use the browser’s web storage. Google Analytics 4 sets a first-party cookie on your domain for this. Client-side tracking is quick to set up, needs no infrastructure of your own, and almost every tool supplies ready-made code for the browser.
Server-side tracking: your own server in between
Server-side tracking with Google Tag Manager uses two containers. The web container in the browser sends the events as a single data stream to a server container. The server container runs in a cloud environment, usually on Cloud Run in your own Google Cloud project. In the server container, components known as clients receive the requests and turn them into events. Tags in the server container then pass these events on to the individual services, for example to Google Analytics or to Meta via the Conversions API.
According to Google, only you have access to the data in the server until you pass it on to a service. Google strongly recommends running the server on your own domain, ideally on the same origin as a path of your website (such as your-domain.com/metrics) or, alternatively, on a subdomain.
The differences at a glance
- Data flow: client-side, the browser talks to each provider separately. Server-side, it only talks to your server, and the providers receive their data from there.
- Control: on the server you can check requests, standardise values, remove details such as the IP address or discard requests entirely before anything is passed on. You can also enrich data, for example with the margin of an order, without that value being visible in the browser.
- Loading time: the fewer scripts run in the browser, the less work the visitor’s device has to do. How much this helps depends on how many tags previously ran in the browser.
- Cookies: according to WebKit, Safari deletes cookies set by JavaScript if the visitor does not interact with the website for seven days. A server container on your own domain can set cookies in the server response, with the HttpOnly attribute if required. Google describes HttpOnly cookies as more durable and more secure. Whether Safari keeps these cookies for longer than seven days depends on whether Safari attributes the server to a third party via its CNAME record or IP address. You should measure this after setup.
- Effort: client-side, a code snippet is enough. Server-side, you also need a server, a setup on your own domain and ongoing maintenance and monitoring.
Limits and costs of server-side tracking
Server-side tracking does not replace the browser. The server only learns what a visitor does on the page because the web container reports it. Tools that need to record behaviour on the page itself continue to run in the browser.
There are also running costs. In its guide for Cloud Run, Google estimates around 45 US dollars per server per month and recommends at least two servers in production. With more requests, Cloud Run starts further servers automatically. What other environments cost and which one suits you is described on our server-side tracking page.
Consent: server-side does not mean consent-free
With server-side tracking too, every measurement starts with a request from the browser, and as a rule cookies are set on or read from the device. For storing and accessing information on the device, Section 25 of the German TDDDG generally requires consent. Exceptions are narrowly limited, above all to what is strictly necessary for a service the user has explicitly requested; this is usually not the case for analytics and advertising. If the server passes personal data such as the IP address or order data on to services, a legal basis under the GDPR is also required. Whether and for what you need consent depends on the processing involved. You should clarify the details with your data protection officer.
Technically, the choice made in the banner has to reach the server, because a refusal in the cookie banner must also be respected in the server container. According to Google, you only need to set up consent mode in the web container. The Google tag passes consent on with every request, and the Google tags in the server container act on it. For other providers’ tags in the server container, such as the Meta Conversions API, the setup must check consent explicitly.
When server-side tracking pays off
Server-side tracking pays off above all when several advertising and analytics services need the same data, when you want precise control over which details go to whom, or when conversions should reach the advertising platforms with the correct values. For a small website with Google Analytics as its only service, the effort is rarely worthwhile.
In consent management, we give every tag in Google Tag Manager the appropriate consent condition. With server-side tracking and a clear banner design, measurement gaps can be reduced without bypassing the user’s decision. If affiliate networks and other paid channels run in parallel, a tracking switch is added. It determines which channel a sale is reported to when several were involved, so that the same order is not paid for twice.
