How to install Google Tag Manager on WordPress
parallax background

How to install Google Tag Manager on WordPress

How to fix “the link you followed has expired” error
March 25, 2020
How to redirect 404 to homepage and if it’s recommended
March 30, 2020
How to fix “the link you followed has expired” error
March 25, 2020
How to redirect 404 to homepage and if it’s recommended
March 30, 2020

To understand how to install Google Tag Manager on WordPress you need to know what tags are and why a management tool is needed for them?

Google Tag Manager (GTM) is a necessary tool for digital marketing because it effectively combines all your scripts into a single place and enables you to easily add tags to your website.

Tags and tagging are used all the time, for example, when you tag people on a photo on Facebook or Instagram.

Tagging generates a link, in this case to a friend’s profile by clicking on the image.

You attach that tag to something that provides labeling or categorizing information about the larger object and if you had a lot of information to share this would be very time-consuming. The same applies to the digital world so if the tagging can be accomplished by a manager, this is an efficient use of your time, which is important to find out how to install Google Tag Manager on WordPress.

What exactly will you install on WordPress and why?


Tags are little snippets of JavaScript. sitting in the code of your website. What you see on a website is the application layer with your content, for example recommendations for products you want your clients to purchase, the video’s playing on your website, and so on.

The actual source code that is telling our browser or our machine what to collect, and bring together to produce the visible result, is unseen.

Different types of code or snippets (tags) are embedded in the source code and are positioned in different places. They are sending off requests for information and more code to embed on your page.

In the background of your web page, device, and within the browser, the tag executes the job description, and runs the process of grabbing different data-points. Then it sends requests to the server.

Using Google Analytics as an example, your browser processes your page code and when it finds the Google Analytics tag, the code will be executed to obtain the requested information. This will be sent back to the Google servers.

After processing the request, you will receive a report.

The different tracking services will only work if you first add a few lines of JavaScript or HTML code to your website. However, if you do not want to do this, the Google Tag Manager can take care of all codes from a single interface.

Some of the tracking services that usually require manually added code are:

  • Adobe Analytics
  • Facebook Pixel
  • LinkedIn Insight
  • Google AdWords
  • Google Analytics
  • Event tracking
  • Google Optimize …

These alone should convince you to install Google Tag Manager!

How to install Google Tag Manager on self-hosted sites


This Google Tag Manager tutorial will teach you how to set up Google Tag Manager:

  • How to install and setup Google Tag Manager
  • How to add Google Tag Manager to WordPress.
  • How to Create and/or add new tabs
  • How to publish your Container

Install Google Tag Manager and set it up

  • Create a Google Analytics account for your website
  • Set up Google Tag Manager from Google Tag Manager
  • Sign up using your Google Analytics Google account.
  • Login
  • Choose the account name you want to use
  • On the add new account page, enter your account name, and country
  • Click on the Continue button.
  • Set up your container with tags, triggers, and all configurations installed on a website. A container could be a website, so you choose the web. Enter your website name for your container name.
  • Choose ‘Web’ when asked Where to use container
  • Click on the Create button. You can add multiple containers for each account.

After you created tags, then publish your container

Now add Google Tag Manager to your WordPress website

  • Open a new Google tab
  • Login to your WordPress admin dashboard
  • Go to Appearance > Editor
  • Click on Theme Header (php) from the right file navigator to launch header.php within the theme editor. You need to paste code in [head] and [body]
  • Go back to the Google Tag Manager account tab
  • Paste the first Google Tag Manager code high in the [head] and the second code after the opening [body] tag. The tag in WordPress might look a bit different.
  • Copy the first code from Google Tag Manager, go back to WordPress, and paste it high in the [head] element
  • Copy the second code from your Google Tag Manager account
  • Paste the second code right after the opening [body] tag
  • Save the changes by clicking on the Update File button at the bottom

Create or add a New Tag


You can choose from more than 20 integration templates. Google Analytics is very important for serious website owners so it’s good to start with:

  • Click on create new tag on your Google Tag Manager dashboard
  • Choose Universal Analytics
  • Enter your analytics tracking ID from your Google Analytics account. Go to Admin tab > Select the account and property for your site > Click on tracking info > Click on tracking code > tracking code page > UA tracking ID > Copy it
  • Paste your UA tracking ID in Google Tag Manager
  • Under track-type choose Page View
  • Click on the continue button.
  • In Tag Configuration, you can choose the type of tag you want to create. Choose Google Analytics.
  • In Settings can configure your tag type
  • Click on the Triggering Section and when you find the tag, choose >Select all pages
  • Click on the create button.
  • You get a tracking code to add in your WordPress site
  • Copy the code

To make your tags come to life, you have to publish your Container

Publish the Container you have already set up

  • Click on the SUBMIT button in your Google Tag Manager interface
  • Enter a Version Name and a Version Description (which tags you added and what they are for) in as much detail as possible
  • Click on PUBLISH

To complement your Google Tag Manager setup, check out WordPress’s Google Tag Manager plugin


If you don’t want to copy and paste your tags then let the Google Tag Manager WordPress plugin take care of these tasks. The plugin will insert the container code snippets into your WordPress website for you.

Go to Google Tag Manager for WordPress and check out the installation page for more info.

Recap of how to install Google Tag Manager on WordPress

Tags are job descriptions snippets within a page. Tags collect information from the page, the data layer on your website, from your browser, and collect user information. This information is transformed into requests that will be distributed to different places.

This process powers all your conversion tracking, marketing campaigns, analytics, ...

With the help of Google Tag Manager, your digital marketing activities will be more efficient and you can keep track all of your efforts.

Follow these steps to install Google Tag Manager on WordPress and make it work for you:

  • Install and set up Google Tag Manager
  • Add Google Tag Manager to WordPress.
  • Create and/or add new tabs
  • Publish your Container
  • You may also want to install the Google Tag Manager WordPress plugin

You can create and store a wide variety of tags in your Google Tag Manager container and your WordPress site will work with the best marketing and tracking tools imaginable.

If you enjoyed reading this article on how to install google tag manager on WordPress, you should check out this one about how to use toolset.

We also wrote about a few related subjects like how to embed a google form in WordPress, how to downgrade WordPress, how to redirect 404 to homepage, WordPress memory limit, how to see the current WordPress version and how to change the author in WordPress.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 260,000+ customers.
Siteground Hosting