6 October 2022
Are you a beginner looking for a way to add Google Tag Manager to a WordPress site?
Google Tag Manager is a free tracking tool that lets you control and deploy tags without changing the code of your website.
It is the popular tag management system, with over 40% of websites using it. It not only provides better tag management with less code usage, but it also provides faster page load time and a simpler workflow. Additionally, its preview mode allows you to test whether your tags and triggers work before publishing.
Further, Google Tag Manager provides built-in tag templates that are connected to Google Ads, Google Analytics, and other third-party tools. As a result, you can quickly manage all of your tags from a single dashboard, allowing you to better your digital marketing strategies.
In this article, we’ll show you two methods to add Google Tag Manager to your WordPress website.
Google Tag Manager can be installed in WordPress manually or through a plugin.
While using a plugin may be easier, the manual method gives you greater control over the code. As a result, for advanced users, we recommend the manual method.
To start, go to the Google Tag Manager website and click the Start for free button.
After that, you should sign in using your Google account. When you’re finished, you’ll be taken to the Google Tag Manager Create Account page. Just click on the Create Account button to get started.
Next, you can add a new account. In the Account Setup box, enter your account name and select a country. You can use your website name as your account name.
The next step is to set up your container. A container is a grouping of tags, triggers, and all configurations installed on a website.
You can use your website’s name as the container name. After that, choose Web as your target platform and click the Create button.
To proceed, you need to agree to the Google Tag Manager Terms of Service Agreement. Check the checkbox next to I accept the Data Processing Terms as required by GDPR at the bottom, and then click the Yes button in the top right corner.
After accepting the terms of service, a new popup window will display on the screen containing code snippets for installing Google Tag Manager on your website.
There are two code snippets to be placed in the header (inside head tag) and in the body section on your website.
To add GTM code, go to Appearance » Theme File Editor from your WordPress dashboard.
Now, look for the header.php file from the list of files on the right.
However, If you cannot find the header.php file, look for index.php, where you can see the head and body parts of your website.
Now, go to your GTM account and copy the header code, which you should place just after the opening head tag in the header.php file.
Next, copy the body code and paste it right after the opening body tag.
Once done, click Update File at the bottom of the page to save changes.
When you’re done adding code snippets to your WordPress website, return to your Google Tag Manager dashboard and click Preview.
It will show you a new window where you can link Tag Assistant to your website. Enter your website’s URL and click Connect.
A new window to your site will appear, and Tag Assistant will alert you of the successful Google Tag Manager connection. Click Finish, then go to the preview window and click Continue.
Now, you will see the “Google container found” notification along with your Google Tag Manager container ID. This shows the complete installation of Google Tag Manager on your WordPress website.
Close the preview window and click Submit.
Now, a new popup appears, asking you to enter your version name. You can, for example, name it “GTM on WordPress.” Then click Publish.
After you’ve installed Google Tag Manager on WordPress, you’ll be able to add tags provided by various tracking tools to your site.
Google Tag Manager supports more than 50 different tag types, including those used by Google marketing products and other third-party services. Additionally, you can use its interface to include unique HTML or JavaScript tags on your website.
Go to your Google Tag Manager dashboard and click Add a new tag link.
On the next screen, click the icon to choose a tag type.
Next, you will see a list of different tag types, including a number of Google Analytics tags. If you use a Google Universal Analytics account, you can select the Universal Analytics tag.
For Track Type, select the element you want to track on your WordPress website from the list. Additionally, choose New Variable for the Google Analytics settings.
Following that, a variable configuration window will appear. Rename the variable, then enter your Google Universal Analytics tracking ID and then click Save. You can find your tracking ID on the Admin tab under Property » Tracking Info.
After that, move on to the next step to select a trigger.
Check the triggers you want to use and click the Add button.
Once done, click the Save button in the workspace’s top right corner.
That’s all! You can successfully create a Google Analytics tag.
The second method for setup Google Tag Manager on WordPress is to use a plugin, which is a better alternative for beginners.
To start, first, you need to install and activate the WP Headers and Footers plugin. If you’ve never installed a plugin before, see our guide on how to install a WordPress plugin.
Upon activation, go to Settings » WP Insert Headers and Footers.
Now, copy the code snippets from your Google Tag Manager account and paste them onto the boxes.
Once done, click the Save Changes button.
Google Tag Manager is a tracking tool that allows you to manage and deploy tags on your website with minimal code and a simple workflow. With so many tag types supported by this tool, you may connect it across platforms to gain insights into user behavior and better your digital marketing campaigns.
Google Tag Manager can be installed on your WordPress website manually or with a plugin. While the manual method is best suited for people with advanced technical skills, we suggest using a WordPress plugin for beginners.
We hope this guide helps you to learn how to install Google Tag Manager on your WordPress website.