DuracellTomi's Google Tag Manager for WordPress – WordPress plugin Free download

Click to Download

DuracellTomi's Google Tag Manager for WordPress


Google Tag Manager (GTM) is Google’s free tool for everyone to manage and deploy analytics and marketing tags as well as other code snippets
using an intuitive web UI. To learn more about this tool, visit the official website.

This plugin places the GTM container code snippets onto your wordpress website so that you do not need to add this manually.
Multiple containers are also supported!

The plugin complements your GTM setup by pushing page meta data and user information into the so called data layer.
Google’s official help pages includes more details about the data layer.

You can also add your Google Optimize container with the recommended code setup

Some parts of the plugin require PHP 5.6 newer.
PHP 7.0 or newer is recommended.

Please note that PHP 5.6 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

The original GTM container code is divided into two parts: The first part is a javascript code snippet that is added to the <head>
section of every page of the website. This part is critical to enable all features of GTM, and this plugin helps to place this part
correctly on your site. The second part is an iframe snippet that acts as a failsafe/fallback should users’ JavaScript be disabled.
Google recommends – for best performance – to place this code snippet directly after the opening <body> tag on each page.
Albeit not ideal, it will work when placed lower in the code. This plugin provides a code placement option for the second code snippet.
Inherently, WordPress does not offer a straight-forward solution to achieve this, however Yaniv Friedensohn showed me a solution
that works with most themes without modification:


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

Sites using the Genesis Framework should choose the “Custom” placement option. No theme modification is needed for this theme
however, 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 behaviour in Google Analytics)
logged in user email address (to comply with GTM terms of service do not pass this on to Google tags)
site search data
site name and id (for WordPress multisite instances)

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


Push data about users’ current weather conditions into the dataLayer. This can be used to generate weather-related
audience/remarketing lists on ad platforms and allows for user segmentation in your web analytics solutions:

weather category (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 apply:

An (free) API key from OpenWeatherMap is required for this feature to work.

ipstack.com is used to determine the site visitor’s location. A (free) API key from IPStack.com is required for this feature to work:

Media player events


Track users’ interaction with any embedded media:


DataLayer events can be chosen to fire upon media player load, media is being played, paused/stopped and optionally when
the user reaches 10, 20, 30, …, 90, 100% of the media duration.

Tracking is supported for embedded media using the built-in oEmbed feature of WordPress as well as most other media plugins
and copy/pasted codes. Players injected into the website after page load are not currently supported.

Scroll tracking

Fire tags based on how the visitor scrolls from the top to the bottom of a page.
An example would be to separate “readers” (who spend a specified amount of time on a page) from “scrollers”
(who only scroll through within seconds). You can use these events to fire Analytics tags and/or remarketing/conversion tags
(for micro conversions).

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:

Google AdWords remarketing

Google Tag Manager for WordPress can add each dataLayer variable as an AdWords remarketing custom parameter list.
This enables you to build sophisticated remarketing lists.

Blacklist & Whitelist Tag Manager tags and variables

To increase website security, you have the option to white- and blacklist tags/variables.
You can prevent specific tags from firing or the use of certain variable types regardless of your GTM setup.

If the Google account associated with your GTM account is being hacked, an attacker could easily
execute malware on your website without accessing its code on your hosting server.
Plugin looks perfect. Really fast installation and setup. Everything works perfectly! Very happy.

Leave a Reply

Your email address will not be published. Required fields are marked *