How to use same origin approach for server GTM
Updated Mar 28, 2025
With the same origin custom domain for server GTM, avoid Safari ITP restrictions on the cookies' lifetime. In addition, if you use the same origin domain with the tagging server, no additional configuration is required to extend cookie duration. In our other article, you can find out how to set up the same origin custom domain in server GTM.
However, this method of setting up a custom domain needs a way to proxy the requests; below are links to articles with examples of request proxy configuration using different services:
Note: If you are using some other platform/service that isn’t listed above, we would appreciate it if you could send the instructions to us at support@stape.io. We will publish it, mention you as an author, and add a link to your social media account/website.
Same origin path [Stape]
When setting up server container on Stape, you should configure custom domain.
If you’ve set up and are using the Same Origin approach, you need to specify your same origin path for GA4 encryption to work correctly. You can learn more about customising the same origin approach here.

By using a Same Origin Path, you can ensure that requests to the GTM server container appear to come from the same domain as the website, allowing them to bypass the filters set by ad blockers. The proxy path ensures that requests to your server container are routed through the custom domain, making it look like part of the same content delivery network (CDN) or server, even though the data is being handled on the server-side.
Note: Stape uses location.origin to determine the domain for GA4 requests. Please esure that your server_container_url uses the same origin path on the exact same hostname as the page.
Similar logic applies to subdomains.
1. Example.
Your hostname is www.example.com and you use /metrics for patch.
Accordingly, your server_container_url should be www.example.com/metrics
2. Example.
Your hostname is example.com and you use /metrics for patch.
Accordingly, your server_container_url should be example.com/metrics