Purpose#
GoogleTagManager.liquid contains the theme's Google Tag Manager (GTM) integration.Its goal is to centralize GTM-related markup so that:tracking can be enabled/disabled or adjusted in one place,
the layout remains clean,
GTM snippets aren't duplicated across templates.
Typically, GTM integration includes:a <script> for loading the GTM container in <head>,
a <noscript> fallback (often placed immediately after the opening <body> tag),
optional data layer initialization (if required by the platform implementation).
Where it's used#
GoogleTagManager.liquid is rendered by the main layout:Example (from the layout):{% render 'Structure\\GoogleTagManager' %}
Because it is included in the layout, it applies to all pages.
GTM integration normally depends on a configuration value such as a GTM Container ID (e.g. GTM-XXXXXXX).In Shopranos themes, this value is usually provided via global settings (commonly through a GlobalData.Settings.* key) and/or a platform-level configuration.Note
The actual settings key name for the GTM Container ID depends on your platform configuration.
In this documentation, focus on describing where the value should come from and how it's used.
Output#
The file outputs GTM-related markup, commonly:<script>...</script> that loads the GTM container
optionally a <noscript><iframe ...></iframe></noscript> fallback
Recommendations#
GTM loader script is typically placed in <head> for earlier initialization.
The <noscript> fallback is typically right after <body> begins (if your implementation includes it).
Avoid duplicate GTM snippets:Ensure GTM is only included once (through the layout).
In some setups, GTM should be disabled or replaced in staging/development.
If you rely on GA4 ecommerce events or custom events from theme.js, document the expected dataLayer usage and naming.
Modified at 2026-04-14 13:18:56