How to Configure DNS for GTM Server Side Container

Table of Contents for How to Configure DNS for GTM Server Side Container 

  1. Why configure a DNS server for GTM?
  2. Configuration in Google Cloud
  3. Domain verification
  4. DNS configuration
  5. GTM server side container configuration
  6. FAQ

In this article, I am going to talk about how to configure a DNS for a GTM server side container.

Note: This is the second part of the article for setting up server side tagging. Make sure you complete the steps in the first part before proceeding. For the first part please visit: How to Create Server Side Container for Google Tag Manager.

Why configure a DNS server for GTM?

It is strongly recommended to map your custom domain to the Google Tag Manager server side container. This is because the default server side tagging deployment is hosted on an app engine domain in Google Cloud. 

If you go to your GTM server side container settings you will find that the tagging server URL does not contain your domain.

Tagging server URL

If you don’t map your custom domain, you won’t be able to use the cookies information sent in the incoming request. It will consider the app engine domain as a third-party context and it will be dropped by the browser. 

Now let’s begin with configuring a Google Cloud project.

62 point checklist 
Get the E-Book (50 Pages)
Google Analytics 4 thumb 
Get the FREE E-Book (50+ Pages)

Configuration in Google Cloud

Follow the below steps to configure a Google Cloud Project

Step-1: Navigate to https://console.cloud.google.com/ and then click on the drop-down available in the top right corner.

GCP Login

Step-2: Select the project you created earlier when creating the GTM server side container.

Select Google Coud project

Step-3: Click on the three horizontal lines in the upper left corner and then click on ‘App Engine’.

Three lines

Step-4: Now click on ‘Settings’.

settings

Step-5: The settings window will open. Now click on ‘Custom Domains’ and then click on ‘Add a custom domain’.

custom domain add

Step-6: Now click on the drop-down ‘Select the domain you want to use’. 

Select the domain you want to use

Step-7: Now select the option ‘Verify a new domain’.

verify a new domain

Step-8: In this step, you need to provide the domain name that you own and for which you have created the server side container. In our case, I will use gtm.optimizesmart.com.

Add your Domain name without ‘https://’ and ‘www.’ and click on ‘Verify’. 

add domain name

Step-9: A new window tab will open in which Google will ask you to verify your domain. 

New tab for domain verification

Step-10: Now click on the drop-down list and select ‘Other’. It will generate a TXT record which you will need to add to your DNS records to verify. Copy the TXT record.

txt record

Domain verification

Step-11: Log in to your DNS record manager (like Godaddy, Cloudflare, etc.) In our case, I use Cloudflare to manage all my domains and their DNS records. Once you log in, select the domain name for which we want to add the TXT record.

cloud flair login

Step-12: Click on ‘DNS’ to enter the record settings and you will get a window like below.

DNS Window

Step-13: Click on ‘+Add Record’ and select the record type as ‘TXT’ from the dropdown menu.

record type

Step-14: Paste the ‘TXT’ record that we noted down earlier in Step-10, and click on ‘Save’.

txt record save

Step-15: Now go back to the Google webmaster window and click on ‘Verify’.

Click on Verify

Step-16: Upon successful verification, you will get the below notification.

succesful verification

Step-17: Now go to Google Cloud Console. You will see the message as ‘Successfully verified ownership of <your domain name>. Now click on ‘Continue’.

success ful domain verification

Step-18: Select your newly added domain and map it with the Google Cloud project by clicking on ‘Save Mapping’.

save mappings

Step-19: You will see the status marked with a green tick mark. Click on ‘Continue’.

green tick mark with domain name

DNS configuration

In these steps, we are going to configure the DNS records. Continue following the below steps for more details.

Step-20: After clicking on ‘Continue’,  you will be provided with a list of records that you need to add to your DNS to enable security. 

DNS record list 1

Step-21: Navigate to your DNS console and click on ‘Add record’ and select a configuration like below.

  • Record Type: ‘A’ 
  • Name: gtm (prefix to our main domain)
  • Ipv4 address: record value which is provided in earlier step for ex: 216.239.38.21
  • TTL: Set to Auto
  • Proxy status: set to DNS Only

Click on ‘Save’. 

Type a record steps

Step-22: Repeat the above step for the remaining records also.

Note that there are four ‘A’ type records and four ‘AAAA’ type records. You need to add all these records to your DNS. 

Once you have added all the provided records from the list you will get a screen like below.

All DNS Record Added

Step-23: Navigate to Google Cloud Console and click on ‘Done’.

Done

Step-24: You will see a screen like below with all mapped DNS records to your custom domain.

mapped custom domain records

It may take an hour or two for mapping to update in Google Cloud. 

GTM server side container configuration

Now you need to follow the below steps to make some changes in the server side GTM container.

Step-25: Navigate to your server side container and click on ‘Admin’.

Admin GTM 1

Step-26: Now click on ‘Container Settings’.

Admin GTM Container

Step-27: Change the tagging server URL to your newly mapped domain. 

For example, earlier our tagging server URL was ‘https://ethreal-art-293017.uc.r.appspot.com’ (app engine domain). Change it to your new domain URL e.g. ‘https://abc.yourdomainname.com’. In our case, I will use ‘https://gtm.optimizesmart.com‘.

Then click on ‘Save’.

save custom domain URL

Congratulations! You have successfully configured DNS for a GTM server side container. 

Now you are ready to use your server side GTM container for tagging. 

We will see about this in more detail in the next article: ‘How to send data from Website to Server Side Container’.

Related Articles:

Frequently asked questions about how to configure DNS for GTM server side container

Why is it necessary to map the custom domain to server side GTM container?

This is because the default server side tagging deployment is hosted on an app engine domain in Google Cloud. If you go to your GTM server side container settings you will find that the tagging server URL does not contain your domain. If you don’t map your custom domain you won’t be able to use the cookies information sent in the incoming request from the website. It will consider the app engine domain as a third-party context and will be dropped by the browser.

What is a DNS server?

DNS (Domain Name System) is the system that connects the domain (example.com, optimizesmart.com, etc) with the IP address (for example 92.36.102.26) of the website where it is hosted. 
In other words, DNS acts as a contact center for the internet. When a user types a domain in his browser, DNS finds the correct IP address of the website where it is hosted.

What is the difference between client side and server side?

Client side and server side are the terminologies used in modern web developments that describe where the analytics code runs for a particular application. 
When we say client side, that means the analytics code will run on the client machine (browser). When we say server side, that means the analytics code will run on the cloud server hosted by you.

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade
error: Alert: Content is protected !!