How to Use Google Tag Manager with WordPress?

You’re starting a new website, and like more than a third of all site owners, you’ve picked WordPress for your project. A nice-looking theme and a few plugins are already in place to give your site the functionality you’re after.

But do you know how to track important visitor activity and conversions without knowing any code? Google Tag Manager (GTM) is a great possible solution…

What is Google Tag Manager?

As a site owner, you put a lot of time, effort, and money into your project, so you naturally want to see some results of this considerable investment.

You need all the information related to how users interact with your website. You want to know where they come from, how long they stay for, which links they click, which articles they read, etc. You also need to know how well your marketing and advertising campaigns are doing.

This is where tags come in.

A tag is a snippet of code integrated into your website pages with the purpose of collecting detailed information about user activity and behavior. Google Analytics and Facebook Pixel are two of the most popular services that use tags, but dozens of other platforms also employ this technique.

Tags can present a couple of problems. The snippets of code need to be pasted inside your site files, which requires manual code editing. Naturally, people with no background in web development tend to find this a bit intimidating.

What’s more, adding too many snippets can slow your website down, and analyzing the data gathered by all the different tags can be a rather cumbersome process.

Google Tag Manager is a free service that is meant to solve this problem. Instead of manually adding multiple tags for all the different services, you have a single container tag. The rest are generated and managed through an easy-to-use dashboard.

In addition to the higher level of usability and the simplified tag management, using GTM also boosts site performance. You’ll add less code to the site’s templates, thereby reducing the additional load. What’s more, you’ll have more control over individual tags and the impact they have on loading speeds.

The Benefits of Google Tag Manager

GTM wasn’t the first platform of this kind when Google launched it in 2012, but it quickly became one of the most popular solutions. At least part of this popularity is due to its versatility

You can use Google Tag Manager on both websites and iOS and Android mobile apps. The platform supports more than 50 different types of tags by both Google and third-party providers. If you have enough coding skills –  you can create a custom tag as well.

Perhaps its biggest advantage, however, is that, unlike other tag management platforms, GTM is completely free.

How to Install Google Tag Manager in WordPress?

Before you can add GTM to WordPress, you have to create an account and a container tag for your website. Log into your Google account and go to

Click Create Account to get started and fill in the fields.

How to Use Google Tag Manager with WordPress?, How to Install Google Tag Manager in WordPress?

In the Account Setup section, you need to enter the account’s name (e.g., your company’s name) and your location. In the Container Setup section, you have to enter your domain and specify you’ll use the container for a website rather than a mobile app.

After you click the Create button, GTM will ask you to agree to the terms of service, and if you do – the container tag will be generated and displayed in a popup.

How to Use Google Tag Manager with WordPress?, How to Install Google Tag Manager in WordPress? 2

It consists of a couple of code snippets that need to be added to your WP theme’s header.php template. If you close the popup now, you can later access the container tag from the Admin > Install Google Tag Manager section in the GTM dashboard.

There are a few ways of integrating Google Tag Manager into WordPress. For example, WP’s official plugins repository is full of add-ons designed to help you deploy GTM without manually editing any template code

While you’re choosing your solution, pay attention to the number of downloads and the user reviews. By picking a popular and well-supported plugin, you are more likely to get assistance if you find yourself struggling.

An alternative is to set up a plugin that only edits your theme header and footer. Other services also require the addition of code snippets to these particular parts of WP websites. Extensions like Insert headers and Footers make users’ lives easier by correctly positioning the inserted code into the file.

If you’re feeling confident – you can also do it yourself. The more tech-savvy users prefer to paste the code on their own because this eliminates the need to install a plugin specifically for this task. What’s more, doing it is possible from the WordPress dashboard.

Go to Appearance > Theme Editor and find the header template from the sidebar on the right. When you open it, make sure you pay close attention to Google Tag Manager’s instructions. The first snippet must be immediately after the <head> tag, and the second one should be positioned after the opening <body>  tag.

If that’s not the case – GTM won’t be deployed correctly.

Don’t rush the task, even though there’s little that could go wrong. Still, since you will be editing one of your theme’s files, it might not be a bad idea to ensure you have a working backup before you start.

Getting Started With Google Tag Manager

After Google Tag Manager is successfully deployed on your WordPress website, you need to start creating tags.

The utility you’ll use to create a new tag is one of the first things you’ll see when you log into your GTM dashboard.

How to Use Google Tag Manager with WordPress?, Getting Started With Google Tag Manager

You need to specify the type of tag you’re creating. You can choose from over 50 types, including all Google marketing, advertisement, and analytics services, plus various platforms by third-party providers. You also have the option of creating your own script or web beacon.

The different types of tags require different configurations. Overall, the interface is intuitive, and there are plenty of tooltips to make sure you won’t get lost.

Depending on the type of tag you choose, you’ll get different options for the triggers that will fire it. When you’re ready, click Save to save the tag in your dashboard.

How to Use Google Tag Manager with WordPress?, Getting Started With Google Tag Manager 2

The tag is now successfully created but not live yet. To deploy it, you have to click the Submit button from the GTM dashboard homepage. Select the Publish and Create Version option and click Publish.

This will deploy the tag on your website, and the service will start collecting data.

ScalaHosting and WordPress

ScalaHosting has been hosting WordPress websites for well over a decade and has helped thousands of projects get off the ground. We know very well what your WP site needs for starters, and we can guarantee you’ll be able to get it with our WordPress-optimized hosting solutions.

Every plan gives you a free domain, and if you have an existing site, we can migrate it for you so you can switch hosts with no hassle whatsoever.

If your site is still relatively small, you can start on a shared plan and watch your project grow. However, for optimum performance and security, you should probably consider getting your own VPS, fully managed by our experts.

With a VPS, you benefit from an isolated environment with guaranteed resources and a dedicated IP. You can expect even faster loading speeds and more reliable performance.

You also get to control your hosting account through SPanel – an all-in-one management platform developed specifically for our VPS plans.

Among its many useful features, you’ll find SWordPress – a WordPress manager that helps you install the CMS in seconds. When it’s already set up, you can clone the installation, manage auto-updates, change the admin password, and enable a unique feature called Security Lock. It locks your site’s files from outside editing and prevents hackers from injecting malicious code.


Tags can be a powerful weapon in the site admin’s arsenal. They bring you a brilliant insight into what people think about your website, and you can use them to adjust your strategy and further improve the user experience.

Many site owners need multiple tags to get a comprehensive idea of how their projects are progressing, but deploying and managing them all can be a bit of a nightmare. Fortunately, solutions like Google Tag Manager can significantly simplify the task, and WordPress users will be happy to know that it integrates well with the world’s most popular CMS.


Why do I need tags?

Tags can give you a great insight into how your website is doing. You get an idea of where the traffic originates from, how people interact with your website, and how successful your marketing efforts are. Based on this information, you can set yourself specific goals, draw plans, and adjust your strategy so you can easily achieve them.

Why do I need Google Tag Manager?

In addition to letting you easily manage all your tracking scripts and web beacons, Google Tag Manager also reduces the impact they could have on your site’s performance. You get much more control over which tags fire when, and you get to do this without editing any code.

Is it difficult to install Google Tag Manager in WordPress?

Installing Google Tag Manager in WP practically means pasting some code snippets inside your theme’s header template. Those of you who don’t feel comfortable doing this on their own can find plenty of plugins that automate the process.

ScalaHosting – How to Use Google Tag Manager with WordPress?

Was this article helpful?

What’s your goal today?

1. Find the right WordPress hosting solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lightning-fast

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Fill out the form, and we’ll be in touch.

Make your website lighting fast—or your money back
Slow websites lose visitors and sales. See how you can surf tsunami sized traffic spikes—or any traffic—with ease with ScalaHosting. Fill out the form, and we’ll be in touch!
Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.


Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain