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.
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.
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.
Step-2: Select the project you created earlier when creating the GTM server side container.
Step-3: Click on the three horizontal lines in the upper left corner and then click on ‘App Engine’.
Step-4: Now click on ‘Settings’.
Step-5: The settings window will open. Now click on ‘Custom Domains’ and then click on ‘Add a custom domain’.
Step-6: Now click on the drop-down ‘Select the domain you want to use’.
Step-7: Now select the option ‘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’.
Step-9: A new window tab will open in which Google will ask you to verify your domain.
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.
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.
Step-12: Click on ‘DNS’ to enter the record settings and you will get a window like below.
Step-13: Click on ‘+Add Record’ and select the record type as ‘TXT’ from the dropdown menu.
Step-14: Paste the ‘TXT’ record that we noted down earlier in Step-10, and click on ‘Save’.
Step-15: Now go back to the Google webmaster window and click on ‘Verify’.
Step-16: Upon successful verification, you will get the below notification.
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’.
Step-18: Select your newly added domain and map it with the Google Cloud project by clicking on ‘Save Mapping’.
Step-19: You will see the status marked with a green tick mark. Click on ‘Continue’.
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.
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’.
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.
Step-23: Navigate to Google Cloud Console and click on ‘Done’.
Step-24: You will see a screen like below with all mapped DNS records to your custom domain.
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’.
Step-26: Now click on ‘Container Settings’.
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’.
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’.
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
Get My Step-By-Step Blueprint For Finding The Best KPIs (32 pages ebook)
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of all the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.