The Home for Magento 2 Excellence

Automated build tests for Magento 2 modules. Explore. Evaluate. Elevate. #magento2

1061 Modules
672 Ready
388 Need Help
Vendors 🏆 Leaderboard
Popular Module Actively Maintained v1.0.46 GPL-3.0-only

Gtm Server Side Magento Module

stape/gtm-server-side-magento-module 56

Implements server-side Google Tag Manager (GTM) for Magento 2. Tracks e-commerce events like product views, add to cart, and purchases, and user data.

93,387
Downloads
Below average
13
GitHub Stars
Below average
23d ago
Last Release
9
Open Issues
Build Passing
Ready to install

Build Tests

Composer Install
DI Compile
Templates

Code Quality

CS Coding Standard
2 warnings
PHPStan Failed

Release Discipline

80 SemVer 80% compliant What is this?

Release history audited up to v1.0.46

Tested on Magento 2.4.9

Recent Test History

Each release is tested against the latest Magento version at that time.

v1.0.46 on Magento 2.4.9
Oct 20, 2026
v1.0.45 on Magento 2.4.9
Oct 14, 2026
v1.0.44 on Magento 2.4.9
Aug 18, 2026
v1.0.43 on Magento 2.4.9
Jul 14, 2026
v1.0.42 on Magento 2.4.9
Jun 24, 2026
v1.0.41 on Magento 2.4.9
May 27, 2026

+10 older tests

Share This Module's Status

Gtm Server Side Magento Module Magento compatibility status badge

README

Loaded from GitHub

Stape GTM Server Side Magento Module

If you have your store on Magento, Stape's GTM Server Side extension for Magento 2 can simplify the process and open up the world of server-side tagging.

The list of e-commerce events:

  • Collection view
  • View Item
  • Add to cart
  • Begin checkout
  • Add payment info
  • Purchase

User data:

  • Email
  • First name
  • Last name
  • Customer ID

Same-origin proxy (Beta)

Serve the GTM loader and all sGTM traffic from your own store domain: requests to a first-party path (e.g. /gtm/) are transparently forwarded by Magento to your Stape sGTM container — no DNS, CDN or reverse-proxy setup required.

Enable it under Stores → Configuration → Stape → Stape Conversion Tracking → General → Same-origin proxy (Beta) and set:

  • Proxy path — must start with / (e.g. /gtm). Any query string or fragment is dropped, duplicate slashes are collapsed and a trailing slash is removed, so /gtm/ is stored as /gtm.

  • Container API key — the full Stape container API key (not the container identifier).

After saving, use the Test connection button to verify the path is not shadowed by an existing route, URL rewrite, redirect, or CDN/web-server rule.

Notes:

  • If your nginx/Apache serves .js (or other static extensions) directly, requests under the proxy path with those extensions bypass PHP. The module works around this with the .load extension, but you can also route the proxy path to Magento explicitly, e.g. nginx:

    location ^~ /gtm/ { try_files $uri /index.php$is_args$args; }
    
  • Proxy responses keep the cache lifetime your Stape container sets, but are always marked private, so browsers may reuse them while Magento's full page cache and any standards-compliant shared cache pass them through. Add an explicit rule if a cache in front of Magento is configured to ignore origin cache headers, e.g. Varnish VCL:

    sub vcl_recv {
        if (req.url ~ "^/gtm/") {
            return (pass);
        }
    }
    

    On a CDN, create an equivalent bypass rule for the same path prefix. Replace /gtm/ with the configured proxy path in both cases.

  • While the same-origin proxy is fully configured, Cookie Keeper is superseded by first-party delivery and treated as disabled.

  • The container registers its service worker from a proxied document using a relative URL, which the module rewrites to the .load extension so it resolves through the proxy like the loader does. No extra configuration is needed if you already route the proxy path to Magento explicitly (see the nginx snippet above).

  • If CSP restrict mode is enabled (Stores → Configuration → Security → Content Security Policy), it is not applied to same-origin proxy responses, since proxied documents come from the container, not Magento, and the storefront policy could only break them.

Useful links:

This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.