How to Install and Setup Google Tag Manager in WordPress

Are you seeking for a way to integrate Google Tag Manager into your WordPress site? Are you unsure if Google Tag Manager is required for your WordPress site? Don’t be concerned. In this article, we’ll teach you how to install and configure Google Tag Manager in WordPress, as well as discuss its advantages.

What is Google Tag Manager, and how does it work?

Google Tag Manager is a tool that allows you to manage your

Adding various code snippets to track conversions, traffic, and other analytical data is common for website owners.

You can quickly add and manage all of these scripts using Google Tag Manager from a single dashboard.

Tag templates for Google Analytics, Adwords, DoubleClick, and other services are included. Tag management also integrates with a number of third-party tracking and analytics solutions.

Aside from that, you can utilize custom HTML to insert your own tracking code or any other code you like.

This eliminates the need to manually add and remove tags from your code and instead allows you to manage it from a simple interface. Furthermore, all of these scripts are loaded into a single script.

With that out of the way, let’s get Google Tag Manager launched.

For the purposes of this post, we’ll show you how to use Google Tag Manager to add Google Analytics to your website.

The First Steps

It’s crucial to remember that this article is only for WordPress.org sites that are self-hosted (see the difference between WordPress.com and WordPress.org). If you don’t already have a WordPress site, you may learn how to set one up using our WordPress installation instructions.

If you haven’t already, you’ll need to set up a Google Analytics account for your website. You can follow the steps in our tutorial on how to install Google Analytics in WordPress.

Follow the instructions in the section titled “How to Sign Up for Google Analytics.” When you have the tracking code, come to a halt. Instead of manually entering tracking code into WordPress, we’ll use the tag manager.

Installing Google Tag Manager

The next step is to set up Google Tag Manager now that we’re ready to add Google Analytics.

Sign up for Google Tag Manager using the same Google account that you used for Google Analytics.

After logging in, you’ll be taken to the page where you can create a new account. Simply give your account a name and click the proceed button.

Signing up for a Google Tag Manager account

You must now create a container on your account. On the iOS or Android platforms, a container could be a website or an app. We’ll use the internet in this scenario.

For the container name, you can use your site’s domain. For each account, you can add several containers. To continue, click the Create button once you’ve finished.

Putting together a container

Google Tag Manager will now create a container account for you, and you’ll be able to see your container dashboard. This is what it would look like:

Dashboard for containers

After you’ve set up your Google Tag Manager account, the following step is to create a new tag. By clicking on create new tag, you can do so.

The first step is to select a tag product. There are more than 20 integration templates available right now.

For the time being, we’ll use Google Analytics, but you can always add more tags and use various products based on your demands. You may also add any other custom code snippets by clicking on custom HTML.

Choose Google Analytics as your tag's product.

You’ll be asked to pick between Universal Analytics and Classic Analytics once you’ve chosen Google Analytics. When you select universal analytics, you’ll be prompted to enter your analytics tracking ID.

This tracking ID is a unique code that Google uses to recognize your website. Logging into your Google Analytics account and going to the Admin tab will give you this ID.

Select your site’s account and property, then click on tracking info to enlarge it. The tracking code link will be visible.

Your Google Analytics tracking ID can be found here.

When you click on the tracking code, you’ll be taken to the tracking code page, where you’ll see your UA tracking ID.

Google Analytics UA tracking id

Copy and paste your UA monitoring ID into Google Tag Manager. Choose Page View as the track type, then click the proceed button.

Include a tracking id.

When you’re ready, the tag configuration wizard will ask you when you want to fire this tag. After that, choose all of the pages and press the create button.

When should the tag be fired?

You’ll see a tracking code in Google Tag Manager that you’ll need to paste into your WordPress site. This code must be copied.

Code for the tag manager

Adding Tag Manager Code in WordPress

Installing and activating the Insert Headers and Footers plugin is the first step in adding Tag Manager code to WordPress. You must go to Settings » Insert Headers and Footers after activation.

In WordPress, paste your Google Tag Manager code.

To save your settings, paste your tag manager code into the header section and click the save button.

You can also include the Google Tag Manager code in your WordPress theme or child theme if you don’t want to install a plugin. Simply make a change to the header.php template and insert the code after the <body> tag.

Publish Your Container

Tags in Google Tag Manager Your container tags will not be active unless you publish it. Then go to the Google Tag Manager dashboard and press the publish button.

Changes should be published in Google Tag Manager.

You may also see your website in a preview mode, and Google Tag Manager will display you the tags that were fired for each page view.

Debugging and previewing

That’s all; Google Tag Manager is now installed and configured on your WordPress site.