WordPress.org

Plugin Directory

Test out the new Plugin Directory and let us know what you think.

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 for everyone to be able to manage your analyitcs, PPC and other code snipets using an intuitive web UI. To learn more about this tool, visit the official website.

This plugin can place the necessary container code snippet into your website so that you do not need to add this manually. Multiple containers are supported!

The plugin can support your GTM setups by adding lots of meta data about the visited page and about the user into the so called data layer. GTM help center incluldes more details about this data layer.

Some parts of the plugin requires PHP 5.3 newer. PHP 5.4 or newer is recommended.

Please note that PHP 5.x is nearing its end of life cycle thus it is recommended to upgrade. If you are not sure which version you are using, please contact your hosting provider for support.

GTM container code placement

GTM container code snippet is currently divided into two parts: the most important part will be added to the tag of your website every time. The second part is called the iframe tag and it is only being used when users do not have JavaScript enabled. Code placement option only controls this second code snippet. For best performance this should be just after the opening body tag but it might be also safe to use the footer option in plugin settings as the worst case.

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:

http://www.affectivia.com/blog/placing-the-google-tag-manager-in-wordpress-after-the-body-tag/

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

Users of the Genisis Framework should use the "Custom" option but without altering the theme. The Google Tag Manager container code will be added automatically.

Basic data included

  • post/page titles
  • post/page dates
  • post/page category names
  • post/page tag names
  • post/page author ID and names
  • post/page ID
  • 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)
  • logged in user email address (to comply with GTM terms of service do not pass this towards Google tags)
  • search data
  • site name and id for WordPress multisite instances

Browser / OS / Device data

(beta)

  • 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

(beta)

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:

http://openweathermap.org/price

It is also required to obtain a free API key from OpenWeatherMap on the page above.

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

http://www.geoplugin.com/premium

Media player events

(experimental)

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.

Tracking should work with embedded media using the oEmbed feauture of WordPress and it should also work with other plugins or even with copy/pasted codes. Currently, players injected into the website after page load are not being tracked.

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 variables

To increase security on your website, you can whitelist and blacklist tags and variables. This means you can disable certain tags from being fired or prevent the use of certain variable 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 variables for example you can have a more secure Tag Manager container if you do not use those kind of elements.

Integration

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)
      • Does not currently support refunds

More integration to come!

Requires: 3.4.0 or higher
Compatible up to: 4.6.3
Last Updated: 3 months ago
Active Installs: 70,000+

Ratings

4.6 out of 5 stars

Support

10 of 28 support threads in the last two months have been marked resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1 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,2,2
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
0,1,0
0,1,0
100,1,1
100,1,1 100,2,2
100,1,1