How to add a custom domain to the Google Tag Manager Server container

In this article, I will describe how to set up a custom subdomain within your Google Tag Manager server container. The main advantage of a custom subdomain inside the Google Tag Manager Server container is that it helps to bypass Intelligent Tracking Preventions, AdBlockers and increases cookie lifetime for users browsing in Safari. Pixels will be loaded from your subdomain and run as the first-party. 

Why Should You Use Custom Subdomain Inside Google Tag Manager Server Container?

Google Tag Manager Server-side tagging allows moving out third-party tracking pixels off the website or app to the server-side environment. Server-side tagging offers a few advantages over client-side tags:

    1. Faster performance: Fewer tags are running on your website or app. It means less code runs inside the browser, improving your website speed.
    2. More security: Data is better protected as it will be managed inside the server-side environment.

You have two option for tagging server URL:

    • use tagging URL that was created for you and is hosted on our domain (gtm-server.com)
    • create a custom subdomain. 

We recommend setting up a custom subdomain since with the custom subdomain you’ll enjoy the following benefits:

– Bypassing ITPs and AdBlockers;

– Extended cookie lifetime.

Tracking prevention doesn’t affect requests from your own domain. Your website will bypass AdBlockers and ITPs, giving the full data about your website visitors and conversions.

How to add Custom Subdomain Inside Google Tag Manager Server Container?

First of all you need to create and set up Google Tag Manager server container. If you don’t have server container follow this instruction.

1. Log in to your GTM server account and click Add custom domain.

add custom domain gtm server

2. Log in to your domain name service and create a new DNS record for the subdomain you want to use.

3. If you are using Cloudflare login to your account -> click on your site’s domain -> Click DNS -> Add record

how to set up custom domain google tag manager server container cloudflare

4.Add these setting:

Type: A

Name: ss (or any other subdomain you prefer)

IPv4 address: 35.193.123.107

TTL: Auto

Proxy status: disable

Your settings should look like this:

Once you have done, click Save. 

6. Go to your app.gtm-server.com account and add a custom domain. It should consist of the name that you added to Cloudflare and your domain. Click Save. After adding the domain, it passes through the verification process. It can take up to 72 hours. Once the domain is verified, the status will be changed to “Verified”

add custom subdomain gtm server

7. Once your GTM subdomain is added and verified, you should see the status Running.

how to set up custom domain google tag manager server container running

8. Go to your Server Google Tag Manager Server container -> Admin -> Container Settings -> Change Tagging server URL to your subdomain. 

how to set up custom domain google tag manager server container update tagging url

9. Modified Google Tag Manager code on your website with a new Tagging server URL to your subdomain. It should look like this:

how to set up custom domain google tag manager server container update gtm pixel

10. Update tagging URL inside Google Analytics Tags or Google Analytics Variable inside your GTM web container. Open Google Analytics Tag -> More Settings -> Advanced Configuration -> Past your GTM subdomain inside Transport URL. 

how to set up custom domain google tag manager server container update transport url google analytics

That’s it! Now your GTM server container runs from your subdomain and resistant to 3rd party cookie blocking.