selnekovic.com

Server-side GTM Q&A – common sense version

Are you considering deploying server-side Google Tag Manager (sGTM) and looking for useful information? Many people still have misconceptions about what sGTM is and how it works. Based on the most common questions I’ve received from clients, I’ve put together 10 practical and pragmatic Q&As. I believe they will help you gain a clearer understanding of sGTM’s core principles and simplify your decision-making process.

Let’s get started!

1. What is the best argument for setting up server-side GTM?

The best argument depends on your specific needs and expectations, so it can differ from person to person. In some cases, deploying sGTM might not be necessary, and client-side tagging could be sufficient option. However, the main benefits typically include:

  • Increased data quantity and quality
    • sGTM slightly eliminates the impact of ad blockers and cookie restrictions, which often cause data loss in traditional client-side tracking. Slightly – I mean a few percent.
    • It enables data transformation and enrichment using backend or CRM data. This is one of the top reasons for me.
  • Improved website speed
    • Reducing the number of scripts and requests on the user side, lessens browser load and shortens page load times. Usually, it is in milliseconds, not seconds.
  • Privacy protection and regulatory compliance
    • sGTM gives you control over which data is collected and shared with third parties.
    • It enhances compliance with GDPR and other regulations by allowing you to anonymize or filter sensitive data before sending it to servers. Great for companies with strict privacy regulations.
  • My competitors have it
    • That’s a reason too. But apart from peace of mind, it may not bring any real benefits to your business.

2. What are the downsides of server-side GTM?

The main disadvantage of server-side GTM is that it is not for free — at least, not usually. Implementation costs are higher due to expenses for cloud services or self-hosted servers which require technical expertise. Incorrect configuration can lead to data loss or unexpected cost increases. Additionally, maintaining sGTM requires ongoing monitoring and upkeep — it is not a one-time investment.

However, the sGTM interface is very similar to client-side GTM, so there’s no need to learn an entirely new tool. The key difference is that sGTM processes incoming requests rather than direct user interactions on the website.

Server-side GTM interface
Server-side GTM interface

3. How much does server-side GTM cost per month?

Creating an sGTM container and using it is free. However, you have to pay for server hosting. The cost varies depending on factors such as the cloud provider, data transfer volume, and specific configurations. Here are two common deployment options:

Google Cloud Platform (GCP)

If you use Google Cloud Run to host server-side GTM, pricing is based on computing power (CPU & memory) and data transfer volume. Google Cloud offers some free quotas, so small websites with optimized setups may run almost at no cost. As of writing, the approximate costs are:

  • €7/month – 250,000 requests/month
  • €30/month – 10,000,000 requests/month
  • €100/month – 25,000,000 requests/month

You can use Google pricing calculator to determine the exact price if you really want to — but trust me, you don’t want to.

Stape

Stape is a specialized server-side GTM provider offering various plans based on the number of requests and included services. Current pricing:

  • Free – 10,000 requests/month
  • €20/month – 500,000 requests/month
  • €150/month – 10,000,000 requests/month
  • €200/month – 20,000,000 requests/month

Comparing GCP and Stape solely by request volume isn’t entirely fair. Stape includes support and additional services in its pricing, whereas GCP requires separate payments for similar add-ons.


1 request ≠ 1 pageview. A pageview is just one of many events sent to the sGTM server. The number of requests depends on the types and frequency of tracked events (clicks, scrolling, e-commerce events, etc.). To roughly estimate requests based on pageviews, divide the number of requests by at least five.


4. Which option is better — Google Cloud Platform, Stape, or a self-hosted server?

It depends. There is no one-size-fits-all solution. My perspective:

  • Google Cloud Platform offers flexibility, scalability, and high security, but requires some technical expertise for setup, maintenance, and monitoring. It’s ideal for companies that want control over their infrastructure and can handle the complexity.
  • Stape is a simpler, more user-friendly solution suitable for small/middle size websites and businesses looking for a hassle-free option without technical knowledge. However, costs can be higher for large data volumes, and flexibility is limited.
  • A self-hosted server provides complete control but requires higher management, maintenance, and technical costs. This is best for organizations with specific needs and strong technical capabilities.

I prefer Google Cloud Run for sGTM deployment. I appreciate its scalability and seamless integration with other Google Cloud services while keeping costs reasonable.

Cloud Run Metrics
Cloud Run Metrics

5. What is the process of setting up sGTM, and how long does it take?

The deployment process varies by cloud provider, but the main steps usually are:

  1. Create a server container in GTM:
    • This will hold tags, process incoming requests, and forward data.
  2. Set up a cloud server and link it to the sGTM container:
    • Choose Google Cloud Run, Stape, or a self-hosted server and configure it properly.
  3. Map a custom subdomain (optional):
    • It helps bypass ad blockers and extends cookie lifespan (e.g., sgtm.yourdomain.com).
  4. Configure tags and tracking:
    • Set up tags in the sGTM container (GA4, Facebook CAPI, Google Ads, etc.).
  5. Testing and debugging (optional 😁):
    • Use the Preview mode in GTM to verify data flow before going live.
  6. Deployment and monitoring:
    • Publish the container and monitor performance.
  7. Modify GTM scripts on your website (optional):
    • Adjust scripts to load GTM from your own server instead of Google’s servers.

Timeframe:
Implementation duration varies. A major bottleneck can be subdomain mapping, especially in larger companies with strict security policies. Based on my experience, deployment has taken anywhere from one week to several months.

6. Why do I need client-side GTM if I have server-side GTM?

sGTM is not a replacement for client-side GTM — it’s an extension of it. In general, you have three options:

  • Hybrid setup: Before adding sGTM, client-side GTM collects user interaction data and sends it to marketing and analytics tools. After adding sGTM, it works as a processing layer, receiving data from client-side GTM and forwarding it to platforms like Google Analytics or Facebook. Client-side GTM does not communicate directly with the target platforms but instead with server-side GTM.
  • Pure server-side tracking (without client-side GTM) is complex and rarely used — it requires direct data transmission from the web server or backend. I have never seen this setup in reality.
  • Dual tracking (both client-side and server-side) can be useful for verifying server GTM functionality.

7. How does sGTM extend cookie lifespan?

Server-side GTM extends the lifespan of cookies by storing them in a so-called first-party context. First-party cookies are tied to the domain of the website the user is visiting, making them less susceptible to blocking by browsers or ad blockers.

These cookies are managed directly by sGTM, which can store them either in the user’s browser or in an external storage solution like Firestore or another database.

Extending cookie lifespan sometimes feels like a game of cat and mouse. Browsers like Safari continuously introduce new restrictions on cookie storage and lifespan through tools like Intelligent Tracking Prevention (ITP).

Whenever a solution emerges to mitigate or bypass these restrictions, browsers respond with further updates aimed at counteracting those techniques—creating an ongoing cycle.

8. What are the most common sGTM issues?

Besides incorrect tag or trigger settings, most issues with server-side GTM are caused by errors in the setup of client-side GTM.

A common example is event duplication when using Facebook Pixel and the Conversion API (CAPI). This issue often arises due to improper configuration. To ensure correct deduplication, both the Facebook Pixel and the GA4 tag containing the event ID must be triggered on the same event.

I prefer using Facebook Conversion API without client-side Pixel tags, but that’s a topic for another discussion.

A specific issue with server-side GTM is a complete loss of tracking, which can occur if the Google Cloud billing account has an invalid payment card. This problem can be easily avoided by adding a backup payment method.

9. What are some real-world use cases for sGTM?

Server-side GTM offers a wide range of practical use cases, which vary depending on the needs and circumstances of a particular project.

Here are three specific examples:

  • Page Speed Optimization: By shifting marketing tags and parallel “roll-up”* tracking from client-side GTM to server-side GTM, the size of the client-side container is significantly reduced. For one client, this led to a roughly 50% decrease, positively impacting website loading speed. Improved page speed benefits user experience, SEO, and conversion rates.
  • Profit-Based Bidding: A client didn’t want to send product margin data along with purchase details. To address this, we stored product margin data in Firestore. When a conversion event occurred, sGTM retrieved this data and replaced the standard purchase value with the total product margins. This approach improved campaign efficiency by optimizing for profitability rather than just product prices.
  • Backend Conversion Forwarding: Not all trackable events happen on a website. For one client, we implemented a solution where payment notifications from their backend system were sent as conversions to Facebook Conversion API (CAPI) via server-side GTM. This ensures that relevant off-site events can still be effectively tracked and utilized.

* roll-up = GA4 property for multiple web sites. It is available only in Google Analytics 360, but you can do something similar using GTM.

10. Can I set up sGTM myself?

Yes, you can deploy server-side GTM yourself if you have some technical skills and time. Deploying the Cloud Run server or Stape itself can be done in 15 minutes. More challenging is domain mapping and proper setting.

To get started, I recommend checking out the Server-side Tagging in Google Tag Manager course by Simo Ahava.

Additionally, reviewing Google’s official documentation is helpful, as it provides detailed information on setup and configuration.


Final Thoughts

Deploy server-side GTM or not? That’s the question.

Ideally, your analytics and marketing platforms will receive higher-quality, more accurate data, leading to better campaign evaluation and increased efficiency. A faster-loading website enhances user experience, improves SEO, and positively impacts conversion rates. Plus, everything remains fully compliant with GDPR and other data privacy regulations.

However, in the worst-case scenario, you might end up paying for something you don’t really need or don’t know how to fully leverage.

📩 If you still have any unanswered questions, feel free to reach out. I’ll be happy to help!

Note: this post was originally written for Dase. Here is a link to the Slovak version.

Share the wisdom