The critical feature of server-side tagging is setting first-party cookies, which requires a server-side setup. You need to use a custom tagging server URL or domain to enable this feature. The custom tagging server URL or custom domain should share the same domain as your website.
Due to cookie restrictions, configuring custom domains for sGTM has become more complex. ITP affects user tracking in Safari and Firefox.
To improve your tracking, you need to set up a custom domain. It will help you prolong your cookie lifetime in all browsers.
Let’s discuss ways to configure a custom domain for your sGTM tagging server URL.
There are three ways to set up a custom domain:
Same origin
Subdomain
Default domain
If you can't configure the same origin domain, we have solutions for prolonging cookie lifetime in Safari: Own CDN and Cookie Keeper.
By default, when you add your custom subdomain to your Stape container, it will be verified by the CNAME record.
Below is an example of a custom subdomain setup:
3.1 Log in to your Stape account, choose a container, scroll down and click Add custom domain.
3.2 You will see DNS records that should be added to verify the custom domain.
The DNS record depends on the server location and CDN option you choose.
Disable CDN - choose not to use any type of CDN.
Stape Global CDN - loads scripts from a server closer to the user visiting your website. This feature is free to use and is available for all Stape sGTM containers.
Own CDN - helps to tag server URLs from the same IP as your website. It gives the ability to set cookies that Safari can not shorten.
You can also choose to connect custom domain:
Automatically (via Entri)
The easiest way to connect domains. Log in with your DNS provider details via Entri, and give us one-time permission to connect your domain.
Check the full list of supported DNS providers by Entri.
You must set one CNAME record if you do not use Global CDN.
You must set two CNAME records if you use Global CDN.
3.3 Log in to your domain name service (e.g. Cloudflare) and create a new DNS record for the subdomain you want to use.
3.4 Once your custom domain is verified, you should see the status Ready next to the tagging server URL in the Stape admin.
3.5 Go to your Google Tag Manager Server container → Admin → Container Settings → Change Tagging server URL to your subdomain.
If you want to verify your custom subdomain using A and AAAA records, you can do so by clicking Advanced settings after adding the custom subdomain to the container and ticking the “Use A records instead of CNAME records” box.
1. Open your sGTM container on Stape, scroll down to Domains and click Add custom domain.
2. Enter a custom domain. Click Advanced settings after adding the custom subdomain to the container and ticking the “Use A records instead of CNAME records” box.
3. The DNS records you should configure vary depending on the server location. You will see DNS records that you should add inside your Stape container.
4. Log in to your DNS account and add records you see in your Stape account. Below is an example of DNS setup for Cloudflare. On the account home page next to your domain name click three dots and choose Configure DNS.
Then, input the records you see in your Stape account. Ensure that the proxy is turned off.
Usually, it takes 2-3 hours to verify the custom domain. For some DNS providers, verifying records might take up to 72 hours. We will email you once the custom domain is verified or any error is detected. If there is an error with the verification, please follow this instruction on how to verify custom domain verification.
5. Once the custom domain is verified, go back to the Google Tag Manager Server container → Choose your server container → Admin → Container Settings → paste tagging server URL.
6. If you use a custom domain, updating the Web GTM script on your website is highly recommended. This tweak will load gtm.js from your domain. To do so, replace the default domain googletagmanager.com with the custom domain you set up in the previous step.
Comments