Server-to-server tracking is a method that more and more businesses use to understand better what users do on different websites or improve their advertising. It's different from older ways of tracking because it allows you to collect data more accurately, follows privacy rules better, and doesn't depend as much on third-party cookies and web scripts that web browsers can block.
The Google Tag Manager server container is the most common tool for integrating server-side tracking. sGTM has two ways of integrating server-side tracking: web+server (the most popular one) and server-to-server.
This blog post delves into server-to-server tracking using Google Tag Manager's server container capabilities. We'll explore how it works, its benefits, and how you can implement it to gain deeper insights into your analytics while maintaining user privacy and data integrity.
This method is the most popular one. With the hybrid method, you use a web GTM container to deliver data to the server GTM container. Configuring Google Tag Manager server-side involves setting up the server using Google Cloud Run, sending data to the SGTM container, and establishing a custom domain for better tracking in a first-party context. The two most popular ways to deliver data from the web to server GTM are server-side GA4 or Data Tag/Data Client.
Benefits of using server-side GA4 for sending data from web to server GTM:
Disadvantages of using server-side GA4:
Server-to-server tracking is a data collection method that sends information directly from one server to another. Data collected in this way bypasses the client-side or user’s browser.
Implementing a server-side tagging setup in Google Tag Manager (GTM) can improve data accuracy and website performance by reducing the client load and minimizing third-party JavaScript execution in the user's browser. However, S2S tracking is more challenging to set up than web+server.
The fundamental difficulty of s2s tracking in sGTM lies in delivering and debugging data to sGTM. The most popular way to provide data to sGTM is through webhooks, which can be sent from CRM or CMS.
2. Add Container Name → Under Target platform, choose Server. Click Create.
3. Choose Manually provision tagging server. Copy your container config. We will need it in the following steps.
1. Go to stape.io and create an account or log in. You can try our service for free and explore the benefits of Stape hosting for the GTM server.
2. Press the button Create container in the top right corner.
3. Enter your container details:
4. Choose a plan for your container. You can start with a Free plan. Click Continue with a Free plan.
You will see the status of your container, container config, and plan name. It takes around five minutes to deploy a server container. Please reload the page to update the status. If the setup was done correctly, you should see the status “Running.”
Once your server container is ready, you configure tags to send data, triggers to determine when those tags should fire, and variables to store the dynamic information your tags and triggers rely on. For example, tags might send purchase data to Google Analytics, triggers would control when that happens, and variables could capture user session details from requests. This setup allows you to manage data collection with precision and flexibility.
Note: Setting up a server container requires technical expertise and familiarity with Google Cloud Platform and Google Tag Manager. If uncomfortable with these tools, consider seeking professional assistance to ensure a smooth server-side setup process. |
By following these steps, you can successfully set up a server container in Google Tag Manager, enabling you to leverage the full benefits of server-side tagging.
This server-side setup will help you collect accurate data, improve website performance, and enhance user privacy, ensuring your analytics strategy is effective and compliant with modern standards.
Using webhooks from CRM to sGTM can provide valuable insights about offline sales. Configuring webhooks is easy in sGTM, thanks to the sGTM preview header powered by Stape.
Using webhooks from payment processors is another popular way of delivering data to sGTM. It can be beneficial if you want to track recurring orders, upsells, or refunds in sGTM.
With the help of Stape’s Shopify App, Magento extension, and WordPress plugin, sending server data from these CMS to sGTM is easy. I will show you how to set it up later in this blog post.
Stape iOS, Android, PHP, and Node.js SDK allow sending events from apps to the Stape Data Client.
In this example, I will use the WordPress Stape plugin to send server data to sGTM. The debugging and retrieving data in sGTM will be identical for all ways of delivering data to sGTM. So, it does not matter how you send data. The steps of debugging and retrieving data will be the same for you.
3. Go to the Webhooks tab:
4. Open the server Google Tag Manager container and enable the preview.
5. Go to your Stape.io account and open the container to configure server events.
6. Add Data Client to sGTM container.
7. Configure Data Client in sGTM.
8. Open sGTM preview mode and test that the webhook was processed successfully. I’ve made a test purchase on the site, and in the sGTM debugger, I can see /order requests that the Data client claims. If you go to the Event Data in the sGTM debugger, you should see all the information from the webhook that the data client parsed.
9. Now, when you’ve successfully processed webhook data in sGTM, the setup is similar to any other setup in sGTM. You can use this data to transfer to whatever server tag you want.
Server-to-server tracking has unbeatable advantages over web+server tracking, such as better accuracy and higher security standards. However, in some cases, like Google Ads tracking, setting up pure s2s integration is impossible because the native server Google Ads requires using Google Analytics 4 requests, which works in a hybrid method. However, you can combine web+server and s2s tracking by implementing Google Ads offline conversions.
In this guide, I’ve outlined several ways of sending server data to sGTM and showed an example of configuring s2s tracking in sGTM with the help of the GTM server-side plugin by Stape. When setting up pure s2s tracking inside sGTM, the most tricky part is debugging and retrieving webhook data in sGTM. Using the HTTP Preview header and Stape’s Data Client is helpful.
As we move towards a more privacy-conscious world, the methods and tools we use for tracking and analytics must evolve. sGTM server-side tagging (GTM server container) is at the forefront of this evolution, providing businesses with the tools to make informed decisions based on comprehensive, reliable data.
Whether you're a marketer, web admin, or developer, the insights provided in this post should guide you in making an informed decision about integrating server-to-server tracking into your analytics strategy. Embracing this technology means staying ahead with your Google Analytics data quality, insightful, compliant, and future-proof.
Click Try for free and check all the solutions and benefits of Stape at no cost!