Table of contents
Get the industry’s fastest hosting for WordPress◦ 100% network uptime
◦ Comprehensive security
◦ 24/7 support

WordPress GuideAdmin → Google Tag Manager

How to install and use Google Tag Manager on WordPress

Google Tag Manager makes it easier to manage all your tracking codes in one place—without constantly editing your WordPress theme files. Whether you’re setting up Google Analytics 4, Facebook Pixel, or custom conversion events, GTM helps you deploy scripts efficiently and safely.

Let’s walk through how to install and use Google Tag Manager on a WordPress site.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

What is Google Tag Manager?

Google Tag Manager (GTM) is a free tool from Google that allows you to add and manage multiple marketing and analytics tags from a single dashboard. Instead of adding each tracking code manually into your site, you paste one GTM container snippet and then manage all your scripts from the GTM interface.

You can use GTM to add:

It’s especially helpful for marketing teams that need to test campaigns quickly without always relying on a developer.

Benefits of using GTM on WordPress

Using GTM with WordPress can save you time and keep your site more organized. Here’s why many site owners love it:

Exhibit A: How to install Google Tag Manager on WordPress with a plugin

The easiest way to use GTM on WordPress is by using a plugin. It’s the most beginner-friendly option and works with most themes and setups.

1. Create a GTM account and container

Go to tagmanager.google.com and sign in with your Google account. Click Create Account, name it, and set the container type to Web. You’ll get a container ID that looks like GTM-XXXXXX.

2. Install a GTM plugin

You can use one of these well-rated options:

Install and activate your chosen plugin from the WordPress dashboard under Plugins > Add New.

3. Add your container ID

Open the plugin settings. For example:

Click Save and use GTM’s Preview Mode to confirm the container is working on your live site.

Exhibit B: How to add Google Tag Manager to WordPress manually (without a plugin)

If you prefer not to use a plugin, you can insert the GTM code manually into your WordPress theme. This gives you more control, but also requires caution.

1. Copy the GTM code snippets

When you create a container, GTM gives you two code snippets:

Keep these handy.

2. Edit your theme files

Use a child theme to prevent your changes from being overwritten during updates. Then:

Save your changes and upload the file, or edit directly through the WordPress Theme File Editor (not recommended for beginners).

3. Verify with GTM Preview Mode

Return to your GTM account, click Preview, and enter your site URL. You’ll see a debug console appear on your site if everything’s working correctly.

Exhibit C: How to add Google Tag Manager in WordPress using Elementor

If your site is built with Elementor, you have a couple of options depending on whether you’re using the free or Pro version.

Option 1: Use a header/footer plugin

Install Ultimate Addons for Elementor. After activation:

Option 2: Use Elementor Pro’s custom code feature

Elementor Pro users can add GTM via Custom Code:

Either method ensures your GTM snippets load properly across your Elementor-powered pages.

Setting up common tags in GTM

Once GTM is installed, you can create and manage tags directly from your GTM dashboard. Some of the most common setups include:

After creating a tag:

GTM performance and privacy best practices

GTM is powerful, but it can slow your site or cause privacy issues if not configured properly. Follow these best practices:

WordPress + Tag Manager FAQ

You can install GTM on WordPress using a plugin like Site Kit or Google Tag Manager for WordPress. After installation, add and manage all your tracking tags from the GTM interface—no need to edit code after that.

Paste the GTM container code directly into your theme files. Add the <script> tag to header.php before </head>, and the <noscript> tag right after the opening <body> tag (or via wp_body_open() if supported).

Yes, GTM remains a widely used and actively maintained tool. It’s essential for managing multiple analytics and marketing scripts without cluttering your codebase—and it works perfectly with GA4, ads, and third-party tools.

Use a plugin like Header Footer & Blocks to inject GTM code into your Elementor theme, or use Elementor Pro’s Custom Code feature to add GTM to your site’s header and body sections.

Additional resources

How to use your WordPress admin login page →

How to find, use, and troubleshoot your admin page

How to add a login button to your WordPress homepage →

Learn how to add a login button to your WordPress site for easy user access and navigation.










Easy WordPress website maintenance tips →

7 simple steps to keep on regular rotation