Google Tag Manager (GTM) is a powerful tool that allows website owners to manage and deploy marketing and analytics tags without modifying code manually. If you want to track user behavior, integrate analytics tools, or manage pixels efficiently, setting up GTM on your WordPress site is essential.
In this guide, we will walk you through the step-by-step process to install Google Tag Manager on WordPress.

1. What is Google Tag Manager?
Google Tag Manager (GTM) is a free tool by Google that simplifies the process of adding and managing various tracking codes (tags) on your website. These tags can be used for:
- Google Analytics tracking
- Facebook Pixel integration
- Conversion tracking
- Remarketing campaigns
Instead of manually adding tracking codes to your site, GTM allows you to manage them from a single dashboard, reducing the need for developer assistance.
Learn more about Google Tag Manager.
2. Why Use Google Tag Manager on WordPress?
2.1. Easier Tag Management
With GTM, you don’t need to modify your site’s code whenever you add or update tracking scripts.
2.2. Improved Website Performance
Google Tag Manager loads asynchronously, preventing scripts from slowing down your website.
2.3. Enhanced Tracking Capabilities
You can set up custom triggers and events to track user interactions more effectively.
3. Steps to Set Up Google Tag Manager on WordPress
3.1. Create a Google Tag Manager Account
- Go to Google Tag Manager.
- Click on “Create Account” and enter your account details.
- Set up a new container (your website) and choose “Web” as the target platform.
- Click “Create” and accept the terms of service.
3.2. Get Your Google Tag Manager Code
- After creating your container, Google will provide you with two code snippets.
- Copy both snippets—one should be placed inside the
<head>tag, and the other inside the<body>tag of your site.
3.3. Add Google Tag Manager to WordPress
Option 1: Manually Add the Code to Your Theme
- Go to your WordPress dashboard.
- Navigate to Appearance → Theme Editor.
- Open the header.php file and paste the first GTM code inside the
<head>section. - Open the footer.php file and paste the second GTM code before the closing
</body>tag. - Save the changes.
Option 2: Use a Plugin (Recommended for Beginners)
- Install and activate the Insert Headers and Footers plugin.
- Go to Settings → Insert Headers and Footers.
- Paste the first GTM code in the Header section.
- Paste the second GTM code in the Body section.
- Save the changes.
4. Verify Google Tag Manager Installation
After adding the GTM code, follow these steps to confirm the setup:
- Go to Google Tag Manager and click Preview Mode.
- Enter your WordPress website URL and click Connect.
- If the Tag Assistant shows GTM is active, the installation is successful.
You can also use the Google Tag Assistant Chrome Extension to check if GTM is working correctly.
5. Adding Tags to Google Tag Manager
Once GTM is set up, you can start adding tags. Some popular tags include:
- Google Analytics 4 (GA4) for tracking website traffic
- Facebook Pixel for social media marketing
- Google Ads Conversion Tracking for monitoring ad performance
Simply create a new tag, configure triggers, and publish changes directly from GTM.
Plugin or Manual Code: Which Way Should You Add Google Tag Manager on WordPress?
There are two common ways to install the container code. The first is a dedicated plugin, which is the easiest option for beginners because you only paste your container ID. If you have never added one before, our guide on how to install a plugin on your WordPress website explains the process. The second is adding the two code snippets directly to your theme, ideally through a child theme so that your changes survive theme updates.
A plugin is usually safer, because there is no risk of breaking a theme file with a typing mistake. Manual installation gives you full control and avoids an extra plugin, but it requires more care.
Common Mistakes When Setting Up Google Tag Manager on WordPress
- Tracking twice. If a plugin or theme already adds your Google Analytics code and you also create a Google Analytics tag in Tag Manager, every visit is counted two times. Use only one method.
- Forgetting to publish. Changes in Tag Manager do not go live until you click Submit and publish the container version.
- Skipping Preview mode. Always test new tags with the built-in Preview mode before you publish, so you can confirm that each tag fires on the right page.
- Ignoring caching. If you use a caching or optimization plugin, clear the cache after you add the code, otherwise visitors may keep seeing the old version of the page.
- Overlooking privacy rules. If your audience is subject to privacy regulations, make sure tags that collect personal data respect your visitors’ consent choices.
Frequently Asked Questions About Google Tag Manager
Is Google Tag Manager free?
Yes. Google Tag Manager is free to use, and you can manage many tags and containers without a paid plan.
Do I need to know how to code?
Not for most tasks. The interface is point and click, although basic knowledge of HTML and JavaScript helps when you need custom tracking.
Next Steps After Installing Google Tag Manager
Once the container is working, start with a Google Analytics tag so that you can see page views, then add event tags for the actions that matter, such as form submissions and button clicks. Review your container every few months and remove tags you no longer use, because unnecessary tags add weight to your pages and make troubleshooting harder.
6. Conclusion
Setting up Google Tag Manager on a WordPress website makes tracking and managing scripts much easier. By following the steps above, you can integrate GTM without modifying your website’s core files frequently.
If you find this guide too complex or need help setting up Google Tag Manager on your WordPress site, I’m here to assist you! Contact me, and I’ll handle the setup for you seamlessly.
