Install Google Tag Manager to a WordPress Site

by | Sep 17, 2022

🎯 What’s the goal?
Install Google Tag Manager on your WordPress website.
⚠️ Why does it matter?
Google Tag Manager makes it easier for marketers to implement tags or tracking pixels without having to rely on web developers to do it for them.
🏁 What’s the result?
Successfully launch Google Tag Manager on Your website.
⌚ When do you do this?
After you install WordPress, but also after every theme change.
✅ Any special requirements?
This process only applies to WordPress sites.
🙋‍♂️Who should do it?
The person responsible for managing your website.

👉 Where this is done: In your WordPress Dashboard and Google Tag Manager.

⏳ How long will this take? about 5 minutes


Now let’s add some code to your WordPress website

Environment setup:

  • We recommend that you use the Google Chrome browser to navigate the web,
  • Admin Access to your WordPress Blog.

What is Google Tag Manager?

Google Tag Manager is a free tool that allows you to manage and deploy marketing tags (snippets of code or tracking pixels) on your website (or mobile app) without always having to edit the code of your website.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

Create a Google Tag Manager Account & Generate your Tag

  • Click on “Create Account
  • Then you should see the tab below called “Add a New Account
  • Add a name to your account (Eg: Company Name) and choose your country (1,2)
  • You can decide if You want to share your data with Google (click on “?” for more info)
  • In the “Container Setup” tab choose a name for your container (e.g.: www.mysite.com) (3)
  • Next, choose the target platform – in the case of Website it will be “WEB” (4)
  • Then click on “Create” (5)
  • Read & Accept “Google Tag Manager Terms of Service Agreement”  and click on “Yes
  • You are now in your Google Tag Manager Dashboard Tag Manager, and the next step is to go to the “Admin” tab section.
  • Then click “Install Google Tag Manager.
  • There you can see the code that you need to install on your website.

Adding Google Tag Manager to your WordPress website

  • Log in to your WordPress Admin Area:
    (e.g.: yourblogdomain.com/wp-admin or yourblogdomain.com/wp-login.php)
  • After you log in, go to “Dashboard > Appearance > Theme Editor.
  • You are now in the Theme Editor section of your WordPress Blog, where you see the actual source code of your Theme (the guts of your website). But don’t be scared, we are guiding you step by step on how to add Google Tag Manager code there.

    On the left side, you see the code of one page of your theme (in HTML language)
    On the right side, you see the menu to access the various files that compose your theme

The next step is to find the “HEADER” of your theme, this is the piece of code that is loading first on each page of your website, and that’s the file we want to edit to place the code that will fire on each page of your WordPress Blog.

  • In the Theme Editor, head to the right side and select “Theme Header (header.php)

If you don’t find it, you can press “CTRL-F” to search and find it more easily.

  • Now press Ctrl+F (it will open the searching console) and search for “<head>”
  • This will highlight the place you will use in the next step
  • Go back to “Google Tag Manager” tab on your Chrome Browser
  • Head to code You revealed before in Admin – Install Google Tag Manager
  • Select and copy the first part of the code – NOTICE THAT Google highlights that you should paste this code as high in the <head> of the page as possible, this is very important as the higher the TAG is, the faster it will load / fire on your website.
  • Simply paste the code in the Theme Editor just underneath the “<head>”

BEFORE

AFTER

  • Go back to the Google Tag Manager tab and copy the second part of the code – this time you should paste this code immediately after the opening <body> tag in your Theme Editor.

  • Press Ctrl+F on your keyboard and search for “<body”
  • Locate the <body> opening
  • Then paste second code right underneath it
  • Finally, click on “Update File” at the bottom of the page
  • Now you should see that “File edited successfully”

Congratulations, you just finished installing Google Tag Manager on your WordPress site

Checking if you install Google Tag Manager correctly

  • Install Tag Assistant (by Google) Chrome Extension
  • After installation, click on the Tag Assistant icons on your Chrome Browser
  • Click “Enable” it
  • Now you should see all your working tags or if they encounter any problems. The screenshot below is in Yellow because our Google Tag Manager container is empty. In the next SOP, we’ll show you how to add Google Analytics to your GTM Container.

This is it! You installed Google Tag Manager on your WordPress website. You are now ready to add more Tags & Tracking Pixels to your site. GTM will make it easier for you!

Install Google Tag Manager to a WordPress Site

🎯 What’s the goal?Install Google Tag Manager on your WordPress website. ⚠️ Why does it matter?Google Tag Manager makes it easier for marketers to implement tags or tracking pixels without having to rely on web developers to do it for them. 🏁 What’s the result?Successfully launch Google Tag Manager on Your website. ⌚ When do […]
You May also Like: