Create Google Account or Login to your existing Google Account

Create a new Google Tag Manager Account (e.g. Penguin Initiatives)

Create a new Google Tag Manager Container for your website (e.g. penguininitiatives.com)

Copy your new Google Tag Manager Container’s GTM ID (e.g. GTM-P3XHZF):

Login to your WordPress website’s Admin Dashboard and go to Plugins > Add New

Search for “DuracellTomi”, click the “Install Now” button for “DuracellTomi’s Google Tag Manager for WordPress” and then activate the plugin

Go to Settings > Google Tag Manager

Paste in your Google Tag Manager ID and click the “Save Changes” button

Add Google’s Tag Manager Container Code Without a Plugin

If you don’t want to use a plugin to add your Google Tag Manager code to your WordPress website, then you can of course alternatively copy and paste the code snippet right below your opening body tag in your WordPress theme’s header.php file if you know how to do so. Note that if you do this instead you won’t get the WordPress dataLayer variables that DuracellTomi’s Google Tag Manager for WordPress plugin creates

In your Google Tag Manager account click on the “Admin” section

Select your new Google Tag Manager Account and Container

Click on “Import Container”

Then select the Google Tag Manager Container Template for WordPress JSON file you downloaded and import it

Now replace “yourdomain.com” with your website’s domain in the following Triggers: Anchor Link Click, External Link Click and Internal Link Click (you may have to refresh your container to see the newly imported Tags, Triggers and Variables)

Next replace “affiliatelinkpattern” with whatever URL pattern is consistent for your affiliate links, if your site doesn’t have affiliate links or they don’t use a consistent URL pattern you can skip this step

Finally replace the “Tracking ID” Variable with your website’s Google Universal Analytics Tracking ID (e.g. UA-61808155-1)

Save all your changes and Publish your Container

Login to your WordPress website’s Admin Dashboard and go to Plugins > Add New

Search for “WP Ajaxify Comments”, click the “Install Now” button for “WP Ajaxify Comments” and then activate the plugin

Go to Settings > WP Ajaxify Comments

Check the checkbox next to “Enable plugin”

Scroll down to the ‘OnAfterUpdateComments’ callback field”, then copy & paste in the following JavaScript code:

dataLayer.push({'event' : 'newComment'});

Scroll to the bottom and click the “Save Changes” button

If you would like to track Contact Form Submissions, simply use the Contact Form 7 WordPress Plugin to power your contact form

If you use Elegant Theme’s Bloom Email Opt-In WordPress Plugin and want to track new Opt-Ins you’ll need to do the following:

Download Bloom’s custom.js file from this location: /wp-content/plugins/bloom/js/custom.js and open the file in a text editor

Search for the following code (on line 405 in version 1.0.3):

set_cookie( 365, 'et_bloom_subscribed_to_' + optin_id + list_id + '=true' );

Hit return after this line of code to create an empty line below it, then copy and paste the following code:

dataLayer.push({'event' : 'newSubscriber', bloomOptin : this_button.data( 'optin_id' ) });

Now save your modified custom.js file and overwrite it via FTP

If you use Elegant Theme’s Monarch Social Sharing WordPress Plugin and want to track social follows, media shares and social shares you’ll need to do the following:

Download Monarch’s custom.js file from this location: /wp-content/plugins/monarch/js/custom.js and open the file in a text editor

Search for the following code (on line 11 in version 1.2.2):

share_link = 'media' == social_type ? $this_el.data( 'social_link' ) : $this_el.prop( 'href' );

Hit return after this line of code to create an empty line below it, then copy and paste the following code:

( media_url ) ? dataLayer.push({'event' : 'mediaShare', shareNetwork : $this_el.data( 'social_name' ), shareMedia : 'media' == social_type ? $this_el.closest( '.et_social_media_wrapper' ).find( 'img' ).attr( 'src' ) : '' }) : dataLayer.push({'event' : 'socialShare', shareNetwork : $this_el.data( 'social_name' )});

Search for the following code (on line 35 in version 1.2.2):

post_id = $this_el.data( 'post_id' );

Hit return after this line of code to create an empty line below it, then copy and paste the following code:

dataLayer.push({'event' : 'socialFollow', followNetwork : $this_el.data( 'social_name' )});

Now save your modified custom.js file and overwrite it via FTP

Finally clear your cache and purge your CDN if needed, if you followed this guide correctly you should see the following in your Google Analytics > Real-Time > Events Report: