Plugin Directory

DuracellTomi's Google Tag Manager for WordPress

The first Google Tag Manager plugin for WordPress with business goals in mind.

Google Tag Manager (GTM) is Google's free tool to everyone to be able to manage your analyitcs, PPC and other code snipetts using an intuitive web UI.

This plugin can place the necessary container code snippet into your website so that you do not need to edit your theme files.

Basic data included

Google Tag Manager for WordPress (aka GTM4WP or GTM 4 WP) builds a so called dataLayer variable for you. Using this you can manage your tags very easily since you can fire them using rules that include

  • post/page titles
  • post/page dates
  • post/page category names
  • post/page tag names
  • post/page author names
  • post types
  • post count on the current page + in the current category/tag/taxonomy
  • logged in status
  • logged in user role
  • logged in user ID (to track cross device behavior in Google Analytics)
  • search data

Use search data to generate Analytics events when an empty search result is being shown. This is useful to see what people are searching for that is not available on your site (for example a product).

Use post count to generate Analytics events when an empty result is being shown. This can be useful to catch empty (product) categories.

Codeless container code injection

Yaniv Friedensohn showed me a solution that can add the GTM container code after the opening body tag for almost every theme without modifying the theme files:


I added this solution to the plugin, currently as an experimental option.

Browser / OS / Device data


  • browser data (name, version, engine)
  • OS data (name, version)
  • device data (type, manufacturer, model)

Data is provided using the WhichBrowser library: http://whichbrowser.net/

Weather data


Add the current weather conditions into the dataLayer so that you can use this information to generate special remarketing lists and additional segmentation in your web analytics solution:

  • weather category like clouds, rain, snow, etc.
  • weather description: more detailed data
  • temperature in Celsius or Fahrenheit
  • air pressure
  • wind speed and degrees

Weather data is queried from Open Weather Map. Depending on your websites traffic, additional fees may be applied:


To determine to current location of your visitor, this plugin uses geoplugin.net. Depending on your websites traffic, additional fees may be applied:


Tag Manager Events

This plugin can fire several Tag Manager event so that you can include special tags when

  • the visitor moves between elements of a form (comment, contact, etc.)
  • the visitor clicks on a Facebook like/share (limited feature) or Twitter button
  • the visitor clicks on an outbound link (deprecated)
  • the visitor clicks on a download link (deprecated)
  • the visitor clicks on an email link (deprecated)

Media player events


The plugin can track user interaction with your embeded media:

  • YouTube
  • Vimeo
  • Soundcloud

It fires dataLayer events when a media player was being loaded on the page, when the media is being played, paused or stopped. It can fire dataLayer events when the user reaches 10, 20, 30, ..., 90, 100% of the media duration.

Note: the plugin can only track media that was being embeded using the internal oEmbed feature of WordPress. No 3rd party embedding plugin is currently supported.

Scroll tracking

Fire tags based on how the visitor scrolls from the top to the bottom of a page. You can track this as Analytics events and/or fire remarketing/conversion tags to if you want to track micro conversions. Separate readers (who spend a specified amount of time on a page) from scrollers (who only scroll through within seconds)

Scroll tracking is based on the solution originally created by

  • Nick Mihailovski
  • Thomas Baekdal
  • Avinash Kaushik
  • Joost de Valk
  • Eivind Savio
  • Justin Cutroni

Original script: http://cutroni.com/blog/2012/02/21/advanced-content-tracking-with-google-analytics-part-1/

Google AdWords remarketing

Google Tag Manager for WordPress can add every dataLayer variable as an AdWords remarketing custom parameter list. Using this you can create more sophisticated remarketing lists.

Blacklist & Whitelist Tag Manager tags and macros

To increase security on your website, you can whitelist and blacklist tags and macros. This means you can disable certain tags from being fired or prevent the use of certain macro types from being used regardless of your current Tag Manager setup.

If your Google account is being hacked that is associated with your Google Tag Manager account, an attacker could easily execute malware on your website without accessing its code on your hosting server.

By blacklisting custom HTML tags and/or custom JavaScript macros for example you can have a more secure Tag Manager container if you do not use those kind of elements.


Google Tag Manager for WordPress can integrate with several popular plugins.

  • Contact Form 7: fire an event after a successful form submission
  • WooCommerce:
    • Classic e-commerce:
      • fire event when visitors ads a product to your cart
      • include transaction data to be sent to Google/Universal Analytics
      • include necessary remarketing tags for Google AdWords Dynamic Remarketing
    • Enhanced e-commerce (beta):
      • implementation of Enhanced E-commerce
      • Does not include tracking of promotions since WooCommerce does not have such a feature (yet)

More integration to come!

Planned features

Note: list of planned features can change as development goes on!

  • 1.3
    • dataLayer elements to include when JavaScript is turned of in a browser (request by Simo Ahava)
  • 1.2
    • MailChimp for WordPress support (request by I-Visio)
    • Custom dataLayer elements: place your own items site-wide or per page/post

Requires: 3.0.1 or higher
Compatible up to: 4.2.5
Last Updated: 5 months ago
Active Installs: 30,000+


5 out of 5 stars


8 of 27 support threads in the last two months have been resolved.

Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,2,2 100,1,1
100,2,2 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1
100,1,1 100,1,1