In this article, I will describe how to set up a custom subdomain within your Google Tag Manager server container. The main reason why you want to run GA via a custom subdomain within your website’s primary domain is that the way of bypassing Intelligent Tracking Preventions and adBlocker. 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:
- Faster performance: Fewer tags are running on your website or app meaning less code runs inside the browser, improving your website speed.
- More security: Data is better protected as it will be managed inside the server-side environment.
In the free versions of our service, server-side tagging deployment is hosted on our domain.
We highly recommend you to switch to a custom subdomain, since with the custom subdomain you’ll have two significant advantages:
– byPass ITPs and AdBlockers
– extend cookie lifetime
The ability to set up a custom subdomain is available in pro and business accounts.
The main reason why you should move to a custom subdomain is data quality. 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 sales.
How to add Custom Subdomain Inside Google Tag Manager Server Container?
First of all, you need to create and set up a free account. Please follow this instruction. When you are done with the free account setup, you should have a GTM server container and updated tagging URL inside Google Analytics, Tag Manager, and GTM pixel on your website. Now let’s move to a custom domain set up.
1. Upgrade your plan to pro. Go to your account and click “Upgrade to Pro”
2. Once payment is done, please refresh the page. You should see that your plan was upgraded to pro. In case of any error please click settings and save.
3. Now you need to create a new A record for the custom domains. Bellow, you’ll find guide on how to add A record in Cloudflare.
4. Open your Cloudflare account. Choose the domain, Click DNS -> Add record
5.Add these setting:
Type: A
Name: gtm (or any other subdomain you prefer to have for GTM, if you choose gtm the subdomain will look like gtm.yoursite.com)
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”
7. Once your GTM subdomain is added and verified, you should see the status Running.
8. Go to your Server GTM container -> Admin -> Container Settings -> Change Tagging server URL to your subdomain.
9. Modified GTM tag on your website with a new Tagging server URL to your subdomain. It should look like this:
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.
Thanks it! Now you GTM server container runs from your subdomain and resistant to 3rd party cookie blocking.