In this tutorial, I'm going to cover how to install Google Tag Manager on a WordPress website.
What is Google Tag Manager and Why Should I Install It on My WordPress website?
Google Tag Manager was created to streamline the following tasks:
- Adding various tracking scripts to a website (Google Analytics, re-marketing/retargeting pixels for Google Adwords, Facebook, LinkedIn etc.)
In addition to streamlining the use of different code snippets on your website, Google Tag Manager also reduces the overall size and loading times of your site.
Because there is only one Google Tag Manager container to load in, all of the extra scripts don't have to be downloaded and run over your website. This results in a small overall footprint and faster loading times for your website.
As you always want to ensure an ideal load time of 3 seconds or less on your website, having a small file size is a huge benefit.
What Do I Need to Install Google Tag Manager on my Site?
Some of the pre-requisites we recommend are:
- The Tag Assistant extension for the Google Chrome web browser - this is used to check and test that the Google Tag Manager is installed correctly on your website.
- A Google Tag Manager Account - necessary to follow all steps in this tutorial and connect to your website.
- A WordPress Website - self-hosted and downloaded from WordPress.org and not the WordPress.com version.
Now that all of the pre-requisites are taken care of, let's go ahead and get started installing Google Tag Manager on our WordPress site.
Google Tag Manager Account Creation
- Head over to Google Tag Manager, sign into your Google account and click "Create Account".
- Choose an account name - like your company name.
- Choose your country.
- Name you container - use your website address for this.
- Under "Where to Use Container" choose "Web".
- Click "Create".
- Agree to ToS Agreement.
How to Install Google Tag Manager Code into Your WordPress Website
- Grab head code and copy.
- Go to your WordPress website and login to your dashboard.
- Find where your header and footer scripts are added - this is usually in Appearance => Customize => Theme Settings => Header/Footer Scripts
- Copy head code into "Header Scripts".
- Copy body code into "Footer Scripts".
Testing Our Google Tag Manager Install on Our Wordpress Site
- Go back to Google Tag Manager.
- Click on the "Preview" button.
- Go back to your WordPress website.
- Refresh the page.
- The Tag Manager will appear at the bottom of the browser window.
- If it's installed correctly you'll see a GTM ID over on the bottom right corner.
- Click on the "Data Layer" tab and look for Window Loaded, Dom Ready, Page View events listed there.
Testing Using The Tag Assistant Extension in Google Chrome
We can also test our Google Tag Manager installation by installing the Tag Assistant extension in Google Chrome.
To install this extension:
- Open your Chrome web browser.
- Go to Window => Extensions.
- Click the hamburger menu icon on the top left to roll out the options menu.
- At the very bottom of this menu choose "Open Chrome Web Store".
- Search for "Google Tag Manager
- Go to Tag Assistant (by Google) and click blue "Add to Chrome" button to install.
- Click Tag Assistant button on your website in your chrome extensions bar.
- Click "Enable" and refresh your page again.
- Google Tag Assistant will show Google Tag Manager in list if it's installed correctly.
Final Steps to Install Your New Google Tag Manager Container
- Return to your container on your Google Tag Manager account.
- Click "Submit" blue button in right corner.
- Enter a Version Name
- Enter a Version Description
- Click blue "Publish" button in top right corner.
Congratulations! You've successfully created a Google Tag Manager account and installed it in your WordPress website.
In the next video we will look at how to install the Google Analytics Tag to our Google Tag Manager to track the activity on your website!
Please let me know if you have any questions or comments below, I'd be happy to answer them.
Thank you for watching and I'll see you on the next one!