You’ve probably heard of website tagging if you’re part of a marketing or analytics team. This process involves adding code snippets to your website or app to gather data for measurement by a marketing team or partner. Previously, the only option available was client-side tagging, executing tags on the user’s device. However, with server-side tagging, the tags are executed on a server instead.
Server-side tagging doesn’t replace client-side tagging but provides an additional layer of control between the user and marketing vendors. This results in improved page speed, more restrictive content security policies, improved privacy, and more secure and durable cookies.
Regarding server-side tagging, the tags must be placed in a Tag Manager server container. The container works with a Tag Manager web container or the gtag.js library to collect data from the web browser and dispatch it to the server-side tagging environment.
A client is a Tag Manager resource only available in server containers. It parses incoming HTTP requests to generate event data objects for tags to utilize. The triggers in a server container are related to the event data object, and not all clients generate event data objects. Variables in a server container usually reference items in the event data object.
While server-side tagging is excellent for controlling data, some tags still need to run in the browser or app to collect data about user interactions on a web page. For this, you must place the GA4 Configuration tag in the web browser to dispatch information to the server-side tagging endpoint. Similarly, you need to place a GA4 Event tag in the Tag Manager web container to collect custom events related to website interactions.
In summary, server-side tagging provides a layer of control for data collected by marketing vendors. It complements client-side tagging and is executed on a server using a Tag Manager server container. While some tags still need to run in the browser or app, server-side tagging provides benefits such as improved page speed, content security policies, privacy, and secure cookies.