Configure Google Tag Gateway
Use Cloudflare Google Tag Gateway to serve your Google Tag Manager (gtm.js) script through your own first-party domain. This improves script resilience against ad-blockers and ITP without deploying a dedicated Server-Side GTM (sGTM) infrastructure.
Google Tag Gateway vs. Full Server-Side GTM
Google Tag Gateway acts exclusively as a first-party script delivery proxy—it is not a full Server-Side GTM (sGTM) container. Features that require a true server-side endpoint, such as API Order & Refund Recovery, are exclusive to dedicated sGTM environments (e.g., Stape or TAGGRS) and are not supported through Cloudflare Google Tag Gateway.
Configuration Steps
- Log in to your Cloudflare Dashboard.
-
Use Quick search, look for Google Tag Gateway and click on it.

-
Select your Domain/Site.
-
Click Configure.

-
Enter your GTM Web Container ID (e.g.,
GTM-XXXXXX). -
Define your custom measurement path.
Choose an Obscure Path
To bypass intelligent ad-blockers and tracking prevention systems (ITP), ensure your path meets these requirements:
- Uniqueness: Use a path not currently in use by your shop (avoid common paths like
/api/or/upload/). - Obfuscation: Avoid keywords like
gtm,analytics,google, ortracking. - Recommended Example: Use neutral paths like
/xyz.
- Uniqueness: Use a path not currently in use by your shop (avoid common paths like
-
Ensure the Setup Tag option remains DISABLED in the configuration panel.
Crucial: Disable Setup Tag
Do not activate the "Setup Tag" option. The tracking module handles all tag deployments and
dataLayerinitializations. Enabling this in Cloudflare will cause duplicate tracking and data corruption.
-
Click Save to deploy the gateway.
Verification
Visit https://yourdomain.com/xyz/gtm.js?id=GTM-XXXXXX (replacing /xyz and GTM-XXXXXX with your values) in a browser. If properly configured, the browser will load the JavaScript file directly from your domain instead of returning a 404 error.
Map Cloudflare Gateway to the Module
After deploying the gateway in Cloudflare, configure the module to load the GTM script through your custom first-party path. Assuming your chosen path in Cloudflare is /xyz, follow these steps:
- Navigate to the module configuration in your PrestaShop Back Office.
- Open the Tag Manager tab and locate the Script URL field.
- Enter your full domain followed by the path and a trailing slash:
https://yourdomain.com/xyz/ - Open the Google Analytics 4 tab and leave the Server Container URL field empty.
- Save the configuration.
Do Not Use the Gateway Path as Server Container URL
- Script URL (
https://yourdomain.com/xyz/): Requires the trailing slash (/) to load thegtm.jslibrary from your first-party path. - Server Container URL: Always leave this field empty when using Google Tag Gateway. Entering the gateway path here forces GA4 into server-side transport mode (
/g/collect) without forwarding the visitor's IP address, causing GA4 to geolocate traffic and purchases to Cloudflare's datacenter cities instead of your customers' actual locations. - API Order & Refund Recovery: Because Cloudflare Google Tag Gateway is not a true sGTM environment, server-to-server order and refund recovery via API cannot be used with this setup. If you require API recovery, deploy a dedicated sGTM container (such as Stape or TAGGRS) instead.