How can we help?

How to add custom domain

Ivanna
Ivanna
  • Updated

There are two ways of adding custom subdomain. With A and AAAA records and with CNAME record.

Adding custom subdomain with A and AAAA records.

1. Log in to your Stape account, choose a container, scroll down and click Add custom domain.

 

658bf3ad96726573281115.png

 

2. You will see DNS records that should be added to verify the custom domain.

You must set A and AAAA records if you do not use Global CDN.

You must set A, AAAA and CNAME records, if you use Global CDN.





3. Log in to your domain name service (e.g. Cloudflare) and create a new DNS records for the subdomain you want to use.

 


 

If you use Global CDN, set additional CNAME record


 

4. Once your custom domain is verified, you should see the status ready below the tagging server URL in the stape admin. If there are any problems with verifying a custom domain, please follow this guide on troubleshooting a custom domain. 

Screenshot 2024-04-01 at 13.20.41.png

 

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

Screenshot 2024-04-01 at 13.14.19.png

 

Adding custom subdomain with a CNAME record.

*When should I use CNAME record instead of A records for domain verification?

This can be useful when DNS providers restrict adding duplicate records. A common situation is with domains hosted on Shopify or Wix.

Let's say your tagging server URL is sgtm.example.com. You should create A and AAAA DNS records to verify the domain on Stape. If Shopify manages your domain, creating both A and AAAA records for the same subdomain is impossible. Thus, you can't verify a custom domain on Stape.

To handle this issue, do not enable the checkbox Use A records instead of CNAME record.


1. Log in to your Stape account, choose a container, scroll down and click Add custom domain.

658bf3ad96726573281115.png

 

2. You will see DNS records that should be added to verify the custom domain.

You must set CNAME record if you do not use Global CDN.

You must set two CNAME records, if you use Global CDN.

Screenshot 2024-04-01 at 12.58.31.png

Screenshot 2024-04-01 at 12.50.42.png

 

3. Log in to your domain name service (e.g. Cloudflare) and create a new DNS record for the subdomain you want to use.

Screenshot 2024-04-01 at 12.54.12.png

If you use Global CDN, set additional CNAME record

Screenshot 2024-04-01 at 12.54.31.png

 

4. Once your custom domain is verified, you should see the status ready below the tagging server URL in the stape admin. If there are any problems with verifying a custom domain, please follow this guide on troubleshooting a custom domain. 
Screenshot 2024-04-01 at 13.11.03.png

 

5. Go to your Google Tag Manager Server container -> Admin -> Container Settings -> Change Tagging server URL to your subdomain. 
Screenshot 2024-04-01 at 13.14.19.png

 

Same origin custom domain for sGTM

There is also another method that has recently been introduced.

Google has recently changed the preferred way of mapping a custom domain for the server Google Tag Manager container. Instead of using a subdomain (like sgtm.example.com) they encourage using the same origin (like example.com/sgtm). 

With the same origin custom domain for sGTM, you will have the main benefit of server-side tagging - setting up first-party cookies. And with the tagging server using the same origin domain, you do not need to configure any additional settings to prolong cookies. However, mapping the same origin will be more complicated than configuring a subdomain.

You can learn more about this method in this article: https://stape.io/news/a-new-way-to-set-up-a-custom-domain-in-server-gtm 

 

And that's it! You can find out more in our article on how to add a custom domain to the Google Tag Manager Server container and if you need help, just contact us

Was this article helpful?

3 out of 7 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.