Skip to main content
drupalreleases
Release: Cms 2.2.3 — Update released for Drupal core (2.2.3)! Release: Easy Breadcrumb 2.0.11 — Minor update available for module easy_breadcrumb (2.0.11). Release: Bootstrap 8.x-3.42 — Minor update available for theme bootstrap (8.x-3.42). Release: Editoria11y Accessibility Checker 3.0.10 — Minor update available for module editoria11y (3.0.10). Release: Editoria11y Accessibility Checker 2.2.24 — Minor update available for module editoria11y (2.2.24). Release: Leaflet 10.4.13 — Minor update available for module leaflet (10.4.13). Release: Flag 5.1.1 — Minor update available for module flag (5.1.1). Release: Layout Paragraphs 3.0.0-beta5 — New beta version released for module layout_paragraphs (3.0.0-beta5). Module Revived: Bootstrap 8.x-3.41 — Theme bootstrap updated after 6 months of inactivity (8.x-3.41). Security Coverage: Component Library — Module component_library now has official Drupal security advisory coverage.

GTM Snippet Loader

2 sites No security coverage

Part of the GTM ecosystem · 5 projects

View on drupal.org

GTM Snippet Loader allows you to add trusted Google Tag Manager or similar tag manager snippets to your Drupal site through a simple configuration screen, without needing to edit theme files. You can easily add head and body snippets and exclude them from administrative pages or specific paths.

GTM Snippet Loader lets site builders add trusted Google Tag Manager or tag manager loader snippets to a Drupal site without editing theme files. It provides a simple configuration screen for adding head and body snippets, with options to exclude admin pages and specific paths.

This module is useful for Drupal site owners, marketers, and developers who need to install a GTM-style tracking snippet while keeping the configuration managed inside Drupal.

Features

  • Add a trusted snippet to the document head.
  • Add optional body-open markup for noscript or fallback tag manager markup.
  • Exclude Drupal administration routes.
  • Exclude specific paths using configurable path patterns.
  • Use automatic response injection or theme-controlled placement.
  • Manage snippets through Drupal configuration.
  • Supports configuration export and deployment workflows.

Use this module when you need to add a Google Tag Manager snippet, server-side GTM loader, or similar trusted tag manager script to a Drupal site and want that snippet managed through Drupal configuration instead of hardcoded theme templates.

Post-Installation

After installing the module, go to:

/admin/config/system/gtm-snippet-loader

From the configuration page, add the trusted head snippet and, if needed, the body-open snippet. You can also configure whether the snippet should be excluded from administration routes and define path patterns where the snippet should not appear.

For most sites, the automatic injection mode is the simplest option. For stricter control over placement, themes can render the provided variables in their page templates.

Because this module allows trusted users to inject JavaScript and HTML into site pages, access to the configuration permission should only be granted to fully trusted administrators.

Additional Requirements

This module has no dependencies beyond Drupal core.

A Google Tag Manager container, server-side GTM endpoint, or other trusted tag manager snippet is required if you want to load an external tag manager.

  • Config Split - useful for enabling or changing snippets per environment.
  • Config Ignore - useful when snippet configuration should vary outside normal deployment workflows.

Similar projects

  • Google Tag - provides broader Google tag and container management functionality.
  • GoogleTagManager - provides Google Tag Manager integration for Drupal.

GTM Snippet Loader is intentionally smaller and more direct. It focuses on loading trusted snippets with configurable exclusions, rather than managing a full Google tag integration workflow.

Supporting this Module

Issues, feature requests, and patches are welcome in the Drupal.org issue queue.

Community Documentation

Community documentation, walkthroughs, and examples can be added here as they become available.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
May 2026
Latest release
4 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.x-dev Dev 10–11 May 19, 2026
1.0.0-alpha1 Pre-release 10–11 May 19, 2026