Five tips and considerations for starting out with server-side Google Tag Manager

Matt Redford


Analytics and Data Science

Server-side tracking is the latest container type within Google Tag Manager. This container type switches tracking from the browser or app (client-side) to the cloud (server-side) for processing. This is a fundamental shift and provides several advantages from a performance and security point of view. The key advantages of server-side tracking are: 

  • Tracking requests will be processed through an endpoint you own and manage rather than directly to the vendor (Google Analytics for example) 
  • Performance is improved by reducing the amount of client-side JavaScript tags and/or HTTP requests. 

In this blog, we’ll provide five tips and considerations to help you get started with server-side Google Tag Manager. 

Understand how clients work 

Server-side containers introduce a new mechanism called clients, which are not found in the common web container. It is therefore important to understand the concept of a client before making any changes to a production-ready server-side container. 

A client is created to claim an incoming request based on priority. Once a client has claimed a request it processes and transforms the data into an event that the container can understand with the use of tags, triggers and variables. A response can also be sent back to the requestor. 

Popular tags such as Google Analytics will have clients pre-built and are immediately available in the container. It is also worthwhile keeping an eye on the community template gallery as it expands to see if a client already exists for the tracking you’d like to add. 

This official guide will give you a more comprehensive overview of how clients work. 

Define the location of your cloud server with that of your users to improve efficiency and reduce costs 

The server-side container approach naturally links up with Google’s own cloud technology platform, Google Cloud Platform (GCP). You can automatically provision a central US-based tagging server within the Tag Manager interface, but this may not be the best option for your businessIn the default scenario, all tracking requests will be processed in this location, which is inefficient if most of your website or app traffic originates from outside of the US.

Manually provisioning a tagging server in or as close to your core users as possible will improve tracking responsiveness and reduce GCP costs by eliminating the distance at which network traffic must travel. 

Image source: Google: Current GCP Network and Zones – September 2021

This step-by-step guide will assist you through the process of manually provisioning a tagging server. A note of caution, however, some technical expertise is required!

Set up a first-party endpoint for tracking requests

The default tagging server will be hosted on an automatically generated Google App Engine domain. This will be the URL endpoint at which you will push tracking requests to the server container. However, it is highly recommended that you create your own custom website subdomain as your endpoint (example: tracking.yourwebsite.com). This will enable you to:

  • Set cookies in a first-party context. This is very important in a digital world where browsers are starting to phase out and block third-party cookies altogether. In addition, setting first-party cookies on the server-side also enables you to bypass cookie expiry limitations set by JavaScript tags via mechanisms such as Safari’s ITP (Intelligent Tracking Prevention).
  • Maintain a cleaner CSP (Content Security Policy) with fewer tracking endpoints on your website and app.

This step-by-step guide will help you set up a custom domain for your tagging server. You will likely need IT support to assist with the domain creation and configuration.

Reduce tracking endpoint requests where possible

The traditional website JavaScript tagging approach enables tags to communicate with their respective endpoint(s) directly. The server-side approach is fundamentally different as tracking requests will be routed through an endpoint that you own. In this scenario, you could have several server-side tags fire on the back of just one HTTP request from your website. This would be very efficient and improve website performance by reducing the amount of HTTP requests it makes.

This route would require some careful technical planning but would be worthwhile in a competitive market where every positive gain counts.

Review GCP server set-up and costs

You will get one server within your GCP project if you choose the automatic provision option when creating a server-side container. This may be fine for low traffic websites/testing reasons, but you’ll likely need to upgrade to an App Engine Flex Environment with autoscaling enabled for production deployments.

The minimum and maximum number of servers required will depend entirely on the amount of traffic you expect to receive. On average each server is expected to cost around £30 per month. It is therefore important to estimate traffic levels and GCP costs prior to deployment. It is also advisable to review usage as the project progresses to ensure it is set up correctly for your needs.

As a Google Marketing Platform Sales Partner, we have the in-house expertise to utilise server-side Google Tag Manager and deliver bespoke tracking solutions – get in touch and see how we can help.

Want the latest data news delivered straight into your inbox?Sign up to our email newsletter


x
Get the latest digital marketing insights delivered to your inbox