Server-side GTM: Data Privacy, Compliance, and Efficiency

2024-11-11

By: Johan Strand

Senior Digital Analyst

Feature image

Server-side Google Tag Manager (GTM) allows website owners to collect and manage user data by shifting data processing from the client (the user’s browser) to a server they control. Unlike traditional client-side GTM, which runs directly in the user’s browser, server-side GTM enables a proxy server to process the data before sending it to third-party platforms. This setup enhances privacy by ensuring that third parties do not directly access the user’s browser or device.

Key Advantages:

  • Data Enrichment
  • Data Stream Consolidation
  • Privacy & Compliance

Data Enrichment & Modification

With traditional tracking, where we load external JavaScript into the webpage via the user’s browser, there are many limitations. The information we send must be available in the page’s dataLayer, making it challenging to add additional information. Many tracking pixels also have limited options for defining and controlling the data sent. Here, Server-side GTM offers several advantages and new possibilities. Since all tracking data flows through Server-side GTM, it provides us with the opportunity to modify the data before it reaches third parties.

Transformations

Using transformations, we can modify data before it is forwarded to third parties. For instance, we may have data that doesn’t follow the correct naming conventions and needs to be renamed, or we might want to perform calculations, such as deducting VAT. It’s also common to prevent sensitive information from being shared with third parties. For example, we may not want to share the entire page URL or might want to mask certain product details before sending them onward.

Enrichment Through APIs & Firestore

From our server-side instance, we can retrieve data to enrich events before they are sent to third parties. By making requests to an API or performing lookups in Cloud Firestore, we can fetch information about customers or products, such as the customer segment associated with a customer ID or the profit margin for a specific product. We can do this each time a new event is tracked, enriching it before it’s sent to platforms like Google Analytics or Facebook Ads.

Data Stream Consolidation

Most websites or apps today want to send data to multiple services, such as for analytics and marketing. Traditionally, this has required loading an extra JavaScript library for each service on the website, which gathers information and makes requests with tracking data to each third party. With Server-side GTM, we can streamline this process by making a single call, for example, when a purchase occurs. Server-side GTM receives the event and forwards the information in the correct format to each third-party service with which we want to share data. This reduces the number of third-party JavaScript files on our website and the number of calls made from the user’s browser.

Privacy & Compliance

Server-side GTM offers several privacy and compliance benefits, making it particularly valuable in today’s data privacy-conscious environment:

  • Prevents Third-party Data Access
    Unlike client-side tracking, where third-party scripts can access the user’s browser and potentially extract sensitive data, server-side GTM keeps third-party vendors away from the client environment. Data is first routed through your server, allowing you to control what information is shared.
    For a practical example of when things can go wrong, read our article on regulatory action against the Meta Pixel.

  • Selective Data Sharing
    You have complete control over the data sent to third parties. This means you can filter out any personal information (PII) or other sensitive data before it leaves your server, ensuring compliance with regulations like GDPR.

  • Cookie Management Control
    Server-side GTM allows full control over what cookies are set and read in the user’s browser. This reduces the risk of unauthorized data collection or cookie misuse, enhancing user trust and adhering to compliance frameworks that require transparency in cookie usage.

How To Get Started

Setting up Server-side GTM can be done either on your own or with the help of a consultancy.

Option 1: Setting It Up Yourself

There are three major steps to complete to get started.

  1. Hosting The Server Instance
    Setting up Server-side GTM independently requires some technical expertise. You’ll need to configure a server (e.g., Google Cloud, AWS, or on-premises) and set up a CDN or load balancer to enable first-party advantages, like longer-lasting cookies.

  2. Server Container Setup
    Start by creating a new GTM container and selecting “Server” as the container type. There is some initial configuration that needs to be done.

  3. Tag Configuration
    After setting up your server and the container, configure the necessary clients and tags, such as analytics or advertising tags, to process data on the server before sending it out.

Option 2: Use a Consultant

For a quicker and more secure setup, consider hiring a consultancy to configure server-side GTM. This approach provides access to experienced professionals who can bridge IT and Marketing needs, ensuring a technically sound, compliant setup optimized for your goals. Consultants can also:

  • Reduce Implementation Risks
    With their expertise, consultancies can minimize the risk of configuration errors, helping avoid data collection gaps or privacy compliance issues.

  • Tailor the Configuration
    They can customize your GTM setup to align with specific business needs, such as integrating with APIs or leveraging advanced data enrichment techniques.

  • Ensure Ongoing Optimization
    Many consultancies offer ongoing support to adapt your setup to evolving data regulations and marketing strategies, ensuring you maintain a competitive edge.

Regardless of who sets it up, server-side GTM allows you to control the server yourself, maintaining control over data processing and cookie management. Whether you seek greater privacy or better data control, server-side GTM is a scalable and efficient solution.

Cost

Server-side GTM is relatively simple to set up and can be hosted at a low cost, making it accessible for businesses of various sizes. The most common setup is to host it on Google Cloud Run. For a site tracking around 10 million events per month, the cost is roughly $145 per month, which can be further optimized.

Need Help? Contact Us!

Server-side GTM is one of Ctrl Digital’s specialties, with several years of experience setting it up for clients. If you’re interested in assistance, don’t hesitate to contact us at [email protected].