Skip to content

Configure Google Tag Gateway

Use the Cloudflare Google Tag Gateway to route your server-side tracking through your own domain. This simplifies the deployment of a Tagging Server without managing complex infrastructure.


Configuration Steps

  1. Log in to your Cloudflare Dashboard.
  2. Use Quick search, look for google tag gateway and click on it.

    Cloudflare Quick Search for Google Tag Gateway

  3. Select your Domain/Site.

  4. Click Configure.

    Cloudflare Web Tag Management Interface

  5. Enter your GTM Server Container ID (e.g., GTM-XXXXXX).

  6. Define your Server Container URL.

    Choose an Obscure Path

    To bypass intelligent ad-blockers and tracking prevention systems (ITP), ensure your Server Container URL 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 or tracking.
    • Recommended Example: Use neutral paths like https://yourdomain.com/xyz.
  7. 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 dataLayer initializations. Enabling this in Cloudflare will cause duplicate tracking and data corruption.

    Disabling Setup Tag in Cloudflare

  8. Click Save to deploy the gateway.


Verification

Visit your chosen Server Container URL in a browser. If properly configured, you should receive a status response from the GTM server (typically a 400 or 404 response, but not a Cloudflare error).


Map Cloudflare Gateway to the Module

After deploying the gateway in Cloudflare, you must configure the module to use your new custom path. Assuming your chosen path in Cloudflare is /xyz, follow these steps:

  1. Navigate to the module configuration in your PrestaShop Back Office.
  2. Go to the Tag Manager tab and locate the Script URL field.
  3. Enter your full domain followed by the path and a trailing slash: https://mydomain.com/xyz/
  4. Go to the Google Analytics 4 tab and locate the Server Container URL field.
  5. Enter your full domain followed by the path without a trailing slash: https://mydomain.com/xyz

Trailing Slash Importance

Pay close attention to the forward slash at the end of the URL: * Script URL: Requires the slash (/) to correctly load the GTM library. * Server Container URL: Should not have a trailing slash to ensure correct data transmission via API.