Install Google Analytics via Google Tag Manager in WordPress

Install Google Analytics in Google Tag Manager for WordPress

If your website uses Google Analytics to track user interactions, you should consider using Google Tag Manager (GTM), which gives you the ability to track more stuff like scroll depth, click events and form submissions. In short, GTM gives you everything Google Analytics does plus much, much more data about how visitors interact with your website. In this tutorial, you’ll learn how to implement Google Tag Manager on a WordPress site. You’ll need a WordPress site and a Google Tag Manager account for this tutorial—go here to sign up for free.

Step #1: Google Tag Manager Setup

If you just created a new GTM account, we’ll create our first tag to track basic pageviews on our website.

  1. Pageview Tag in Google Tag ManagerCreate a Pageview Tag in GTM
  2. Click Tags>New
  3. Title: GA – pageView – Base Tag
  4. Select Google Analytics>Continue
  5. Select Universal Analytics>Continue
  6. Enter your property’s Tracking ID in the required field. How to find your tracking ID.
  7. Enable Display Advertising Features (optional)
  8. Track Type: Page View>Continue
  9. Select All Pages>Create Tag
  10. Publish>Publish Now

Step #2: WordPress Integration

After creating the pageview tag in Google Tag Manager, we’ll install the GTM plugin via our WordPress Admin.

Install Google Tag Manager Plugin

  1. Save your GTM ID in WordPressAdmin>Plugins>Add New
  2. Search for and download DuracellTomi’s Google Tag Manager for WordPress
  3. Activate the plugin
  4. Enter your GTM ID. Find your container ID in GTM.
  5. Save Changes
  6. Lastly, remove the existing Google Analytics tracking code from your site—each user visit will count twice if you don’t. Ask your developer for help if needed.

Step #3: Validate Implementation

The last step is to verify our installation of GTM and ensure that our site is still capturing visitor analytics.

Quick recap

First, we created our pageview tag in Google Tag Manager to track page-level interactions in Google Analytics. Then, we installed the Google Tag Manager plugin to link our GTM container to our website. The next (and final) step is to validate our implementation. In a nutshell, you’ll have two browser windows positioned side-by-side on your display—on one side will be your website, in the other will be Google Analytics. Here’s what to do:

  1. Validate GTM in WordPress

    Validate your GA installation via GTM by visiting your website in one window with another window open to Google Analytics next to it.

    Open a new browser window and go to Google Analytics>Reporting>Real-time

  2. Open a second browser window—leave it blank for now.
  3. Position your two browser windows side-by-side on your display.
  4. Take note of the number of sessions showing in your Real-time report.
  5. In the blank browser window, navigate to your website’s home page and look back at the number of sessions in the Real-time tab.
  6. The number of sessions should increase by one to reflect your home page visit (usually takes 10-60 seconds). Congratulations, you’ve successfully installed Google Tag Manager.
  7. If you don’t see your visit reflected in GA’s Real-time reporting, refresh the Real-time page. If you still don’t see it, run through the first two steps above once more to see where you went wrong. Leave a comment if you’re unable to resolve the issue and I’ll help out.




0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.