Set up a custom domain for server-side tagging (sGTM)
For productive server-side tagging, a dedicated subdomain is the recommended standard (e.g., collect.yourwebsite.com). The subdomain serves as the technical endpoint for the tagging server (sGTM) and forms the foundation for a stable first-party setup.
Using a subdomain that belongs to the website’s main domain (same-origin) is recommended. This allows cookies to be set more reliably and signals to be passed to the tagging server consistently.
Benefits of a custom domain:
- First-party tracking via a custom domain
- More reliable data collection despite browser restrictions
- Privacy-friendly and future-proof architecture
Requirements
To set this up, you will need:
- Your own domain (e.g., yourwebsite.com)
- Access to the domain's DNS management
- Optional: Support from IT or a hosting provider
Step 1: Choose a subdomain
First, a subdomain is defined that will serve as the sGTM endpoint in the future. Common names include, for example:
- collect.yourwebsite.de
- data.yourwebsite.de
- metrics.yourwebsite.de
The choice of name has no functional implications. Technically neutral subdomain names are recommended, as some content blockers react to certain terms.
Step 2: Create DNS records
The following DNS records are configured in the domain's DNS management system to support the operation of the sGTM endpoint.
The values provided for “Name” and “Destination IP” are placeholders and must be replaced.
A record (required)
The A record is essential and ensures that the sGTM endpoint is accessible via IPv4.
- Type:
A - Name:
data - Destination IP:
192.0.2.123 - TTL:
3600(recommended)
AAAA record (optional, but recommended)
The AAAA record enables access via IPv6 and completes the setup.
- Type:
AAAA - Name:
data - Destination IP:
2001:db8::1 - TTL:
3600(recommended)
Why is an AAAA record useful?
The AAAA record enables the tracking endpoint to be reached via IPv6.
Since mobile networks in particular use IPv6, the AAAA record helps ensure more stable data collection and can improve the quality of event attribution, for example, with the Meta Conversions API.
If your DNS provider does not support IPv6, the AAAA record is not required.
Step 3: Add the subdomain to the tagging server
To ensure that the subdomain can be used as an endpoint, it is also stored in the tagging server.
What happens after the DNS records are created?
After saving the DNS records, an automated process runs in the background:
- DNS propagation: It can take up to 24 hours for DNS records to propagate worldwide (though it is often much faster).
- Automatic SSL certificate generation: During this phase, the subdomain will be temporarily unavailable.
- Technical review and approval: Once the review is successful, the endpoint will go live.
Once setup is complete, the custom domain will be available for use in the web container and in the website's source code.