Advancing Privacy and Data Control with Google Tag Manager Server‑Side Containers

March 31, 2021
Blog image for Advancing Privacy and Data Control with Google Tag Manager Server-Side Containers

The world of digital analytics has been quickly evolving over the last few years. The ways in which we collect data are more important now than ever. With recent announcements over the years on topics such as WebKit's Intelligent Tracking Prevent (ITP) and GDPR (General Data Protection Regulation), it can feel overwhelming to navigate and comply around these without losing out on essential data important to our business.

Google's recently released server containers on Google Tag Manager (GTM) allow us to have that flexibility and power over our data to address the ever-evolving digital world! These server containers give us the ability to redirect outgoing requests that would normally be on the client-side to our cloud server before it's sent over to the appropriate data collection site. This opens up various new opportunities we may not have had available to us in the past when using the other existing container types.

What Is Server-Side Tag Management?

Previously, Google Tag Manager had only provided containers for tracking on web, AMP, iOS, and Android. These are all client-side, meaning that the GTM container code runs on the user's device to evaluate triggers and execute the tags that send data to analytics and advertising tools. That means GTM itself runs the JavaScript (for web and AMP) or native code (for mobile apps) on the user's device.

Flow of traditional web container in Google Tag Manager

Flow of traditional web container in Google Tag Manager

GTM's new server-side containers, in contrast, run tag code on a server in the cloud. The client (web browser, app, or other context) still generates some data, but it's sent to the server, and the evaluation of triggers and tags happens there, rather than on the client-side. That's it in a nutshell. This can have a number of benefits, which are outlined below.

Flow of server-side container in Google Tag Manager

Flow of server-side container in Google Tag Manager

The server-side containers work much like the GTM containers you're already familiar with— they have tags, triggers, and variables, you can create your own templates, and so on. There's an additional building block that's now called a Client, which is the part that handles the incoming request of data from the client (go figure!). And of course, there's some additional setup that's needed here—the server has to be actually set up in the cloud, your domain configured, and so on.

This post isn't going to go into the technical details of that setup, but there's plenty of documentation, and Simo Ahava has a post with more information.

Server-Side Containers Unlock New Opportunities

So what's all the fuss? What does a server-side GTM container do that a client-side one doesn't?

The most exciting capabilities of server-side containers are those that open up new possibilities that client-side containers can't.

Server-side containers provide a number of options for working within privacy and security restrictions. Setting cookies with the server is possible for working within ITP and other browser restrictions to maintain longer-lasting cookies for users.

Using your own domain for the container makes it easier to work within your site's Content Security Policy without opening it up for all of the third-party tags you might be using.

You can also redact PII or potentially finger printable data from the data that's sent to third parties, without them ever having a direct connection to the client. This is a key feature for a privacy-safe ecosystem.

Managing your code in a server-side container also allows you to store credentials to access authenticated APIs you might use to manage or enrich the data you are collecting about users. In a client-side container, such credentials would be exposed to anyone looking at the code in the web browser. But with a server-side container, you could access internal data about users —an identity or consent-management service, for example—or data from a CRM or other third-party.

Finally, server-side containers open up using Google Tag Manager in platforms with no client-side SDK. For example, there are connected TV platforms, such as Roku, that don't have a client-side GTM container. Sending data from a platform like that to a server-side GTM container, you have all the capabilities of GTM, including cleaning up that data before sending it and using multiple tags to send data to multiple destinations. You can also use GTM server-side tracking for offline transactions.

There are some potential incremental benefits to using a server-side container as a replacement or addition to existing client-side containers.

For one, a server-side container can give performance benefits. As an example, remember that a client-side container for web executes all the tags in the web browser? If you have a lot of tags, that can potentially slow down the performance of the page—especially if you have custom tags or tags that are not well-optimized for performance by the vendor who provides them. By moving the execution of the tags onto the server, however, you can alleviate the burden on the user's web browser to execute all that JavaScript.

A server-side container may also help reduce spam in your collected data. By removing tracking IDs such as your Google Analytics property ID from the client-side, you obscure these targets from spambots. (See Notes on Filtering Spam and Bots from Google Analytics for more information on how spammers target analytics and other steps you can take to help prevent it.)

Keep in mind—although the benefits mostly outweigh the cons—utilizing a server container may require additional technical capabilities. This means having someone who understands infrastructure concepts such as DNS and cloud server configuration.

Also, as with any GTM container, you may need someone who has basic coding knowledge. As of when this blog was written, there are very few templates available out-of-the-box, meaning your business may need to create custom tag templates and possibly even custom client templates to handle the incoming requests to the server container.

What Does It Take to Set Up Server-Side Google Tag Manager?

GTM's server-side containers open up a lot of new possibilities, expanding our use of GTM to more contexts. If some of the above applications appeal to you, here's what you'll need.

As mentioned above, server-side GTM does require setting up, well, a server. Fortunately, Google makes that easy to do on Google Cloud Platform using App Engine. There are some costs associated with running this server, and they scale depending on the amount of traffic you need to handle, but for many sites, the requirements will net out to around $50–$200/month. You can get an estimate for App Engine by using Google's Cloud Pricing Calculator.

There's also some additional thinking that needs to go into your strategy. If you're replacing existing client-side containers, luckily, that is easy to do on an incremental basis. You can set up the new server-side container and use the existing client-side container to convert existing tags to route the data to the server instead. If you're adding entirely new capabilities with a server-side container, keep in mind that those might take code development to achieve.

Finally, we'd be remiss if we didn't point out that you need to consider this in the context of your privacy and security obligations to your users. GTM server-side opens up new possibilities, but it doesn't absolve you of your responsibilities for disclosure and protection of user data by regulation or your own policies. Consider those carefully as you add any new capabilities or types of tracking.

So, Who Should Consider Server-Side Tagging?

In summary, there is no one particular industry or business that would benefit from this recently released feature—really anyone can benefit from Google Tag Manager's server-side containers!

Whether your business has additional security measures it wants to take or your business simply wants to improve marketing attribution efficiencies, there is a reason for everyone to consider looking into it.

GTM server-side containers are available now—start creating yours today!