The first step to successfully web tracking is creating a detailed plan that describes what events and event data should be sent and when. This ensures the correct information gets collected, analyzed, and reported back to analytics tools like Google Analytics or Facebook.
Configuring server-side tracking should start even with an earlier phase - planning how to set tagging server.
Configuring a tagging server is relatively easy if you plan to use an sGTM container for one website. Just create a custom domain for the tagging server, set necessary DNS records, configure sGTM, and that’s it.
But what should you do when using one server GTM container for multiple websites? When does it make sense to use one sGTM container for several websites? How should you map custom domains in this case? How to use sGTM if more than 20 custom domains are added?
In this blog post, we will cover all questions related to server-side tagging for multi-domains and show how to set up a multi-domain tagging server using Stape.
These are the three most popular use cases for utilizing one sGTM for several websites:
You might decide to use one server Google Tag Manager for multiple websites to reduce expenses on sGTM hosting. Though it really might decrease costs on running sGTM, we highly recommend using one sGTM on multiple domains when it is strictly necessary because a multi-domain setup makes managing sGTM tracking extremely complicated.
Using one server GTM container for several websites can lead to an increase in the number of tags and triggers because you might have situations where it's necessary to create a separate tag or trigger, depending on the domain.
Besides server-side GA, you will want to set up ss tracking for other platforms like Facebook, TikTok, Snapchat, or maybe use Firestore or Google Sheet integration. With multiple websites in one sGTM, the number of sGTM elements will grow exponentially since you must create tags, triggers, and variables for each website.
Eventually, you might reach the limits of the server-side GTM container. Yes, you can’t create an unlimited number of elements in an sGTM container. Google determines how heavy the sGTM container is by evaluating the size of the code and not the number of elements in sGTM.
One of our test containers reached the limit of 85% with only 41 tags and 5 clients. When the container comes to the limit, you should either restructure the sGTM container into several sGTMs, which means using another tagging server URL. Or delete some parts of server GTM.
The key feature of server-side tagging is setting first-party cookies. To do so, it’s necessary to configure a custom domain for a tagging server URL. Custom domain should be located within your main site domain hierarchy. When using sGTM for one site, it’s easy to determine a custom domain, just use top-level domain +1.
Here we will cover two scenarios for using one sGTM for multiple domains:
When mapping websites with completely different domains into one sGTM endpoint, it's necessary to create a custom domain for each site individually. Later in this article, I will show you how to configure tagging server, server and web GTMs for multi-domain containers with different domains.
When websites share the same domain (example.com and blog.example.com), tagging server domain should be configured on the top-level domain + 1 (eTLD+1) of the given domain or URL.
This means that for websites example.com and blog.example.com tagging server should look like ss.example.com. In this case, both domains will have access to set first-party cookies. Do NOT use something like ss.blog.example.com.
Multi domains feature is available for Business (and higher) plans on Stape. To enable it, open the sGTM container, click Power-Ups, and click Use near Multi-Domains.
Add all subdomains that you want to use for the server-side endpoint. For Business plan users the limit is 20 domains, for Enterprise - 50 domains, for Custom - it's unlimited!
The only thing that needs to be set up in the server GTM container is Server container URLs in the Admin settings. Here you will need to add all server container URLs that you’ve set up in the previous step. To do so open admin → Container Settings → add URL under Server container URLs.
Adding server container URL affects the sGTM debug URL. To select the tagging URL you want to use for debugging, click the selector near the preview button.
You will see the custom domain list you’ve added in the container settings. Select one from the list of the domains.
Once done, click preview and check if the preview URL uses the correct custom domain, the one that you’ve selected in the previous step.
In the container settings of server GTM, there is a technical limitation that you can add a maximum of 20 domains. These domains only affect which preview url is opened. If you have more than 20 domains, you will simply need to add the urls of those that do not fit into the preview URL string.
We approach necessary changes in web GTM with a multidomain tagging server using the Lookup table variable. In the web GTM, you need to send, for example, GA4 data to the pacific tagging server URL. The best way to set it up is by using the Lookup Table variable. This lookup variable should check the page hostname, and depending on that set tagging the server URL.
Hope this blog post shed more light on configuring a server GTM container for multiple tagging servers. This is a handy feature when using different domains for website localization, brands, products, landing pages, etc.
While setting up server-side Google Tag Manager is getting more popular, it can be a little daunting for those who have never done it before. If you need help getting started, our team of experts are more than happy to assist you. Contact us today, and we’ll get your tracking set up in no time!
All it takes is a few simple questions. Click Get A Quote, fill-up the form, and we will send you a quote.