Plugin Directory

DuracellTomi's Google Tag Manager for WordPress

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


  • Fixed: WP CLI error message
  • Fixed: wrong dynamic remarketing tagging on cart and checkout pages
  • Updated: WhichBrowser library to 2.0.22
  • Updated: slightly changed container code snippet to prevent W3 Total Cache to alter the code which breaks proper code execution
  • Updated: replaced file_get_contents() usage in weather tracking to wp_remote_get() so that it is more compatible with several WP instances
  • Updated: YouTube/Video/Soundcloud tracking now tracks videos not embedded using oEmbed (like videos in a widget area)
  • Updated: new Vimeo Player API implemented which should solve several issues
  • Changed: adapted W3C HTML5 media player event names which changes some events (needs updating your existing GTM setup):
    • Soundcloud: finish => ended, seek => seeked
    • YouTube: playing => play, paused => pause, playback-rate-change => ratechange
    • Vimeo: seek => seeked
  • Added: new placement option - 'off'. This will only generate the data layer but you will need to add the proper GTM container code snippet by hand
  • Added: new data layer variable: authorID
  • Added: new data layer variable: siteID to be able to track based on blog ID in a multisite environment
  • Added: new data layer variable: siteName to be able to track in a multisite environment


  • Fixed: remove cart event not fired in WooCommerce 2.6
  • Fixed: ecomm_prodid.push error message on product detail pages
  • Fixed: proper tracking of cart actions on the cart page for WooCommerce 2.6
  • Fixed: 'Illegal string offset' errors in some cases in the cart
  • Fixed: OpenWeatherMap requires a (free) API key now, you can now enter this to use weather data in data layer


  • Fixed: "json_encode() expects parameter 2 to be long, string given" on PHP 5.3 instances
  • Fixed: Fatal PHP error in cart if you enabled taxes to be included in your cart


Major changes to the Enhanced Ecommerce implementation of the WooCommerce integration!

  • Fixed: proper tracking of list positions
  • Fixed: opening product detail page in a new window/tab when user pressed the CTRL key
  • Fixed: ecomm_totalvalue included the total price of the cart without taxes
  • Fixed: ecomm_totalvalue does not take into account the quantity of ordered products on the order received page
  • Fixed: php error message on product lists when AdWords dynamic remarketing was enabled on WooCommerce 2.6
  • Fixed: added data-cfasync="false" to the GTM container code for better compatibility with CloudFlare
  • Added: introducing tracking of list names (general product list, recent products list, featured products list, etc.)
    • Some list names (like cross-sells) will be shown as 'General Product List'. A proposed change in WooCommerce 2.6 will solve that issue
  • Added: tracking product lists in widgets
  • Added: tracking checkout options (payment and shipment)
  • Updated: better add-to-cart / remove-from-cart management in mini cart and while updating cart content
  • Updated: added currency code to each enhanced ecommerce call so that currency reporting is OK for multi currency sites
  • Updated: replaced usage of get_currentuser() to keep compatibility with WordPress 4.5


  • Fixed: subtabs on admin page now showing in certain cases
  • Fixed: error message when running the site using WP CLI (thanks Patrick Holberg Hesselberg)
  • Fixed: some typos on admin page
  • Fixed: dismissable notices did not disappear in some cases
  • Fixed: tracking of Twitter event cased sometimes JS errors
  • Fixed: site search tracking caused sometimes PHP errors when HTTP_REFERER was not set
  • Updated: preparation for translate.wordpress.org
  • Added: support for multiple container IDs
  • Added: added form ID when sending a Contact Form 7 form. Variable name: gtm4wp.cf7formid


  • Fixed: PHP errors in frontend.php and admin.php


  • Added: track embedded YouTube/Vimeo/Soundcloud videos (experimental)
  • Added: new checkbox - use product SKU for AdWords Dynamic Remarketing variables instead of product ID (experimental)
  • Added: place your container code after the opening body tag without modifying your theme files (thx Yaniv Friedensohn)
  • Added: automatic codeless container code injection for Genesis framework users
  • Fixed: Possible PHP error with custom payment gateway (QuickPay) on the checkout page (thx Damiel for findig this)


The plugin itself is now declared as stable. This means that it should work with most WordPress instances. From now on each version will include features labeled as:

  • Beta: the feature has been proven to work for several users but it can still have some bugs
  • Experimental: new feature that needs proper testing with more users
  • Deprecated: this feature will be removed in a future version

If you see any issue with beta or experimental functions just disable the checkbox. Using this error messages should disappear. Please report all bugs found in my plugin using the contact form on my website.

  • Fixed: wrong GTM container code when renaming default dataLayer variable name (thx Vassilis Papavassiliou)
  • Fixed: Enhanced Ecommerce product click data was "undefined" in some cases (thx Sergio Alen)
  • Fixed: wrong user role detection while adding visitorType to the dataLayer (thx Philippe Vachon-Rivard)
  • Changed: only add visitorId to the dataLayer if there is a logged in user
  • Added: feature labels so that you can see beta, experimental and deprecated features
  • Deprecated: outbound click, email click and download click events. You should use GTM trigger events instead


  • Fixed: PHP error message: missing get_shipping function using WooCommerce 2.3.x


  • Added: visitorId dataLayer variable with the ID of the currently logged in user to track userID in Google Analytics
  • Added: WordPress filter hook so that other templates and plugins can get access to the GTM container code before outputting it
  • Fixed: 'variation incorrect' issue by Sharken03
  • Fixed: error messages in WooCommerce integration when product has no categories
  • Fixed: add_inline_js errors in newer versions of WooCommerce
  • Fixed: error message when some device/browser/OS data could not be set
  • Fixed: tracking Twitter events was broken


  • Fixed: broken links when listing subcategories instead of products (thanks Jon)
  • Fixed: wheather/weather typo (thanks John Hockaday)
  • Fixed: wrong usage of get_the_permalink() instead of get_permalink() (thanks Szepe Viktor)


  • Fixed: PHP error in enhanced ecommerce implementation when using layered nav widget


  • Updated: Added subtabs to the admin UI to make room for new features :-)
  • Updated: WhichBrowser library to the latest version
  • Added: You can now dismiss plugin notices permanently for each user
  • Added: weather data. See updated plugin description for details
  • Added: Enhanced E-commerce for WooCommerce (experimental!)
  • Fixed: PHP notice in frontend.php script. Credit to Daniel Sousa


  • Fixed: WooCommerce 2.1.x compatibility


  • Updated/Fixed: dataLayer variables are now populated at the end of the head section. Using this the container code can appear just after the opening body tag, thus Webmaster Tools verification using Tag Manager option will work
  • Added: blacklist or whitelist tags and macros to increase security of your Tag Manager setup


  • Updated: better add-to-cart events for WooCommerce, it includes now product name, SKU and ID
  • Added: browser, OS and device data to dataLayer variables
  • Added: postCountOnPage and postCountTotal dataLayer variables to track empty categories/tags/taxonomies


  • Fixed: WooCommerce integration did not work on some environments


  • Added: scroll tracking
  • Fixed: social tracking option on the admin panel was being shown as an edit box instead of a checkbox
  • Fixed: WooCommerce transaction data was not included in the dataLayer if you selected "Custom" code placement
  • Fixed: do not do anything if you enabled WooCommerce integration but did not activate WooCommerce plugin itself
  • Updated: do not re-declare dataLayer variable if it already exists (because another script already created it before my plugin was run)


  • Added: you can now select container code placement. This way you can insert the code snippet after the opening body tag. Please read FAQ for details
  • Added: initial support for social event tracking for Facebook and Twitter buttons. Please read FAQ for details
  • Updated: event name on successful WooCommerce transaction: OrderCompleted -> gtm4wp.orderCompleted
  • Fixed: frontend JS codes did not load on some WordPress installs


  • Updated: admin page does not show an alert box if Tag Manager ID or dataLayer variable name is incorrect. Instead it shows a warning line below the input field.
  • Updated: rewritten the code for WooCommerce dynamic remarketing. Added tag for homepage and order completed page.


  • ! BACKWARD INCOMPATIBLE CHANGE ! - Names of Tag Manager click events has been changed to comply with naming conventions:
    • ContactFormSubmitted -> gtm4wp.contactForm7Submitted
    • DownloadClick -> gtm4wp.downloadClick
    • EmailClick -> gtm4wp.emailClick
    • OutboundClick -> gtm4wp.outboundClick
    • AddProductToCart -> gtm4wp.addProductToCart
  • Updated: click events are now disabled by default to reflect recently released Tag Manager auto events. I do not plan to remove this functionality. You can decide which solution you would like to use :-)
  • Updated: language template (pot) file and Hungarian translation
  • Added: new form move events to track how visitors interact with your (comment, contact, etc.) forms
  • Added: event names to admin options page so that you know what events to use in Google Tag Manager
  • Added: Google Tag Manager icon to admin settings page
  • Added: Settings link to admin plugins page
  • Fixed: null value in visitorType dataLayer variable if no logged in user exists (now 'visitor-logged-out')


  • First beta release

Requires: 3.4.0 or higher
Compatible up to: 4.6.1
Last Updated: 2 months ago
Active Installs: 60,000+


4.7 out of 5 stars


10 of 33 support threads in the last two months have been marked 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
100,1,1 100,2,2