Disclosure: We may use affiliate links which means that, at zero cost to you, we may earn a commission if you buy something through our links.


Google Tag Manager – or GTM – is quite useful, just like other Google tools. It has many benefits, for example, it helps set up goals in Google Analytics and speed up your site. Some people use it to reduce the bounce rate on their sites, for SEO and conversion tracking.

Most importantly, it allows keeping many different tracking codes and pixels organized, all in one place. They can be easily managed, too – you can easily add, remove,  and edit them from a simple dashboard. You can use it to customize the data that is sent to Analytics, for example, track PDF downloads, promotions, add to cart/remove from cart clicks, or video engagement to test and improve your website.

Google Tag Manager is a neat tool if you are a marketer who is not a techie – you can use it without needing a web developer. Just remember that the more tags and data sources you add the more complex it becomes and the harder they are to manage.

GTM is free, so even if you are not sure how to use it and if you need it at all, you can check it out and then decide if you want to use it for your website.

All you need to use Google Tag Manager in WordPress is a self-hosted WordPress.org  site and a Google Analytics account. GTM works with several third-party analytics and tracking platforms, including Google Analytics, Adwords, DoubleClick, etc.

Start from installing Google Tag Manager and setting it up. This article will show you how to do it correctly. It is pretty fast and easy, just follow the steps described here.

Let’s see how to add Google Analytics to your website site using Google Tag Manager.

First Step: Installation

As we mentioned at the beginning of this article, you need a self-hosted WordPress site so if you are using another platform it will not work.  If you want to use Google Tag Manager anyway you can consider installing WordPress and try it, maybe you will change your mind. Many website owners who switched to WordPress love the fact that they have better control of their site, can extend its functionality with plugins, and upload, format or customize everything.

Apart from your WP-based site, you also have to install Google Analytics unless you already have an account up and running. When you get a tracking code, use the tag manager instead of adding tracking code directly in WordPress.

Setting Up Google Tag Manager

Sign up on Google Tag Manager website using the same Google account you used creating your Google Analytics account. Add new account page and click on the Continue button to get to the next step.

Adding a Container

Let’s start from explaining what container is. It is simply a holder for keeping all your tags, triggers and variables. In a nutshell, tags are snippets of Javascript or tracking pixels, triggers tell GTM when or how to fire a tag, and variables are additional bits of information GTM may need for the tag and trigger to work properly. A container could be a website or a mobile app on iOS or Android.

It is a good practice to use your domain name as a container name. You may add more than one container to each account, however, the most common practice is to use a unique container for each website or mobile app.

Next, choose Select the type of content: Web, AMP, Android, or iOS. If setting up a mobile container, select whether you’re using the Firebase SDK or one of the legacy SDKs. Click Create to continue.

Review the Terms of Service and click Yes if you agree to those terms.

Google Tag Manager will create your account with the container and will take you to your container dashboard.

If you chose web, you will be prompted with the web container installation code snippet when your new container first loads. You will need to paste this code as high in the <head> of the page as possible. You will need to paste another code immediately after the opening <body> tag.

Click OK and your Google Tag Manager Setup is finished.

Adding Tags

Now that Google Tag Manager account is ready, the next step is to create new tags. First, choose a product (there are more than 20 integration templates you can choose from right now).

Depending on your niche, industry, and your business you may choose any tag or product from those available or even add a custom code snippet. One of the most popular tags is Google Analytics.

In the next step, you will need to choose between Universal Analytics or Classic Analytics. Select universal analytics, and add your analytics tracking ID. You will find it by logging into your Google Analytics account and visiting the Admin tab.

Copy your Universal Analytics tracking ID and paste it in Google Tag Manager. Under Track Type choose Page View, and then click on the Continue button to go to the next step.

Choose All Pages when asked when to fire on the tag under Fire On.

Click on Create tag button.

Next, you will see a tracking code that you will need to copy and paste onto every page of your website. You will have to place it immediately after the opening <body> tag.

Adding Tag Manager Code in WordPress

There are two ways of adding your Tag Manager code in WP.

You can install and activate Insert Headers and Footers plugin. Activate it, and then paste your tag manager code in the header section in visit Settings » Insert Headers and Footers.

Remember to click on the Save button to save your settings.

You can also add the Tag Manager code without installing a plugin. The other way is to add the Google Tag Manager code in your WordPress theme or Child theme by editing the header.php template and pasting the code right after <body> tag.

Publishing Your Container

You need to publish the container to make the tags in Google Tag Manager go live. To do that, click on the Publish button on your Google Tag Manager dashboard.

If you installed and set up everything correctly, Google Tag Manager will show you the tags fired on each page view when you preview your website.

Google Tag Manager is much easier to use with some technical knowledge. You will need to learn how to set up tags, triggers, and variables, how Google Analytics works, what data you can track with events, or how to interpret the Google Analytics reports Google Analytics. As a result, you will understand the limitations of Google Tag Manager and will be able to use the tool with all the additional bells and whistles instead of just having the basic tasks done.

Depending what other tracking platforms you are using you may need to understand how, for example, Facebook tracking pixels work.

Many people recommend learning JavaScript. You can use GTM without knowing JavaScript but it is easier to use and more effective if you do.

Check out the Google Developer Guide documentation to get more information. If you are still confused by some technical bits, contact us and we will be happy to help.