An Introduction to Server-Side Tracking

2022-11-21 | Article | Insights

What is it?

Server-side tracking is a new way of the Google Tag Manager to instrument your website. With the conventional tracking setup, Google Analytics was run on the users’ web browser. With server-side tracking, this is shifted to your web server instead.

With a conventional set up, the GTM snippet loads when the page is loading. Further, based on your configuration tags are fired as well. Basically, everything is happening client-side and all the data is collected and sent directly to Google Analytics servers.

Switching to server-side GTM replaces the user’s touch points with third party servers with an enterprise server-side GTM. The tracking hits are sent to the server-side GTM that is hosted under your own domain. This offers the change to aggregate all tracking hits of Google Analytics and of different marketing pixels into one.

The new server-GTM acts like a proxy in a cloud environment that is receiving all hits and forwarding them to other tools. This means, you are no longer sending hits directly to the endpoint server but hits are sent to a server-side GTM container and after that to the endpoint server, which collects the data.

In the long term, it enables you to run a full Digital Analytics and Marketing setup without loading any third-party code in the user’s browser or device.

Why would you need it?

If you are now wondering why you would want to change your setup and switch to server-side tagging, the following benefits might help with your decision. While there is a whole list of benefits you can get from server-side tagging, we will only focus and outline some of the major benefits.

Increase Page Performance

With the server-side GTM setup you only need one hit instead of several and you ideally do not need to load all marketing tracking libraries anymore. Thus, you might notice a performance improvement if the web page. Additionally, you can avoid a more complex blocking/ firing logic on client-side and move this to the Server GTM as well as any other computation-heavy tasks.

Better Control Over Data

Since your proxy now resides between the user’s device and the endpoint, you are in full control over what is sent to the vendor. Unless the IP address and the user-agent in the outgoing HTTP request from the server container are overridden, the values are not that of your server container and not of the user. This provides the chance to correctly anonymize these aspects of the HTTP protocol. In general you are in full control over what HTTP traffic is passed through the server container.

Reduce Impact of Ad Blockers

Ad blocking extensions usually block all requests to google-analytics.com/collect which means that also data if users that gave consent is not transferred when using an ad blocking extension. With server-side tagging a custom subdomain is created to which your data is sent. Currently, ad blockers do not block those requests which as of now reduces the impact of ad blocking.

Higher ITP Resilience

Intelligent Tracking Prevention (ITP) are some privacy-enhancing features of the Safari browser. One of those features is a shortened cookie expiration. Even 1st party cookies that are stored in a user’s browser by JavaScript will expire in 7 days (sometimes even 24 hours). In case the cookie is stored server-side we can avoid this limitation: If a server stores a cookie in a visitor’s browser the expiration date can be configured by you, e.g. you can set it to 2 years again.

Data Enrichment

With the server-side GTM the hit is sent from the backend which provides you with the ability to add additional data to the hits. For instance you can add CRM data to your hits or any other more confidential data. Another possibility would be to add data that takes too long to retrieve it in the frontend.

What needs to be done?

We will shortly outline the key steps that are needed to set up server-side tracking. This is not a in-depth guide but a quick overview of what is required:

Google Cloud Project and server-side GTM container

Create a billing account and a Google Cloud Project for Server GTM or any Cloud with docker functionality. Set up of App Engines or Cloud Run and a new Server GTM.

Create subdomain, adjust tags and create Google Analytics property

For each domain that is supposed to send traffic to the Server GTM you need to create a subdomain. Adjust tags accordingly to meet requirements. Create a temporary duplicate Google Analytics property for the test traffic and duplicate hits to this property.

Test and check

You can either use the Preview mode of the GTM container or the network tab of your browser. When checking you should see that the request now is not sent to google-analytics.com but to your container’s own domain. For the GTM switch to the preview mode of your server GTM and check if the request was received. If so, you will find it on the left side of the preview mode. Finally, go to your duplicated Google Analytics property and check the real-time reports and see whether your data is visible.

Things you have to keep in mind

While server-side tagging comes with a lot of benefits please also be aware of the following points before setting it up:
  • Responsibility that data reaches its destination in the correct format is shifted to you.
  • Having enough servers to handle the requests is moved to your end.
  • Unlike the GTM web container server-side tracking comes with some additional cost i.e. for needed cloud server and logging.
  • A pure server GTM tags for GA4 do not support audiences and hence remarketing based on these audiences. Google Signals is also not yet supported.

Digitl is here to help

We understand that building, tracking and automating the data flow from the website to your own server to data analytics tools sounds complex and like a lot of work. If you need advice, we at Digitl are happy to support you with this topic. Reach out to us if you want to have a conversation and discuss the best strategy for your data architecture.

Do you need more Info?

Contact us