In-depth Introduction to Google Tag Manager for WordPress Sites

Google Tag Manager for WordPress Sites

Are you thinking of setting up Google Tag Manager in WordPress? But not sure what Google Tag Manager for WordPress site does, or what it is?

In this article, I am going to talk through everything related to setting up the GTM.

By the end of this article, you will be able to make a decision. You will know about installing Google Tag Manager on your WordPress website.

What are the site tags? What do they do?

Tags are pieces of code that website owners embed in their sites to collect data. There are different tags for collecting various sorts of data.

Analytics tags, meta tags, blog tags, and hashtag — They all are different tags and perform various functions, but they all are generally termed as Tags.

What we are talking about here is called: site tag, web tag, analytics tag, tracking pixel, or image tag.

They are Javascript code or a small pixel that enables the website to collect information about a person’s behavior across all the organization’s digital properties.

The data could be about a specific person’s on-site behavior or the visitor’s general behavior during a period. It could be both simultaneously.

Example of what kind of data these tags collect are:

  • Visitor duration
  • Links clicked
  • Form submissions
  • Traffic sources

Many third-party services want access to the site, and they get via tags. In a way, these small tags allow the online tools and services to add functions to your WordPress blog.

If you are running an online business, you would like to track a lot of things. These metrics can help you to get lots of data. Then, you can make data-driven decisions for the best of your business.

You can add as many tags to your site as you like.

However, there must be efficient management of these reviews. Else, the collected data would be inaccurate, and the speed of the site will also be low.

If you are going to employ Tags on your site, you must do it with a strategy.

The best tool that can help you in creating, organizing, and managing the tags is Google Tag Manager.

What is Google Tag Manager?

Adding tags to the WordPress site is a time-consuming process. Also, it is not safe.

If you are a WordPress beginner and have no coding knowledge, you should not mess with the WordPress site coding.

One broken string here and there could do much harm.

Google Tag Manager is a free Tag Management Tool provided Google. It has a user interface that allows the users to manage all the Tags on the site. You can quickly add, edit, remove, or update the tags.

Google Tag Managers, in general, allows you to take the entire control over the tags from one dashboard. The function it provides is fantastic.

Google Tag Managers

Few of the helpful GTM features include:

  • Asynchronous tag loading
  • Define reusable variables
  • Mobile app and AMP support
  • Tag pausing, blacklisting, and sequencing

Why Using Google Tag Manager on WordPress?

Having a single dashboard to manage all the site tags is itself a most significant advantage. But GTM offers much more than that.

Faster Page Loading

The more Java you add to the page, the more it will take time to load.

You can check out your page speed with GTmetrix. These codes and scripts pause the page from rendering.

Google Tag Manager loads the Java and another tracking doe asynchronously. It means the third-party pixels do not become the barrier in the loading of the webpage.

GTM also reduces the number of scripts that you have to add to your site.

Tag Management becomes easy.

These tags and scripts go to the header of the site. You would not like to give that much access to every member of your team.

But then the marketing team would keep pinging you to add specific code to your site. You will contact the developer to add the code to the site.

It’s a tedious task.

After enabling the GTM on the site, you can give permissions to your team members to add the code to the site. You can also modify the permission each member has.

If your marketing team would like to add some new tracking to your site for the conversion goals, they will be able to do it quickly.

Tags and Scripts Version

Google Tag Manager lets you update the code.

But it stores all the versions of the scripts that are used on the site. You can rollback the changes if any issue arrives.

Moreover, GTM keeps the history of all the codes and scripts so that you can view them later.

It is something only possible because of GTM, and as if you are manually copy-pasting the code to the theme file, you would not keep track of how many codes you are adding or removing.

Privacy and Stealth

If you add the code with the GTM, your competitors cannot see what service you are using.

Google Tag Manager hides the code, and while keeping the function of the web tag intact.

How to Setup Google Tag Manager in WordPress?

You can set up Google Tag Manager on WordPress either manually or by using a WordPress plugin. Most of the steps of both methods are the same.

You have to use the plugin to add the code “Google Tag” code to the WordPress site. Manually, you can edit the header file to add the code.

The plugin method is quick and straightforward. It is the right choice if you do not want to edit the themes files. However, if you don’t like installing one more plugin to your WordPress site, you can do it directly by editing the theme files.

How to Setup Google Tag Manager in WordPress? (with Plugins)

The process of setting up Google Tag Manager in WordPress:

  1. Create Your Google Tag Manager Account
  2. Install the Header, Footer and Post Injections Plugin
  3. Add Code Snippets to Your WordPress Site
  4. Create Your First Tag
  5. Publish Your Container
  6. Verify That the Code Snippets Are Working

1. Create Google Tag Manager Acccount

The first step is to create a GTM account.

You can create a GTM account by login with Gmail Id. The account is freely available.

Go to the GTM website.

Google Tag Manager

Click on the “Start for Free” in the right top corner, and you will be redirected to the admin page of Google tag Manager.

gtm2 1 Google Tag Manager

Here you have to fill the information about your account.

The first box asks for the Account Name (that is usually the Company name) and the country you operate. Fill up the box and scroll down.

gtm3 1 Google Tag Manager

In the second box, you will have to write the container name.

You can keep it website name or choose whatever you like.

The next point is to select the targeted platform. You have four options, and you should choose the Web for the WordPress website.

Click on Create after you are done.

This will open a Terms of Service Agreement, which you will have to agree to start using the service.

After clicking on the Yes, a window with the Code Snippets will pop-up.

gtm4 1 Google Tag Manager

Now, you have to add these codes to your site header and body

Here the process differs. You can post this code manually or with the help of a plugin.

For now, we will use a Plugin.

2. Install the Header, Footer and Post Injections Plugin

Now login to your WordPress dashboard of the same site you want to install GTM in.

On the side panel, you will find a Plugin option. Find the “Add New” button on the page.

It will lead you to the WordPress Plugin Repository.

Here search the “Header, Footer, and Post Injections”.

Header, Footer and Post Injections Plugin

Install the Header, Footer Plugin, and activate it. It’s free and effortless to use.

You can easily and quickly add the code snippet from Google Tag Manager to your WordPress site with this plugin. It’s free and effortless to use.

Once it’s activated, you will be able to locate it from your dashboard by going to Settings > Header and Footer:

header and footer Google Tag Manager

The plugin is not a necessity as you can easily add the GTM code manually to the WordPress site, but it does make the whole process safer.

But I will tell you how to do it without a Plugin later in the article.

3. Add Code Snippets to Your WordPress Site

The Google Tag Manager Account is set up already. You installed the Header and Footer Plugin on the WordPress site.

Now the next step is to connect them both.

Login into your Google Tag Manager account again. Click on the Admin menu tab, followed by Install Google Tag Manager:

gtm 7 Google Tag Manager

Once you click the Install Google Tag Manager, a pop-up will open up, the same as the one that opens up on the first step.

gtm4 3 Google Tag Manager

Copy the Head part of the code, and go back to the WordPress dashboard.

Open the Head and Footer Plugin setting there.

Paste the Head Code into the Head Section.

Then, repeat the same process for the AFTER THE <BODY> TAG section:

After copy-pasting both the codes, click the save button.

Now your Google Tag Manager and your WordPress site are connected.

Let’s create the first tag.

4. Create Your First Tag

To create your first tag, go back to your Google Tag Manager account.

You will find the ‘Add a new tag’ under the Workspace section.

create tag 1 Google Tag Manager

There will be two sections:

First of all, pick up a title for the tag.

tag pop Google Tag Manager

Click on the Tag Configuration. It will show you the list of different tags that is available by Google.

If you scroll down the list, you will also find the option of adding a Custom Code.

configure tag 1 Google Tag Manager

The next section is the Triggering Section.

As the name suggest, you add the triggers here that will fire up the Tags.

trigger Google Tag Manager

There are many types of Triggers that you can uses.

Click on the Plus sign on the top left corner, and it will open the list of all the trigger type.

You can also add custom events.

Google Tag Manager for WordPress Sites

When you’re finished, click on the blue Save button in the top-right corner of the screen.

5. Publish Your Container

Your tag is ready, but you need to publish it to go live.

And to publish the container that has your tag, you will have to submit it.

On the Tag Manager Dashboard, you will find the Submit button on the top right corner.

Simply click on it.

submit tags Google Tag Manager

Now you have two option:

  1. Publish and Create Version
  2. Create Version

If you want the tag you created to go live on all the pages of your website, click on the Publish and Create version.

The next pop-up will open.

Google Tag Manager for WordPress Sites

Filling up the Container information is optional.

However, when you start publishing lots of containers and tags, the title reminds you of the purpose of these Containers.

Once done, click on the continue button.

You will see the container has published. Navigate to your dashboard homepage.

container published Google Tag Manager

6. Code Verification

Everything is done now, and you have published your first container with the Google tag Manager.

Now make sure the container you published is indeed working.

The tool I recommend to verify whether the Google Tag Manager is working or not is Google Tag Assistant.

tag assistant Google Tag Manager

This is a small Chrome Extension provided by Google to verify the site tags.

Search it on Google, and you will find it quickly.

How to Use Tag Assistant?

After installing the Tag Assistant by Google, you need to start recording the visit on the pages to find out what tags are working.

How to use Tag Assistant by Google?

  • Open the Site on the Chrome
  • Click on the Tag Assistant Extension to open a Box
  • Start Recording
  • Refresh the Page, and surf the site
  • Click on the Tag Assistant Extension to open the box
  • Stop recording
  • View Recording > Show Full Report
  • Evaluate the Site Tags

The Green means the Tags are working while the Red means the tag is not working.

How to Set Up Google Tag Manager in WordPress Without a Plugin?

As I mentioned in the article, the Header, Footer Plugin is not essential.

You can also connect your WordPress site and Google Tag Manager without any Plugin.

  1. Create Your Google Tag Manager Account
  2. Install the Header, Footer and Post Injections Plugin
  3. Add Code Snippets to Your WordPress Site
  4. Create Your First Tag
  5. Publish Your Container
  6. Verify That the Code Snippets Are Working

All the steps are the same. Except we will skip Step 2 as we are doing it without a Plugin.

And Step 3 will go like this:

Add Code Snippets to Your WordPress Site without Plugin

Login to your Google Tag Manager account and click on the Admin from the Topbar.

Here you will find the Install Google Tag Manager option.

Google Tag Manager for WordPress Sites

Once you click on the Install Google Tag Manager, a new window will open.

There you will find the code that you need to put in the Header and the Footer of the WordPress site to connect the site and tag manager.

To do it without a Plugin, you have to edit the theme files, and manually paste the code there.

Navigate to your WordPress admin dashboard and go to Appearance>Theme Editor.

appearance 4 Google Tag Manager

Open the Theme Editor. And Find the Function.php file.

There you have to paste this code.

add_action('wp_head', 'gtm_head_code');
Function gtm_head_code(){
?>
FIRST_SCRIPT_FROM_GTM_INTERFACE
<?php
}
add_action('wp_footer', 'gtm_body_code');
Function gtm_body_code(){
?>
SECOND_SCRIPT_FROM_GTM_INTERFACE
<?php
}
  • The Header Code will replace the FIRST_SCRIPT_FROM_GTM_INTERFACE
  • The Body Code will replace the SECOND_SCRIPT_FROM_GTM_INTERFACE

These are the code snippets that appear in the pop-up window after you’ve made your account.

Once done, save the file and reload the page.

After this step, all the other steps will remain the same.

Note: This method is also simple and easy, but if you are not aware of coding or technical WordPress, don’t use it. Function.php file is a vital part, and any error in code could break the site.

Final Word

The site tags play a crucial role in understanding the visitor’s activity.

Google Tag Manager is an excellent tool that lets you manage all your tags from a single dashboard. If you do it manually, it will be a tedious task.

In this post, I have taken you through the process of setting up Google Tag Manager in WordPress using a plugin and without a plugin.

If there is still any doubt or issue you encounter while you do setup Google Tag Manager for WordPress, do leave them in the comment section.

Latest WordPress Tips, Guides, & News

Stay updated with new stuff in the WP ecosystem including exclusive deals, how-to articles, new plugins, and more. 100% WordPress Goodness, a promise!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

We can help you. Right now.

Fast growing merchants depend ServerGuy for high-performance hosting. Experience counts. Let's get started.

Talk to a sales representative

USA / Worldwide

+1.714.2425683

India

+91.9852704704