Want to make your data flow smoother with Google Tag Manager? Setting up push subscriptions in a GTM server container is a simple way to automate the process and improve your tracking. In this post, we’ll show you how to set it up, how it works, and how it can make your data handling easier. Let’s dive in!
Imagine two people: one who shares information (the "publisher") and one who receives it (the "subscriber"). In Pub/Sub, the publisher sends messages (such as data or updates) to a "topic," which acts like a mailbox. The subscriber can retrieve these messages from the mailbox whenever they're ready.
This system is handy when sending data from one place (like a website or app) to another (like a cloud server). It’s great for tasks like processing data or triggering actions. Pub/Sub automates this process, making it easy to manage! Google has detailed documentation on it.Pub/Sub offers multiple subscription options, such as:
This article will focus on Push subscriptions, which are the easiest to manage with your Google Tag Manager server container.
Required roles and permissions
To create a subscription, you must configure access control at the project level. You'll also need resource-level permissions if your subscriptions and topics are in separate projects. To get the necessary permissions, ask your administrator to grant you the Pub/Sub Editor (roles/pubsub.editor) IAM role on the project.
In the Google Cloud console, go to the Subscriptions page.
How to listen for messages with server GTMListening to push subscriptions with the Google Tag Manager server is no different than handling any other generic webhook; we’ve discussed this in detail in our blog post on debugging incoming webhooks in the Google Tag Manager server preview.
If you want to track data using server-side tagging without relying on the GA script, you can send data directly to your GTM server container using webhooks — for example, from your CRM.
The challenge comes when you want to test incoming webhook data in server preview mode. Usually, you’d use cookies like gtm_preview or the HTTP preview header, but third-party cookies don’t work with webhooks. The solution? The X-Gtm-Server-Preview HTTP header.
Stape now includes a feature that makes it easier to debug incoming HTTP requests. Here’s how it works:
Creating a custom event trigger can help in debugging incoming HTTP requests more effectively by allowing for more granular control over which events are tracked based on specific client conditions.
It may sound complicated, but don’t worry — we’ve got detailed guides on:
This is another excellent example of how server-side Google Tag Manager (sGTM) can do more than just tracking and measurement. It’s also perfect for automating tasks and handling data in ways that make life easier for your business. From routing data to triggering actions and integrating different systems, GTM’s server container helps you manage things more efficiently.
If you want to see how it works for yourself, feel free to contact Stape support—we’re happy to help. You can also try it for free and see how it fits into your setup.
Stape has lots of tags for server GTM! Click on Try for free to register and check them all.