Intro To Server-Side Tracking In Google Tag Manager
This blog is intended to introduce server-side tagging in Google Tag Manager (GTM) in conjunction with Google Analytics 4 (GA4) and its benefits. Google introduced this new layer of complex functionality for measuring events and collecting user data in August 2020. You can now send data from your website to a specific server where your GTM instance is virtually loaded. From there you can send that data from your server to different places, such as Google Analytics and Facebook ads.
Server-side tagging in GTM still uses the tag, trigger, and variable model you are familiar with, while providing new tools to measure your analytics and user activity no matter where it happens.
A Traditional Website Configuration Using Google Tag Manager
A traditional tagging configuration in GTM relies on a container loaded on the page to send measurement data to various collection servers. The following diagram illustrates how GTM’s web container running in a web browser sends data to multiple servers.
A Website Configuration Using A Server Container On Google Tag Manager
In contrast, a website configuration with a server container doesn't run in the user's browser or on their phone. Instead, it runs on a server that you control.
This server can run in your Google Cloud Platform (GCP) project or a different environment. If you need help setting up your GCP, read our blog here. This gives you access to the data in the server until you choose to send it elsewhere giving you full control over how that data is shaped and where it is routed from the server. With this you can:
- Control how your data is shaped
- Manage where your server data is routed
- Build tags using sandboxed JavaScript technology
- Assign permissions to give you visibility into what a tag can do
- Set boundaries around the container
The server will receive web requests from a user’s device and converts those requests into events. These events are processed by the container’s tags, triggers, and variables. The server-side tagging model introduces two important questions for your server containers:
1. How does measurement data get from a user’s device to the server container?
2. How does measurement data sent to a server container get transformed into an event?
The answer to both of these questions is an entity used in server containers, referred to as a client.
What’s A Client And How Does It Work
A client is an adapter that runs between the software on a user’s device and your server container. The different steps in how clients work operate in the following order:
- Receives measurement data from a device
- Converts that data into one or more events
- Routes data to be processed in the container
- Client packages up the results to send back to the requester
Benefits Of Server-Side Tagging
There are several advantages to implementing server-side tagging using GTM. Let’s get into it!
Better Data Collection And Conversion Tracking
As we move into a cookieless world, businesses face increased demands on leveraging first-party data. Adblockers and tracking restrictions affect the accuracy of your website’s data collection. This is one reason why Google, Facebook, and other platforms are highly recommending businesses implement server-side tracking. This is achieved by the use of a custom subdomain for server-side tagging that sets first-party cookies and replaces the request domain. This benefit also helps with advanced event matching based on user data.
Better Security
Data is send to a cloud instance after it is securely collected and distributed in your server-side environment. Here it is processed and routed by other tags. This allows you to better protect your visitor data.
Reduced Load On A Page
Multiple third-party tracking scripts and tags can slow down your site, leading to poor user experiences and a lower organic ranking. Fewer measurement tags loaded on your website or app means less code to run. This results in an improved page load time which benefits search engine optimization (SEO). Slow page load times also lead to higher bounce rates.
Control What Data Is Sent Vendors
With a server-side tagging implementation, you can control what data is sent to each vendor. They can only access the information configured in the request to ensure no personal user data is being sent.
Reduce Impact Of Ad Blockers
By configuring your server-side tagging with a subdomain, tracking requests are sent from your primary domain. Making it so the AdBlocker can’t detect them on the subdomain.
Governance And Control
This benefit has something in common with the data control one. Due to regulations like GDPR, CCPA, or CSP, you should strictly control when you collect information about your site visitors and to whom you share it. It is forbidden to send any personally identifiable information (PII) to third-party vendors. If you're not familiar with PII, check out our blog going over what it is and the implications of collecting it.
Since server tracking allows you to completely control data flow, each vendor will receive only information configured in your server-side tags.
First-Party Cookies & Extended Cookie Lifetime
When setting up a server container in GTM, its recommended to use a custom subdomain so you can set first-party cookies. With a GTM server container you can extend the life of your cookies to two years.
In Closing
Server-side tracking has several advantages. It can help improve the accuracy and control over your data collection, speed up the page load speed of your websites, and reduce the impact of data challenges with adblockers.
The complexity of server-side tracking can be daunting, but our friendly team is ready to help! Reach out to us at [email protected].
Until then, happy tracking!