Phamox Tech

The world of Technologies

How To Install Google Tag Manager on WordPress

10 min read
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Donec rutrum congue leo eget malesuada. Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem.
How To Install Google Tag Manager on WordPress

How To Install Google Tag Manager on WordPress

Are you wondering how to install Google Tag Manager on WordPress to keep an eye on how it’s doing?

Well, this guide is here to help you out and make it super easy. No worries; it’s straightforward!

Once you have installed Google Tag Manager on WordPress, it opens up lots of cool options.

As a website owner, it allows you to easily use and manage other helpful tools on your website.

It’s like having a toolbox for your website, making things organized and simple.

This article is designed for individuals embarking on their first-time journey with Google Tag Manager.

It provides guidance on the initial setup and management of tags on their WordPress website.

What is Google Tag Manager?

Google Tag Manager is like a super helpful tool that helps website and app owners install marketing tag codes, which are used to collect marketing data and track user actions.

It’s a bit like having a magical code organizer. Here’s how it works:

Imagine your website or app has lots of special codes for things like counting how many people visit, tracking when someone fills out a form, or even figuring out how many people download an app.

These codes are called tags, and keeping track of them can be a bit tricky.

Now, along comes Google Tag Manager, the superhero of code organization. It lets you easily update all these special codes in one place.

You just add a tiny bit of Tag Manager code to your project, and then you can use a special website to control everything.

Once Tag Manager is set up, your website or app can talk to Tag Manager’s servers. It’s like they have become best friends.

You can use the special website to create tags, set up triggers (which make tags do things at the right time), and make variables (like shortcuts) to make things easier.

All these tags, triggers, variables, and other stuff together make a container.

Think of a container as a box that holds all the special codes.

With Tag Manager, this box can replace all the other special codes you had before, making everything simpler and more organized.

It can even replace codes from Google Ads, Google Analytics, Floodlight, and other places!

So, thanks to Google Tag Manager, managing all these special codes becomes super easy and fun!

How to Install Google Tag Manager on WordPress

Now, let’s explain the process of installing Google Tag Manager on your WordPress website.

Don’t worry; it’s a straightforward process that can be completed in just a few simple steps.

To properly set up Google Tag Manager, you need to follow each step one after the other in chronological order. You can find these steps laid out on Google’s support website about tag managers. Follow each step in the provided order to ensure a smooth installation.

Basically, here’s what you need to do:

  • Step 1: Begin by creating a new account and container. This will serve as the framework for managing your tags effectively.
  • Step 2: Once you’ve created the account and container, proceed to install the container on your WordPress website. This allows Google Tag Manager to work seamlessly with your site.
  • Step 3: After the installation, it’s time to add and publish the tags. Think of tags as small snippets of code that help track specific actions or events on your website, such as clicks or form submissions. By adding and publishing these tags, you gain valuable insights into your website’s performance.

By following these steps, you’ll successfully set up Google Tag Manager on your WordPress website, enabling you to track and analyze important data that can enhance your online presence.

Now, let’s move on and get your WordPress website set up with Google Tag Manager.

Create a New Account and Container

To get started, open your internet browser and type in “tag manager.google.com.” This will take you to the Google Tag Manager’s page.

Ensure you’re using the correct Google account by checking the top-right corner.

Create A New Account and Container

Inside Google Tag Manager, click on “create account,” then proceed to account setup and enter your company name. Choose your country.

How To Install Google Tag Manager on WordPress

Create Container

In the container setup, add your website URL. Move to the Target platform and select web since we’re adding Google Tag Manager to our website. Finally, click on Create.

Tag Manager Container Creation -How To Install Google Tag Manager on WordPress

Afterward, you’ll encounter the “Google Tag Manager Use Policy” page. Scroll down and agree to the data processing terms required by GDPR.

Now, navigate to the upper right-hand corner, where you’ll find the “NO” and “YES” buttons. Click on the YES button.

How To Install Google Tag Manager on WordPress - Tag Manager GDPR Policy

After clicking the “YES” button, code snippets that you must incorporate into your WordPress website will pop up.

Just like that, your Google Tag Manager account with the container is all set up!

Google Tag Manager Code PIC600
Google Tag Manager Code

You have the option to either copy this code to your clipboard or keep this tab open while moving on to the next step.

Install the Container on your WordPress Website

Now, let’s move on to installing the Google Tag Manager on our WordPress website.

This involves adding both the header tag and the body tag to the backend of our website.

When it comes to adding scripts to a WordPress website, there are two common methods you can use: utilizing a plugin or editing the theme files.

Plugin Method

One way to add scripts is by using a plugin specifically designed for this purpose.

You can search for and install a suitable plugin from the WordPress plugin repository.

Once installed, the plugin will provide you with an interface where you can easily insert and manage your scripts without having to directly edit the theme files.

Theme File Editing Method

Alternatively, you can choose to manually edit the theme files to add the scripts.

This involves accessing the WordPress theme files through the Theme Editor in your WordPress dashboard.

However, keep in mind that editing theme files directly can be risky, and it’s recommended to create a child theme or consult a website developer to ensure the changes are made safely.

Both methods have their advantages and considerations. Using a plugin offers a user-friendly interface and doesn’t require technical expertise.

On the other hand, editing the theme files provides more control over the scripts but requires caution to avoid unintended issues.

Choose the method that best suits your needs and level of expertise, keeping in mind the importance of maintaining the stability and security of your WordPress website.

Install Google Tag Manager on WordPress using the plugin.

Therefore, log in to your WordPress account and head over to the backend of your WordPress site.

When you’re logged into your WordPress website, find the “Plugins” section on the left-hand tab, hover your cursor over it, and click on “Add New.”

Install the Header Footer Code Manager WordPress Plugin.

One of the best and easiest ways to add code snippets in WordPress is by using a dedicated WordPress plugin.

For this purpose, we advise you to use “Header Footer Code Manager.”

It is one of the best WordPress code snippet plugins and allows you to easily add and manage various custom codes on your WordPress website.

To install this plugin, go to the WordPress admin dashboard menu and hover your cursor over “Plugins.”

Click on “Add New Plugin.” This action will take you to “Add Plugin.” From there, navigate to “Search Plugins” and type in HFCM.

This will display the “Header Footer Code Manager” by 99 Robots. Take note that this plugin has over 500 active installations and boasts a five-star review.

How To Install Google Tag Manager on WordPress using HFCM Plugin

Note: Before you click on “Install Now,” it’s a good idea to backup your WordPress website. In case you are not sure why you need to do that, it’s just to be safe.

Sometimes, when different pieces of software, called plugins and themes, work together, they might not get along and could break your website. It doesn’t always happen, but it’s a good practice to be ready just in case.

After you have done the backup, go ahead and click on “Install Now.” Once the plugin is installed, click on “Activate.”

At this point, you have successfully installed and activated your “Install Header Footer Code Manager” WordPress plugin, and you are ready to install Google Tag Manager on WordPress.

Add Google Tag Manager to WordPress with the Installed Plugin

Now, find HFCM on the left side of the WordPress admin dashboard menu, hover your cursor over it, and click on “Add New.”

The “Add New Snippet page with tabs to add your “Google Tag Manager” will pop out.

In the “Snippet Name,” put “Google Tag Manager Header” because this snippet is for the header part we copied earlier from Google Tag Manager.

Next, in “Site Display,” make sure “Site Wide” is chosen. Then, in “Location,” make sure “Header” is selected.

How To Install Google Tag Manager on WordPress -Add New Snippet

Scroll down to “Snippet Code,” paste in the header code you have copied earlier, or go back and copy it, then scroll down and click on “Save.”

Now, go back to HFCM, click on “Add New” again, and under “Snippet Name,” write “Google Tag Manager Body.”

Scroll down to “Location” and choose “Footer” this time. At the bottom, under “Snippet and Code,” paste in the body snippet.

To do this, go back to Google Tag Manager, copy the code, come back to your WordPress site, paste it, and then click on “Save” down below.

How To Install Google Tag Manager on WordPress -Add GTM Code

Go to HFCM again, click on “All Snippets,” and congratulations! You’ve successfully installed Google Tag Manager on your WordPress website.

You added both the header and body snippets. If you ever want to turn them off, you can do that whenever you like.

Install Google Tag Manager on WordPress using the Theme Files

For the best practice in customizing your theme, especially when adding the GTM container code, it is recommended to use a child theme.

This ensures that your changes won’t be overwritten when a new update is available for your parent theme.

It’s generally recommended to avoid directly editing the files of your WordPress theme, and it’s a good idea to seek advice from your website developer to determine the best approach.

Here’s what you should do, which a developer would also follow:

  • Log in to your WordPress dashboard and go to the Appearance section.
  • Look for the Theme Editor option, which grants you access to the theme files.
  • It’s crucial to create and work with something called a Child Theme on your WordPress website. This ensures that any modifications you make won’t be lost when you update the main theme. For more information on what a Child Theme is and whether you should use it, you can refer to this guide.
  • Once you’ve set up the Child Theme, locate the file named header.php within the theme files and click on it. Inside this file, you’ll find the head tag and the body tag.
  • Copy the first part of the code and place it directly below the opening head tag within the header.php file. Then, take the second part of the code and insert it beneath the opening body tag.
  • Finally, click on the Update File button to save your changes.
Theme File Editing Method

By following these steps, you can add Google Tag Manager (GTM) to your WordPress theme while ensuring that your website remains stable and functions as intended.

Remember, it’s always advisable to consult with a website developer for guidance and assistance throughout this process.

How to Check If Google Tag Manager Is Correctly Installed

There are several ways that you can use to check if your Google Tag Manager is properly installed and set up correctly.

However, in this section, we will discuss three different methods you can use to verify if Google Tag Manager (GTM) is correctly installed on your WordPress site.

I. Use the GTM Preview and Debug Mode

How to Check If Google Tag Manager Is Correctly Installed

Go to your Google Tag Manager account and click on the Preview button.

Your browser will enter a special state, showing a little dashboard at the bottom of your screen when you view your website pages.

Refresh your website page to see if this dashboard appears. If it does, you’ve installed GTM correctly. Check a few pages to be sure.

II. Use the Google Tag Assistant Extension

Use the Google Tag Assistant Extension PIC600

To ensure that Google Tag Manager is working correctly on your website, follow these steps:

Use Google Chrome and install a Chrome extension called the Google Tag Assistant. Once installed, enable the Google Tag Assistant and click on the extension (the extension icon).

You may need to refresh your website page. Look for the Google Tag Manager icon with a smiley face.

This indicates that your Google Tag Manager is successfully activated on your WordPress website.

III. Check your Website’s Source Code

Visit your website and check the page source to see if the scripts are placed in the head section of your HTML and beneath the opening body tag.

Right-click and select the “View page source” option. You could manually check other pages or use some tools to make it easier.

Final Note

Here we conclude, and that’s it for this Google Tag Manager setup for WordPress.

Congratulations! As you can see, connecting Google Tag Manager with your WordPress website is that simple.

Now you should be prepared to use Google Tag Manager to deploy your tags.

If you have any questions about this initial setup, feel free to ask them by dropping them down in the comment section below.


We trust that you found the information on “How to install Google Tag Manager on WordPress” educative and informative. Please do not hesitate to share it with anyone who might also benefit from this article.

Share

Leave a Reply

Verified by MonsterInsights