Are you looking to install Google Tag Manager in WordPress?
Google Tag Manager lets you add tracking code snippets to your WordPress website. It is a free tool and allows you to track different user interactions.
In this article, we will show you how to properly install and set up Google Tag Manager in WordPress and explain the benefits.
What is Google Tag Manager?
Google Tag Manager (GTM) is a free tool by Google that lets you add, update, and manage code snippets called tags on your WordPress site.
Often website owners need to add multiple code snippets to track their conversions, form submissions, link clicks, and gather other analytical data on their website. With Google Tag Manager, you can easily add and manage all of these scripts from a single dashboard.
There are built-in tag templates for Google Analytics, Google Ads, Google Optimize, DoubleClick, and Google AdSense. The Tag Manager also works with several third-party analytics and tracking platforms.
This saves you the time of adding and removing tags from your code rather than managing it from an easy dashboard. Not to mention, all of these separate snippets get loaded in one script.
That said, let’s see how to add Google Tag Manager to WordPress. We will also show you an alternative method for tracking different user interactions on your site. The best part, you don’t have to edit code or set up tags.
Simply click the links below to jump ahead to your preferred section:
Adding Google Tag Manager in WordPress
First, you’ll need to visit the Google Tag Manager website and click the ‘Start for free’ button to sign up.
After login, you will come to the add new account page.
Go ahead and click the ‘Create Account’ button.
Next, you can enter a name for your account and select a Country from the dropdown menu.
Tag Manager will also give you the option to share data anonymously with Google. You can simply click the checkbox and scroll down.
Now you need to add a container to your account. A container could be a website, iOS or Android apps, or a server. In this case, we will use the ‘Web’ option.
You can use your site’s domain for the container name. Once you’re done, click on the ‘Create’ button to continue.
You will now see a new window slide in from the right with the Google Tag Manager terms of service agreement.
You can click the checkbox at the bottom to accept the data processing terms and then click the ‘Yes’ button at the top.
Google Tag Manager will now create your account.
Next, it will now show you tracking codes that you need to add to your site.
Simply copy these 2 codes, as you will need to add them to the header and body section on your WordPress website.
Adding Google Tag Manager Code to WordPress
The easiest way of adding code snippets in WordPress is using the WPCode plugin. It is the best WordPress code snippet plugin and lets you add and manage different custom codes on your website.
The best part, you can get started for free with the WPCode. However, there is also a premium version that offers more features like a code snippet library, conditional logic, auto-insert snippets, and more.
First, you’ll need to install and activate the free WPCode plugin. If you need help, then please see our guide on how to install a WordPress plugin.
Upon activation, you need to visit the Code Snippets » Headers & Footers page from the WordPress admin panel. Now enter the codes you copied earlier.
Ensure that you paste the <head> code in the Header field and the <body> code in the Body field, as you can see below.
Once you’re done, don’t forget to click the ‘Save Changes’ button.
Google Tag Manager is now ready to use on your WordPress website.
Creating a New Tag in Google Tag Manager
Next, you can create a new tag in Google Tag Manager and set up tracking on your WordPress website.
Let’s say you want to add Google Analytics 4 (GA4) to your WordPress website using Tag Manager.
First, you’ll need to click on the ‘Add a new tag’ option from your Tag Manager dashboard.
After that, you can enter a name for your tag at the top.
From here, simply click on the ‘Tag configuration’ option.
Next, Tag Manager will show you different tag types to choose from.
For instance, this will include tags for Google Analytics, Google Ads, Floodlight, and more. We’ll select ‘Google Analytics: GA4 Configuration’ for this tutorial.
Next, you will need to enter the details of your tag.
First, you can add the Measurement ID.
You can find the Measurement ID by logging into your Google Analytics account.
Simply head to the Admin » Data Streams option under the Property column. Go ahead and click on your Data Streams to view the measurement ID.
When a new window opens, you should see the Measurement ID in the top right corner.
You can simply copy the ID.
Now head back to the Google Tag Manager window or tab, and enter the measurement ID.
After that, you can scroll down and click on the ‘Triggering’ option.
Google Tag Manager will now show built-in triggers to choose from.
Go ahead and select the ‘Initialization – All Pages’ option.
After selecting the trigger, you will need to store your settings.
Simply click the ‘Save’ button in the top right corner.
You should now see your newly created tag.
Go ahead and click the ‘Submit’ button to run the tag.
Set Up Advanced Tracking Using MonsterInsights (Easy Way)
Now that you know how to install and use Google Tag Manager, you can use an easier way of setting up advanced tracking on your WordPress site.
With MonsterInsights, you don’t have to perform complicated setups in GTM. It is the best Google Analytics plugin for WordPress and automatically configures advanced tracking for you. You also don’t have to worry about making a mistake that could mess up your tracking data.
The best part, MonsterInsights shows reports inside your WordPress dashboard. You won’t have to leave your site to see its performance. It presents data that matters for your business and helps uncover insights.
For this tutorial, we will use the MonsterInsights Pro version because it includes advanced tracking features and premium addons. There is also a MonsterInsights Lite version you can use to get started for free.
First, you’ll need to install and activate the MonsterInsights plugin. If you need help, then please see our guide on how to install a WordPress plugin.
Upon activation, you will see the MonsterInsights welcome screen. You can click the ‘Launch the Wizard’ button and follow the onscreen steps to configure Google Analytics.
For more details, please see our guide on how to install Google Analytics in WordPress.
MonsterInsights will work out of the box and automatically add tracking in Google Analytics.
Here are some of the tracking features the plugin offers:
1. Track Link and Button Clicks
MonsterInsights sets up link click and button click tracking out of the box on your website. Google Analytics doesn’t track link clicks by default, and you’d have to use GTM to add tracking.
For instance, you can track affiliate performance and see which links users click the most. This way, you can grow your revenue by promoting affiliates that are getting a lot of clicks.
Similarly, the plugin also tracks outbound link clicks. These are links to other websites on your site. You can use this data to see create new partnerships, signup for an affiliate program, and create new content on your own site.
Besides that, MonsterInsights also helps track telephone links, file downloads, call-to-action (CTA) button clicks, and more.
2. Set Up eCommerce Tracking in WordPress
If you have an online store, then MonsterInsights helps you track its performance without editing the tracking script or using Google Tag Manager.
It offers an eCommerce addon that lets you enable eCommerce tracking in WordPress in just a few clicks. You can see your site’s overall conversion rate, transactions, revenue, average order value, top-selling products, and much more.
For more details, please see our guide on how to properly set up eCommerce tracking in WordPress.
3. Configure Form Conversions Tracking
With MonsterInsights, you can also set up form conversion tracking in Google Analytics. The plugin offers a Forms addon that automatically tracks WordPress forms on your site.
If you use Google Tag Manager, then you’d have to create separate tags for all your forms and track them in Google Analytics.
However, MonsterInsights makes this process super simple. Plus, you can view the data inside the WordPress dashboard.
4. Automatically Enable Scroll Depth Tracking
Ever wonder how far people scroll your web page before leaving your site? Scroll depth tracking shows exactly that and helps you place your banner ads and CTAs in the right place to boost conversions.
MonsterInsights automatically enables scroll tracking on your website. There is no need for additional setup using Google Tag Manager or modifying the tracking code at all.
You can read our guide on how to add scroll depth tracking in WordPress with Google Analytics.
We hope this article helped you learn how to install and setup Google Tag Manager in WordPress. You may also want to see our guide on the ultimate guide to WordPress SEO and the best live chat software for small businesses.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
The post How to Install and Setup Google Tag Manager in WordPress first appeared on WPBeginner.
Dr Crash says: