How to set up Google Tag Manager Server-Side Container

Collecting data about website visitors is critical for analyzing and improving the online presence of your business, reaching users, and converting them into customers. 

However, collecting data is becoming more problematic because of Intelligent Tracking Prevention, AdBlockers, and decrease in cookie lifetime. Google Analytics and other similar tools will start seeing fewer data about your website visitors and giving you less information to analyze.

To help address these challenges, Google introduced a new feature – Server-Side Tagging to Google Tag Manager.

What is Google Tag Manager Server-Side tagging & Why Does it Matter?

Google Tag Manager (GTM) Server-Side tagging allows website owners to move third-party tracking pixels from their website into the Cloud server. It means that the client’s browser will no longer process tracking pixels, it will be loaded directly from the server. This approach provides these main benefits:

  • more accurate data
  • faster website load time
  • extra control over the privacy

Your tools for digital marketing analytics (like Google Analytics) can run without executing 3rd party cookies on the client-side. With appropriate server containers set up, you will forget about heavy javascript, blocked 3rd party cookies, incomplete data in analytics tools. 

If server-side tracking is hosted in your website’s subdomain, all requests will be considered as a first-party. Google has a detailed description of what is GTM server tracking and how it can benefit your website. 

How to install Google Tag Manager Server-Side tagging on your website?

There are many common elements between web and server containers, like tags, triggers, variables, preview mode, etc. The setup of the GTM server-side container is more complicated than the standard web container. You will need knowledge of web GTM, Google Analytics, Google Cloud, and web programming in general. Suggest reading this blog post if you want to set up a GTM server container via a native Google environment. 

We created a service that simplifies GTM server containers configuration by removing the part of google cloud servers set up, streamline domain creation, and giving your ability to download Google Analytics from your domain. 

Below you will find a detailed description of how to integrate GTM server tracking with our free plan. With the free you can test GTM server tagging on the websites with less than 5 000 users/month, increase your website page speed by moving 3rd party pixels to the back end. However, the free plan doesn’t include a custom subdomain creation. If you want to load Google Analytics pixel from your domain, please upgrade to the pro account.

Let's start implementing Google Tag Manager Server Tagging:

  1. Create a Google Tag Manager Server container. Go to https://tagmanager.google.com/ choose the account where you want to create a container. Click Admin.how to set up server tag manager create container
  2. Under the container column, click +.

how to set up server tag manager create server container

3. Type container name, choose Server, and click create. 

how to set up server tag manager create container name

4. Choose “Manually provision tagging server”, copy your container config and paste it in any text editor. We will need it for the next steps.

how to set up server tag manager create container Manually provision tagging server

5. Now you need to create an account in our service: https://app.gtm-server.com/auth/sign-up 

6. Once you received the confirmation email and set your password, click “Create Container” on the top right, add container name and past container config that you copied from your Google Tag Manager Server Container. Click Create Container.

how to set up server tag manager create container set up gtm-server

7. Once you click create, you will see the status of your container, container config, and plan name. It takes around 5 minutes to deploy a server container. Please reload the page to update the status. If the set up was done correctly, you should see the status “Running”. If the status is Deploying please couple of minutes and refresh the page. 

how to set up server tag manager config container inside gtm-server

If you see “Error” please check that you’ve copied and pasted the correct container configuration. 

If the error repeats contact the support.

8. Inside our service you will see Tagging server URL. Copy it -> Go to Google Tag Manager Server container -> click admin -> container settings -> past the Tagging server URL how to set up server tag manager config container inside gtm-server

how to set up server tag manager set up tagging URL in google tag manager

9. The next step depends on the tagging server URL you are using. You have to options here:
1) Use a tagging server URL located under our domain (the one you’ve copied on step 4). In this case, you don’t need to change anything
2) Add a custom tagging URL. I recommend that you set up a custom tagging URL located within your site’s subdomain. This blog post will show you how to add a custom subdomain. With a custom subdomain, you will get two huge benefits:

  • Cookie lifetime extension
  • Ability to bypass ad blockers and ITP

Custom tagging URL is available for Pro and Business subscriptions. To set up a custom tagging URL, please upgrade your plan and add URL inside our service. Once you’ve done that, you need to modify the Google Tag Manager code added to your website’s source code. Use tagging URL that is located on your subdomain and past it instead of www.googletagmanager.com. Make sure you didn’t delete /gtm.js.

how to set up server tag manager update tagging url inside the gtm code on your website

10. Update Universal Analytics tagging URL inside WEB GTM container (if you are using GA4 jump to the next step). Edit Universal Analytics Base or Universal Analytics Variable inside WEB container -> Click More Settings -> Advanced configuration -> past tagging URL inside the field “transport URL”.  Once done click save and publish web container. 

add tagging url to universal analytics

11. If you are using GA4 follow these steps: Inside the WEB container click edit or create GA4 tag -> click Fields to Set -> add Row -> add these values: 

field name: transport_url

value: https:// where DOMAIN_NAME is your tagging server domain name.

Save the tag (this tag should trigger on all pages) and publish container. 

tagging url GA4 server-side tagging

12. Set up Universal Analytics or GA4 tag inside the Server Container. Go to “Tags” section inside Server Container and Click “New.”

Name Your Tag, choose tag type “Universal Analytics” or “GA4”. In case you don’t see these tags go to Clients tab and check that UA and GA4 clients were added, if not add these clients.  

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

Click Save.

google analytics request inside gtm server set up server google analytics

google analytics request inside gtm server set up server google analytics trigger

13. Open the debug mode inside your Server Container. Open your website and click on several pages. Go back to the debug tab, you should see Universal Analytics and GA4 requests.

google analytics request inside gtm server

14. Another way to test Universal Analytics and GA4 requests are working via server is to use developers tool. Open your site -> Click alt+command+i (on Mac) or right mouse click and inspect -> go to network tab -> reload the page -> type collect -> click on the request and check that request URL matches your tagging URL. You can do it for both UA and GA4. 

test UA and GA4 server side tagging

That’s it. Now you’ve set up a server container, and Google Analytics runs via your server container. If you want to load GA within your domain and make GA request 1st party please upgrade to pro versions and follow these steps