Server-side tracking, how it works with GA4 and consent

Published

Contents

Action points

  • This week, compare the enquiries in your own records with the conversions in GA4.
  • Write a tracking plan with the events that matter for your business.
  • Check whether your tracking code waits for the choice in your cookie banner.
  • Book a call with Dominic about whether your own tracking server is right for you.
Reading type0 min

You track with GA4, you advertise online and suddenly an agency or web developer recommends server-side tracking. Here you can read in plain language what it is and how it ties in with GA4 and consent. You will also see when you really need it.

What is server-side tracking?

Server-side tracking is a way of measuring in which the tracking data from your website first arrives at your own server under your own domain. That server then forwards it to services such as Google Analytics 4. Your visitor's browser then talks to one address instead of all those services at once.

Google itself talks about server-side tagging and describes it as a way of using Google Tag Manager to measure your website or app across different devices. A tag is a piece of tracking code. Tracking is the broader word for following what visitors do.

A simple comparison helps. Think of the post room of a large office. Every department puts its outgoing letters in one tray. The post room checks what is inside, removes unnecessary attachments and only then sends the rest on to the right recipient.

Business owner from Brabant removes an unnecessary attachment from an envelope in the post room

Your own server plays the role of that post room. It receives the tracking data from your website, decides what happens to each piece and passes it on to the services you choose.

One address of your own collects your tracking data and you decide what goes through.

Client-side vs server-side tracking

Client-side tracking is the classic way. Client here means your visitor's browser. Separate pieces of tracking code run on your pages, for your statistics, for each advertising platform and sometimes for a chat function. Each piece contacts its own service directly from the browser.

In the post room from earlier, each employee then walks out the door with their own letters, each heading to a different postbox. Nobody checks along the way what exactly is in those envelopes.

Three employees each walk with their own envelope to a different postbox

With server-side tracking, part of that work moves. According to Google, a server container runs on a server you manage yourself, so outside your visitor's browser or phone. Container here is the word for the collection of tags and rules you keep in Google Tag Manager.

Put the two methods side by side and a few things stand out.

  • With client-side, the browser sends data to each service separately.
  • With server-side, the browser sends the data to one address of your own.
  • With server-side, you decide on your server which data each service receives.
  • With both methods, your visitor's consent remains the basis.

Server-side tagging in Google Tag Manager

In Google Tag Manager, this approach works with two containers. The web container sits on your website, as you may already be used to. The server container runs on your own server and receives what the website sends it.

When a request comes in at that server container, a so-called client has to pick up that request. That is a different kind of client from the browser earlier. It is a component on your server that recognises and unpacks incoming data.

Receptionist recognises an incoming box by its label and unpacks it at the front desk

For Google Analytics, that work has already been done. The Google Analytics client comes installed as standard in your server container.

After the client, it is the turn of the tags in your server container. They pass the data on to the services you choose. So you have two layers, one that collects and one that distributes.

Why businesses make the switch

Why do businesses choose their own server? Google's documentation gives a few clear reasons.

More control over your data

Only you have access to the data on your server, until you choose to forward it, Google writes. Google also says you keep full control over what that data looks like and where it ends up.

Imagine a contact form accidentally sends an email address along in the page link. On your own server, you remove a field like that before it reaches an advertising platform. That way each service gets exactly what it needs.

Less work in the browser

The server container runs outside your visitor's browser. Google recommends having the Google Analytics tag on your page send the data to the server container. That tag uses different sending methods, so the events arrive as reliably as possible.

Distribution to other services then happens on your server. That way your visitor's browser can make do with fewer separate pieces of tracking code.

Measuring from your own domain

First-party is jargon for everything that comes from your own domain. Google strongly recommends installing the server on your own domain before real traffic goes through it.

If you leave the server on your cloud provider's default address, it works in a third-party context, meaning as an outsider. For benefits such as longer-lasting cookies, your tagging server and your website must run on the same domain, Google writes.

A simple route is a subdomain, such as meten.jouwbedrijf.nl. The way to set it up according to Google is by updating your DNS records, your domain's address book. Google calls serving from exactly the same address as your website a best practice, because of security and the lifespan of the cookies the server sets.

Your domain, your server and your choice about what goes through.

Beekeeper from Brabant pours honey through a sieve, so only what he wants gets through

Browsers and visitors grow more critical

A lot is changing outside your own site as well. Safari is a clear example. According to WebKit, the technology behind Safari, in 2019 the lifespan of cookies set by scripts in the browser went down to seven days.

In 2020, WebKit went a step further. Since then, Safari deletes all storage that scripts can write after seven days of Safari use with zero interaction on that site.

What does that mean for you? A customer who arrives via an ad today and returns two weeks later may show up in your figures as a new visitor. Those WebKit rules date from 2020, so if in doubt, check the current situation.

Visitors themselves are paying closer attention to their data too. In 2023, 89% of Dutch people aged 12 or older said they take measures to protect personal data on the internet, compared with 82% in 2021, CBS reports.

Just over half of internet users in the Netherlands adjusted the settings of their computer, tablet or phone to prevent or limit cookies. According to CBS, that was the case in both 2021 and 2023.

Even with your own server, your visitor's choice remains decisive, as you will read further on.

Server-side tracking and GA4

How does this fit with Google Analytics 4? An event, as GA4 calls it, is an action you measure. Think of a page view, a click on your phone number or a submitted quote form. With server-side tracking, an event like that travels a route with three stops.

  1. The Google tag or the Google Tag Manager web container picks up the event on your website and sends it to your server container.
  2. In the server container, the Google Analytics client picks up the incoming request.
  3. A GA4 tag in the server container then passes the event on to your GA4 property.
A yellow bus stop along a Brabant country road with a route sign showing three stops

This is how Google describes it in the guide to sending data to a server container.

You then view your reports in GA4 as usual. The difference lies in the route the data takes, via your own server.

Once GA4 is running stably, you can connect more services to the same server. According to Google, you decide yourself where the data goes from the server.

Your GA4 reports stay familiar. The route behind them changes.

Server-side tracking and cookies

Perhaps you have heard that tracking via your own server gets around the cookie rules. That is a misconception. Server-side tracking is a different route for your tracking data. The rules on consent stay the same.

Business owner from Brabant takes a different cycle route and waits patiently at the red traffic light

According to the Dutch Data Protection Authority (Autoriteit Persoonsgegevens), an organisation may only place tracking cookies if the visitor has been informed in advance and has given consent. Tracking cookies are cookies that keep track of what someone does online.

The Dutch rules, as the AP explains them, cover measuring and tracking with cookies or similar techniques. They apply regardless of where the technology runs, in the browser or on a server.

Your own server changes the route. Consent remains the starting point.

Consent Mode is a Google feature that passes the choice from your cookie banner on to your tags. If you work with a server container, those consent signals must come through there too. That way every tag on your server follows the same choice as the tags in the browser.

So the basis remains a good cookie banner that asks for consent honestly and passes on the choice correctly. Only then does your own server make sense.

Unsure what is allowed in your situation? For a legal opinion, a lawyer is the right person to ask. We take care of the technical side. The lawyer reviews the agreements and wording.

What server-side tracking asks of you

Your own tracking server is an extra machine in your business. That brings a few fixed obligations.

  • Your server runs day and night, for example in Google Cloud, with hosting costs that recur every month.
  • The server needs maintenance, because Google, browsers and advertising platforms regularly change their technology.
  • Someone with knowledge of DNS, tags and consent sets everything up.
  • Every change requires a new round of testing.

Think of it as a delivery van for your business. It runs fine as long as someone keeps an eye on the tyres, the oil and the paperwork. Just as with website maintenance a regular check-up pays off.

Owner of a coffee van from Brabant checks the tyre pressure of her van herself

An error in the connection sometimes only shows up weeks later, for example when a campaign suddenly seems to count fewer enquiries. That is why testing is part of every change.

Do you need server-side tracking?

Sound familiar? Your own records count more enquiries than your advertising platform shows and you never know which figure is right.

Kitchen fitter from Brabant compares his full order book with the shorter list on his laptop

Then your own server is a serious option. It makes most sense in these situations.

  • You advertise heavily and have your campaigns in Google Ads steered by measured enquiries or sales.
  • You send tracking data to several services and want to know exactly what each service receives.
  • Your customers often think it over for more than a week before they buy or call.
  • You have someone who sets up, tests and maintains the server.

For a small site with one advertising channel and a handful of enquiries a month, things are different. Then good tracking in the browser with a good cookie banner is enough for now.

Get that foundation right first. Are your goals in GA4 correct, does your tracking code wait for consent and do the choices come through properly? Then you have a solid foundation. Sometimes, by the way, the biggest gain lies in your pages themselves, through conversion optimisation.

First a sound foundation in the browser, only then your own server.

How to start with server-side tracking

Want to take the step? Then follow this order. Each step builds on the previous one.

Step 1. Make a tracking plan

Write down which events matter, such as an enquiry, an order or a phone call. Note for each service which data it really needs. That plan will determine what your server passes on.

Step 2. Get your cookie banner and Consent Mode in order

Check whether your tracking code waits for a choice and whether Consent Mode passes that choice on. A server container builds on those signals.

Step 3. Create a server container

Create a server container in Google Tag Manager and choose where the server runs, for example in Google Cloud. Include the ongoing hosting costs in your budget.

Step 4. Connect your own subdomain

Put the server on a subdomain of your website, such as meten.jouwbedrijf.nl. Google strongly recommends this before real traffic goes through it.

Step 5. Start with GA4

Start by routing only GA4 through the server. Send the events to the server container with the Google tag or your web container and let the GA4 tag pass them on.

Step 6. Test in preview mode

Open the Google Tag Manager preview mode and click through your site as if you were a customer. Try it once with a yes and once with a no in your banner. Then compare the figures in GA4 with your own records.

Step 7. Then connect your advertising platforms

Once GA4 works reliably, add advertising platforms one at a time. Test each platform separately before you connect the next one.

Would you rather have help with these steps? You can have us set up server-side tracking, from the server container to the connection with GA4. Book a call with Dominic for this. He will discuss with you which measurements really count for your business.

Questions about server-side tracking (FAQ)

What is server-side tracking?

Server-side tracking is measuring via your own server under your own domain. Your website first sends tracking data there and that server passes it on to services such as GA4. That way your visitor's browser talks to one address and you decide what each service receives.

What is the difference between client-side and server-side tracking?

With client-side tracking, all the tracking code runs in the browser and each piece of code talks to its own service directly. With server-side tracking, the data first passes through a server container on a server you manage. That is where you decide what goes through.

Is server-side tagging the same as server-side tracking?

In practice, people mean the same thing. Server-side tagging is the Google term for working with a server container in Google Tag Manager. Server-side tracking is the broader term for measuring via your own server.

Does server-side tracking work with GA4?

Yes. The Google tag or your web container sends events to the server container. The Google Analytics client is ready there as standard and a GA4 tag passes the data on. You then simply carry on working in your familiar GA4 reports.

Can I skip the cookie banner with server-side tracking?

No. According to the Dutch Data Protection Authority, you may only place tracking cookies after providing information and getting consent. Those rules also apply when your tracking runs via a server. Make sure your cookie banner and Consent Mode also pass your visitor's choice on to your server container.

Do I need server-side tracking as a small business owner?

That depends on your situation. If you advertise heavily, share data with several services and your sales take longer than a week, it is a serious option. With a small site and one channel, good browser tracking with a proper cookie banner is enough for now.

Conclusion

Server-side tracking sends your tracking data through your own server on your own domain first, which then passes it on to services such as GA4. That gives you more control over what goes through and less work in your visitor's browser. Consent remains the starting point. Get your tracking and cookie banner in order first, then build out step by step.

The next step

How we tackle this together

Discover your biggest growth opportunities with a free opportunity analysis (worth €416) — a tailor-made report, free of charge and with no obligation.

1Analysis
2Action plan
3Proposal
Schedule a call
Dominic Pietersz

About the author

Dominic Pietersz

Your dedicated point of contact

Dominic helps SMEs grow through Google and other channels. With his international experience, he turns challenges into concrete growth.

Follow Dominic on LinkedIn

Inspiration · Since the renovation, every parcel for my block lands with the neighbour downstairs first. She reads the label and only brings it round to those who have a 'please deliver' note on their door.