Here’s the situation: Your WordPress site has a standard implementation of Google Analytics using one of the many Google Analytics plugins. Because you want more flexibility and control of what you’re tracking on your site, you’ve decided that you want to implement Google Tag Manager. Of the many ways to install Google Analytics on a website in WordPress, a plugin is the easiest.
This post covers how to transition your WordPress website from using a Google Analytics plugin to a Google Tag Manager plugin. Again, the primary difference is that Google Tag Manager offers a more flexible platform for tracking user interactions on your site. In simple terms, it’s easier to track user interactions using Google Tag Manager than it is with the standard Google Analytics implementation.
As a starting point, I’m assuming you have a Google Analytics plugin installed in WordPress. For this post, I’m using the Google Analytics plugin by MonsterInsights as pictured below.
- Install WordPress plugin. DuracellTomi’s Google Tag Manager for WordPress.
- Do NOT activate the plugin yet.
- Settings. Navigate to your installed plugins page and scroll to the Google Tag Manager plugin. Click Settings.
Google Tag Manager ID: Add your GTM container ID here. Click Save Changes.
Container code placement: Leave the first button selected to place your GTM snippet in the site footer. Click Save Changes.
If you’re wary about the “not recommended by Google…”, choose the second option. As indicated in parentheses, you’ll need to tweak your template code if you choose “Custom” instead of “Footer of the page”.
- Basic data.
NOTE: There’s a lot you can adjust here. I’m going to show you two settings to adjust, but I encourage you to explore each subsection and adjust according to your website’s specific goal and objective. You don’t even need to change anything if you don’t want to—the default settings are there for a reason.
AdWords: check the box to enable remarketing. Click Save Changes.
Even if you don’t have a remarketing campaign currently running, go ahead and enable it now. There’s no harm in doing so, but there is in leaving it disabled as this isn’t retroactive. In other words, if you decide one day that you want to run a remarketing campaign, enabling this at that time will only apply to your site’s visitors going forward—it doesn’t apply to past site visitors.
Browser/OS/Device: enable all three. Click Save Changes.
This is good information to have, and it’s not retroactive either.
- Events tab.
General events: enable both boxes. Click Save Changes.
Media events: enable all boxes that are useful to your site. Click Save Changes.
- Scroll tracking. Check the first box to enable scroll tracking on your site. Click Save Changes.
- Blacklist. We don’t have any need to blacklist any tags, but you might.
Contact Form 7: Make sure to enable this integration if you use the Contact Form 7 plugin on your site. Click Save Changes.
WooCommerce: Make sure to enable this integration if you use the WooCommerce plugin on your site. Click Save Changes.Google Optimize: Add your page-hiding snippet ID. NOTE: Google Optimize can significantly slow down your website. Click Save Changes.NOTE: Be sure to perform visit your site thoroughly to determine if its performance is affected. If it is, disable Google Optimize.
- Advanced. If you want to give your dataLayer a custom name, you can do so here. Most sites don’t need to do this. If you have a dev team, notify them and they can decide.
- Progress update. So far, we’ve installed the GTM plugin and configured its settings. We’re almost done.
- Activate GTM plugin. Navigate back to your installed plugins page. Find the GTM plugin and click Activate.
- Deactive GA plugin. Navigate again back to your installed plugins page. Find your Google Analytics plugin that you’ve been using (I’m using the MonsterInsights for GA plugin). Click Deactivate.
- Validate implementation. Open your website in a new browser tab. Then, open another tab to the Real-Time Reports in Google Analytics. If you see your session in the Real-Time Report, you’re all set. If you don’t, go back to WordPress and make sure you activated the GTM plugin. Also, check your container ID in the General tab of the GTM plugin. Make sure it’s correct. Go back to your website, load a new page and try to validate again using Real-Time Reports.If you’re still having issues, time to troubleshoot. Maybe your container isn’t published in Google Tag Manager? You’re on your own for troubleshooting, or you can leave a comment with your issue and see if we can resolve it.
For what it’s worth, I’ve never had an issue with this plugin as it’s well maintained by the developer and easy to install, configure and use.