skip to Main Content

How to set up Google Tag Manager in WordPress

Google Tag Manager (GTM) is an awesome tool that lets you to easily add tags to your website. With Tag Manager, you can deploy Google Analytics, add pixels, track events, and more. We’ll show you why you should use Tag Manager and how to set it up on a WordPress website.

Why you should use Google Tag Manager

If you’re using WordPress to power your website, Google Tag Manager can help you in a variety of ways. We think it’s a time-saving tool that lets us do a better job of managing digital marketing tasks. GTM can help you reduce the number of plugins you’re using, minimize code changes, and help you scale up digital marketing activities. We use it for many different tasks, including verifying Google Search Console, tracking link clicks, tracking paid campaign conversions, and event tracking. We could list others, but you get the gist.

How to set up Google Tag Manager on a WordPress website

There are a number of components that come together to make Google Tag Manager work. We’ll walk you through creating a Google Tag Manager account, installing GTM on your WordPress website, creating a tag, and publishing the container. You’ll want to make sure you have Google’s Tag Assistant extension, too. Let’s get started.

Create your Google Tag Manager account

  1. Open a new browser tab and go to
  2. Log in using your Gmail address. You’ll want to make sure you’re using the same Gmail address used to set up Google Analytics and Google Search Console.
  3. Fill out the Account Name. We recommend using the business name.
    1 - Add Account
  4. Select your country of origin.
  5. Fill in the Container name. This is your domain name.
  6. Select Web.
  7. Select Create.

Install Google Tag Manager in WordPress

Once you create a Google Tag Manager account, you’ll be prompted to Install Google Tag Manager:

3. Install Tag Manager

There are multiple approaches to getting the snippets on your WordPress website.

You could:

  • Use your WordPress theme’s settings to add the code snippets to the <head> and <body> of your website, or
  • Implement snippets using the popular and respected Insert Headers and Footers plugin, or
  • Edit header.php directly to add the code snippets.

We’ll show how to add the Google Tag Manager code snippets to header.php:

  1. Log in to WordPress.
  2. In your theme files, access header.php.
  3. Add the code snippets to the <head> and <body> sections, respectively.
  4. Update the file.
  5. Go to your website URL.
  6. Enable Tag Assistant.
  7. Refresh your browser window and confirm Tag Manager has been installed on your website.

At this point, you’re all set. Google Tag Manager is on WordPress and you can start adding, testing, and deploying tags. Check out the next section if you’re looking for help on adding tags, or more specifically, looking to add Google Analytics to your website using the help of Google Tag Manager.

Create the Google Analytics tag in Google Tag Manager

Tags are code snippets which Google Tag Manager adds to your website for the purposes of tracking events and collecting additional information about visitors. You can create as many as you want.

We’ll walk you through how to add the Google Analytics tag:

  1. Make sure you’re logged into Google Tag Manager.
  2. Select New Tag on the Workspace tab:
  3. Deleted the text “Untitled tag” and give your tag a name. This might be “Google Analytics” or something similar.
    4 - Create New TagTip: If you think you’re going to add a lot of tags to your website, you may want to keep things organized by using Google Tag Manager naming strategies.
  4. Select the tag icon under the Tag Configuration section.
  5. Select Google Analytics tag from the list.
    5 - Choose Tag Type
  6. Make sure the Track Type is set to Page View.
  7. Under Google Analytics Settings, select New Variable.
  8. Input your Tracking ID. To get your Tracking ID, go to Google Analytics and navigate to Admin > Property > Tracking Info > Tracking Code.
    7 - Google Analytics Tracking Code
  9. Rename the variable to, “Google Analytics Settings”.
  10. Save the tag.
  11. Select the trigger icon under Triggering.
  12. Select the plus (+) symbol in the upper right corner.
  13. Select Page View > Page View under Choose trigger type.
    Custom Trigger
  14. Make sure the This trigger fires on section is set to All Page Views.
  15. Name the trigger.
  16. Save the trigger.
  17. Select the trigger.
  18. Save your tag.
  19. Select the Preview button to turn on preview mode.
  20. Open a new browser window and go to your website.
  21. Make sure Google Analytics tag is listed under the Tags Fired On This Page section of preview panel, located at the bottom of the browser window.
  22. Open another browser window and go to your Google Analytics account.
  23. Go to the Overview under the Realtime section.
  24. Make sure you can see at least one Pageview. This means you set up the Google Analytics tag correctly, and that traffic is being recorded.
  25. Go back to Google Tag Manager and select Leave Preview Mode.
  26. Select the Submit button.
  27. Enter the Version Name and Version Description.
    10 - Publish Version
  28. Select Publish.


Google Tag Manager can save you time, money, and can help you be more efficient with your digital marketing efforts. Setting up this tool on your WordPress site takes some work, but it also comes with a huge payoff. As you expand your digital marketing activities, think about how Google Tag Manager can help you measure your efforts. If you liked this post, check our blog for more tips. Happy tagging!

Josh Gellock

Josh is the SEO and Content Strategist at Expander Digital, an SEO studio he founded in 2014. He's been in the SEO space for over seven years and helps businesses drive website traffic from organic search. When he’s not meeting with clients, you can find Josh spending time with his children or on a bike.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top