Below is a complete step-by-step guide with screenshots to implement Google Tag Manager to your WordPress website. We will cover other CMS systems like Joomla, Prestashop e.t.c in our upcoming blogs.
First, login to your Google Tag Manager account to copy the code. If you do not have a Google Tag Manager Account then follow my How to Setup Google Tag Manager Account blog steps to create one for you.
After logging in, please click on the gear icon in the top right corner.
Click on the Install Google Tag Manager link from the menu as shown in the picture below.
You will see your <head> & <body> code here. Leave it open & login to your WordPress Admin panel now.
Once you are logged in to your WordPress admin panel, Mouseover on Appearance and then select Editor from the left menu column.
From the top right corner, select your active theme from the drop down and click on the Select button.
Once theme is selected, scroll-down under Theme Files section until you will find the header.php file. Click on this file for the next steps.
Once header.php file will be loaded, scroll-down slowly until you will find the </head> tag. Now, go back to the Google Tag Manager and copy the code from the <head> section and paste it just before the </head> tag.
Next, copy the <body> tag from the Google Tag Manager and paste it right after the <body> tag in your WordPress header.php file. Have a look at the screenshot below. Once done, click on the Update File button at the bottom of the page. Once saved, go back to Google Tag Manager to test if the code is getting fired properly or not.
In Google Tag Manager, click on Workspace to go back to home & then click on Preview from the top right corner. Please make sure you are using Google Chrome as this option works best on Chrome.
Once the page is fully loaded again, open a new tab within the same Google Chrome and open your website. If you will see a Google Tag Manager preview section at the bottom of your page, then your tag was implemented successfully.
Leave the preview mode now by clicking on the Leave Preview Mode button & click on Submit button in the top right corner to publish these changes. Please note that until you will not publish, changes will not work and will remain in testing mode.
Enter the tag details so the other users will know what you are posting or keep track of the tag history and hit the Publish button.
Congratulations! Your tag was implemented successfully.
Leave your comments if you like this post or have any questions.
About the Author
Every brand has stories to tell – stories that will not only engage, inform, surprise, delight, and impact their audience, but that will also deliver on measurable business goals. My job is to turn these brand stories into profitability by measuring action insights & user behaviors.
I have over 11 years of experience working in the IT industry.
My specialties include but not limited to Digital Media Marketing, Tracking User Journeys, Brand Awareness, Conversion Tracking, Web Analytics and Media Planning & Executions.