How can we help?

How to add custom domain for Google Tag Gateway

Ivanna
Ivanna
  • Updated

 

Configuring a custom domain is highly recommended because it allows you to serve your Google Tags from the first-party context and prolongs first-party cookies. 

 

1. Choose your Google Tag Gateway on Stape. Click Add a custom domain

 

Screenshot 2024-08-09 at 17.12.21.png

 

2. Type the domain name and select whether you want to use Own CDN.

Below is an example of how to add custom domain without Own CDN.

 

Знімок екрана 2024-09-29 о 00.06.35.png

 

3. Configure the DNS records you see in the Stape.io admin. Below is an example of Cloudflare. If you use any other DNS provider, please check these guides

 

Screenshot 2024-08-09 at 17.13.35.png

  • Log in to your Cloudflare account
  • Select website
  • Click DNS records
  • Click Add record
  • Add a CNAME record similar to the screenshot below. Ensure that the proxy status is off 
  • Save changes

Screenshot 2024-08-09 at 17.18.29.png

It usually takes 20-30 minutes to validate DNS records, but for some providers, it might take up to 72 hours. If the domain is not verified in 72. hours, please follow the steps from this guide or reach out to Stape support

 

How to add Own CDN for Google Tag Gateway

Own CDN allows serving custom domains (tagging server URL) from the same IP address as your website domain. It helps to set first-party cookies in browsers with ITP, like Safari and Firefox

 

Знімок екрана 2024-09-29 о 00.26.26.png

 

1. Go to CloudFlare and configure CNAME record for the tagging server URL. Please make sure that Proxied is enabled

 

2. Go to the Rules → Configuration Rules - create a new rule

  • Specify any name you like for the rule
  • Select ‘Custom filter expression’ 
    • Field: hostname
    • Operator: contains
    • Value: specify your Gateway subdomain. 

Screenshot 2024-05-29 at 12.15.29.png

 

3. Scroll down on this page and find the ‘SSL’ feature. Activate it with ‘Full’ option.

2.png

4. Go to the Rules →Transform Rules → Modify Request Header - create a new rule

  • Specify any name you like for the rule
  • Select ‘Custom filter expression’ 
    • Field: hostname
    • Operator: contains
    • Value: specify your Gateway subdomain.

Screenshot 2024-05-29 at 12.18.54.png

 

In the modify headers section, specify:

  • Type: Set static
  • Header name: X-From-Cdn
  • Value: cf-stape4.png

Deploy changes

 

5. Go to the Caching → Cache Rules - create a new rule

 

  • Specify any name you like for the rule
  • Select ‘Custom filter expression’ 
    • Field: hostname
    • Operator: contains
    • Value: specify your Gateway subdomain. 

Cache eligibility: Bypass cache

Screenshot 2024-05-29 at 12.25.16.png

 

Deploy changes.

 

That's it, now all your requests to and from sGTM will be proxied through Cloudflare.

 

*If you are using a Web Application Firewall please make sure that it will not block these requests.

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.