Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Google Tag

108,887 sites Security covered
View on drupal.org

This module integrates your site with Google Tag Manager, allowing you to deploy analytics and measurement tags through a web interface without directly editing your website's code. It supports multiple containers and allows you to specify conditions for inserting tags, such as by path, user role, or domain.

Google Tag

The 2.0.x branch supports Google Tag and Google Tag Manager. Users of Google Analytics should be using the 2.x version of this module.

This project integrates the site with the Google Tag Manager (GTM) application. GTM allows you to deploy analytics and measurement tag configurations from a web-based user interface (hosted by Google) instead of requiring administrative access to your website.

To use the module, sign up for GTM and obtain a "container ID" for your website. For development purposes, create a GTM environment for your website.

CRITICAL NOTES for releases 8.x-1.3+
If the site enables other modules that implement condition plugins (e.g. ctools, rules, webform), then it will most likely be necessary to apply the core patch from issue '3114467' (link intentionally omitted).

If Drush commands are run as a user other than the web user, then do NOT enable the recreate snippets on cache rebuild module setting unless the web user has permission to delete files created by the Drush user. This setting will be disabled by default beginning with release 8.x-1.6.

Features in 8.x and 7.x-2.x branches
These branches support multiple containers. From the container management page, add a container and enter the "container ID" and "environment ID" on the container form. You may also configure the conditions on which the tags are inserted on a page response. Conditions exist for: request path, user role, response status, domain, and language. The latter two require the domain and language (8.x) or locale (7.x) modules, respectively.

In addition, other modules may also define and implement additional conditions using the condition plugin architecture in 8.x or the exposed hooks in 7.x (see the api.php file). Alternatively, other modules can implement hook_google_tag_insert_alter() to apply additional conditions on the containers inserted on a page response.

Additional features in 7.x-2.x branch
The 7.x-2.x branch also provides a variable realm condition. The realm condition may be used to filter the containers by realm, such as language and domain. This feature requires the variable_realm and variable_store modules to be enabled and configured.

Features in 7.x-1.x branch
This branch implements the Variable API, so that settings may be separately configured by realm, thus enabling support for multiple languages and domains.

False positives from Google Search Console
If you attempt to verify your site for GTM using the Google Search Console, be aware the Google tool will return false positive results. For example, the tool will indicate the "noscript" snippet needs to be placed "immediately" after the opening body tag. (NOTE: The module places the snippet as close to the body tag as can be done using standard Drupal hooks.) Verification using this tool may fail but the JavaScript works properly and tags will be added to the page and fired as defined in your GTM account. If you want this snippet immediately after body tag, then modify the theme template file (html.tpl.php for Drupal 7, html.html.twig for Drupal 8), as it controls how close the snippet will be to the body tag.

Activity

Total releases
4
First release
Jan 2025
Latest release
10 months ago
Releases (12 mo)
1 ▼ from 3
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
2.0.9 Stable Aug 25, 2025
2.0.8 Stable Jan 29, 2025
8.x-1.8 Stable Jan 28, 2025
7.x-2.3 Stable Jan 28, 2025