Same-Origin Setup
How to integrate Same-Origin in Google Tag Manager
After configuring the proxy on the server (Cloudflare or Apache), you need to update the configuration in GTM:
1. Open Google Tag Manager and access the web container (client-side).
2. Edit your Google Analytics: GA4 Configuration tag (or the corresponding GA4 Event tag).
3. In the server_container_url field, enter the URL with the same origin path:
Example: https://yoursite.com/metrics
Important: The hostname must be exactly the same as the one the user accesses in the browser (with or without www).
4. Save the tag and publish the container.
On the server-side container (sGTM), no changes are needed. The container receives requests normally, regardless of whether they come through the proxy or directly.
Testing the configuration
1. In the Wascer panel, go to sGTM Preview and activate the preview mode.
2. Open your website in another browser tab.
3. Open DevTools (F12) → Network tab.
4. Filter by metrics (or the path you configured).
5. Verify that requests are being sent to yoursite.com/metrics (and not to sst.yoursite.com).
6. Confirm that the request status is 200 OK.
7. In the sGTM Preview panel, verify that events are being received correctly.
Benefits of the Same-Origin approach
1. ITP Bypass (Safari): Cookies set by the same domain are not subject to duration restrictions.
2. Ad blocker evasion: Requests to the same domain are not blocked by ad blocking extensions.
3. GA4 encryption compatibility: GA4 encryption works correctly when the origin domain is the same.
4. CORS/CSP issue elimination: Without cross-origin requests, there is no need for additional CORS or CSP configurations.
5. 100% first-party cookies: All cookies are treated as first-party by the browser.
6. Analytics precision: More complete and accurate data, especially in browsers with privacy restrictions.
7. Cookie Shield synergy: When combined with Wascer’s Cookie Shield, cookie protection is maximized.
Was this helpful?
Thanks for your feedback!