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.
- Create a Pageview Tag in GTM
- Click Tags>New
- Title: GA – pageView – Base Tag
- Select Google Analytics>Continue
- Select Universal Analytics>Continue
- Enter your property’s Tracking ID in the required field. How to find your tracking ID.
- Enable Display Advertising Features (optional)
- Track Type: Page View>Continue
- Select All Pages>Create Tag
- 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
- Admin>Plugins>Add New
- Search for and download DuracellTomi’s Google Tag Manager for WordPress
- Activate the plugin
- Enter your GTM ID. Find your container ID in GTM.
- Save Changes
- 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.
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:
Open a new browser window and go to Google Analytics>Reporting>Real-time
- Open a second browser window—leave it blank for now.
- Position your two browser windows side-by-side on your display.
- Take note of the number of sessions showing in your Real-time report.
- 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.
- 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.
- 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.