How to Add Google Tag Manager to WordPress

There are several reasons why utilizing Google Tag Manager (GTM) is necessary for internet advertising. However, the most significant is that integrating all of your tags into one location is a considerable benefit these days.

In this article, we will focus on the best ways you can learn How to Add Google Tag Manager to WordPress.

What is Google Tag Manager?

Google Tag Manager is a multi-cloud management solution that allows you to safely deploy all of your marketing tools’ scripts via a user-friendly interface. In addition, this tool will enable you to establish a variety of tags, including Google Analytics and Google Adwords.

Implementing Google Tag Manager on WordPress provides you with many choices for deploying and organizing third-party solutions on your website. It’s a potent and helpful tool, and it’s something we write about a lot on our site, so check out our other posts if you want to learn more.

Learn How to Add Google Tag Manager to WordPress

These are the methods you need to follow in order to easily Add Google Tag Manager to WordPress:

Step 1: First Create Google Tag Manager Account

You presumably have an account because you’re here, but go here to get one if you don’t.

Follow this link to sign up on Google Tag Manager.

How to Add Google Tag Manager to WordPress
How to Add Google Tag Manager to WordPress

First, you need to create your account that should include Company Name, Country Name and Container Setup as instructed on the form.

Step 2: Find Google Tag Manager Code

In this next step you will need to add Google Tag Manager Code to your website by editing the theme files or simply using plugin.

From the Google Tag Manager Dashboard, Click on ID at top right corner. When you click on the Google Tag Manager ID, you will get window pop-up that has code for <head> and <body>.

Step 3: Add Google Tag Manager Code to your WordPress Website

WordPress was and is known for an easy and user-friendly work environment. WordPress and other content management systems allow you to extend their capabilities by adding simple code or just using plugins.

We will have a look at both the ways a user can Add Google Tag Manager to WordPress.

Method 1: Using Plugin

You can use Google Tag Manager for WordPress by Thomas Geiger for this guide.

  • Login to WordPress Dashboard.
  • Navigate to Plugins >> Add New.
  • Now search for “Google Tag Manager
  • You just need to install and activate the plugin.
  • After your activate the plugin, you will get a message saying, “To start using Google Tag Manager for WordPress, please enter your GTM ID” You need to click on GTM ID.
  • Enter your GTM ID in the given input box.

.The script is successfully uploaded to your website because it is required to enable all GTM capabilities. The script is an iframe snippet that serves as a fallback for visitors that have JavaScript turned off. Because WordPress does not provide a hook to add custom code within the body element, it is placed in the footer by default.

This is not optimal since it lowers the chance of the tag triggering. It will still operate, but only once the page has fully loaded.

If your configuration necessitates the inclusion of the script in the appropriate tag, you can use the custom injection approach. This plugin employs a workaround, so to ensure that everything continues to function correctly on your site; test and see whether your website is still working correctly in a variety of browsers.

Method 1: Edit the Theme Files

It’s advisable to create a child theme for any customizations you wish to make to your theme. As an example, consider adding the GTM container code. You don’t want your modifications to be overridde if your parent theme receives a new version. Editing the theme’s files is usually something you should avoid.

Now here are the steps you need to follow:

  • Login to WordPress Dashboard.
  • Navigate to Appearance >> Theme Editor.
  • Search for the theme header.php file and click on it.

The head and body tags may be found here. Let’s paste the first half of the code beneath the opening head tag. The second script section should be placed beneath the opening body tag.

  • Finally Click on “Update File” to save the changes.

Sum Up

That’s it, we hope you learned everything about How to Add Google Tag Manager to WordPress. And for the visitor who asked us to write an article on Best WooCommerce Subscriptions Plugins You Must Install, we have a dedicated article on this.

If you enjoyed this post, subscribe to our WordPress video tutorials on YouTube Channel. Remember to follow us on Pinterest.

We accept all kinds of visitor suggestions, as they continuously motivate us to improve. Feel free to comment below.

Leave a Comment