How to set up Google Analytics with Google Tag Manager Server-Side Container?

October 07, 2020

Google Tag Manager server container has close integration with Universal Analytics. When you set up GTM server tagging, you will see that Universal Analytics Client is created by default. In this article, we will discuss the benefits and possibilities that server-side Google Analytics offers. And also, how to configure Google Analytics in your Google Tag Manager Server account.If you don’t have a GTM server container yet, please follow this instruction on how to launch it on your website. If you are still not sure what GTM server tagging is and how it can benefit your website tracking system, please read this blog post.

What are the benefits of implementing Google Analytics Server-Side tracking?Copy link to this section

1. Bypass Ad Blocker and ITPsCopy link to this section

There are two ways of implementing Google Analytics within a server-side container: host it on your subdomain or our domain. Hosting on your subdomain gives you the massive benefit of bypassing AdBlocker and Intelligent tracking preventions. A custom subdomain feature is not available in a free plan, so you’ll need to update to one of the paid plans; please check our pricing.

In 2020, roughly 27 percent of internet users are using ad blockers. It means that a bit more than a quarter of paid ads will never reach their audiences. And this number is expected to grow by 2-3% annually. 

Not only ad blockers prevent your tracking from collecting all data about website visitors. Some browsers are now using Intelligent tracking prevention technology, which is designed to stop 3rd party cookies. Firefox launched it in 2019; Safari began using ITP in autumn 2020. Though Chrome still has not announced anything similar to ITP, it started blocking third-party pixels by default in the incognito mode.

betterbuild and incognito mode

Let’s say your website visitor agreed to the cookie policy but he is using an ad-blocking extension. In addition to blocking display ads, it will also block all the requests that are sent to Google Analytics. In this case, GA doesn’t receive any information; you won’t be able to see this user’s data and remarket him when he is browsing other websites.

user's data

With server-side tagging, you could create a tagging URL within a custom subdomain that is located in the same hierarchy as your website domain; for example, In this case, collect requests will be sent not to, but your This way, you will make GA request the first party, and it would be blocked by ITPs and AdBlockers. 

custom subdomain

Safari and Firefox are limiting the cookie lifetime to 7 days or, in some cases, to 24 hours. It means that unless a user is revisiting your site every day and cookies are continuously updated, it will expire in 1 or 7 days. And Google Analytics will record these visitors as new. There is a website that helps you to track the latest information about browser storage updates.

Currently, the only way to avoid this is to run Google Analytics via Server-Side Google Tag Manager. This feature is enabled by default, but we recommend checking it to be 100% sure that cookie lifetime is set up to a more extended period.

universal analytics server managed

How to Set Up Google Analytics Inside Google Tag Manager Server-Side Container?Copy link to this section

1. Create Google Tag Manager Server-Side container if you haven’t created one. Please follow these instructions. 

2. Add a custom subdomain if you want to bypass adblockers and increase cookie lifetime. Follow these instructions

3. Make sure you’ve changed the tagging URL inside your Google Analytics variable within Google Tag Manager Web Container. Inside Google Tag Manager Web Container, go to Variables -> Choose your Google Analytics variable -> More Settings -> Advanced Configuration -> Past Transport URL.  

google analytics advanced configuration

4. Set up Universal Analytics Tag inside GTM Server Container. Open the “Tags” section inside Server-Side GTM Container and Click “New.”

Name Your Tag, choose tag type “Universal Analytics.”

Create a trigger. Trigger type “Custom,” choose “Some Events.” Client Name equals Universal Analytics. 

You might not see the Client Name variable in the dropdown. In this case, open the Variables tab, click Configure, and enable all variables.

Click Save.

universal analytics tag permission
universal analytics some events
configure variables in tag manager

5. Now let’s open the preview mode of your server Google Tag Manager and make sure that it sends events to Google Analytics. You should see your standard pageview event and custom events that you send via web GTM.

tag manager summary 

That’s it! Now your Google Analytics runs via server container. Please let us know if you have any questions or need clarifications about implementing server Google Analytics. 

Host your GTM server at Stape

By signing up you agree to Stape’s Terms of Use and Privacy Notice