◦ Comprehensive security
◦ 24/7 support
WordPress Guide → Admin → 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:
- Google Analytics 4 tracking
- Facebook Pixel
- Ad conversion tracking
- Scroll depth, video view, or outbound link triggers
- Custom HTML or JavaScript tags
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:
- No need to touch code repeatedly. Add your tracking scripts once in GTM instead of editing theme files every time.
- Easy version control and debugging. GTM’s preview and debug mode helps test tags before they go live.
- Advanced tracking features. Create triggers for scrolls, button clicks, form submissions, and more.
- Faster tag deployment. You can launch or pause tags without deploying new site code.
- Centralized tag management. No need to dig through plugin settings or custom functions.
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:
- Google Tag Manager for WordPress by Thomas Geiger
- Site Kit by Google (for Google-owned tools only)
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:
- In Google Tag Manager for WordPress, go to Settings > Google Tag Manager and paste your container ID.
- In Site Kit, go through the setup wizard and connect your Google services.
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:
- A <script> tag for the <head> section
- A <noscript> iframe for the <body> section
Keep these handy.
2. Edit your theme files
Use a child theme to prevent your changes from being overwritten during updates. Then:
- Open header.php
- Paste the <script> code right before the closing </head> tag
- Paste the <noscript> code immediately after the opening <body> tag (or use the wp_body_open() hook if supported)
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:
- Go to Appearance > Header Footer & Blocks
- Add a new template
- Paste the <script> code into the header and the <noscript> code into the body
- Assign the template site-wide
Option 2: Use Elementor Pro’s custom code feature
Elementor Pro users can add GTM via Custom Code:
- Go to Elementor > Custom Code
- Click Add New
- Choose Location: Head for the script and Body Start for the noscript
- Paste the relevant code and publish
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:
- Google Analytics 4: Create a new tag, choose GA4 Configuration, and enter your Measurement ID.
- Facebook Pixel: Use the Custom HTML tag type and paste your Facebook Pixel code.
- Scroll tracking, clicks, or form submissions: Add built-in triggers like Scroll Depth, Click – All Elements, or Form Submission to fire tags when users interact with your site.
After creating a tag:
- Assign a trigger
- Save and publish
- Use Preview Mode to test your setup
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:
- Keep it lean. Only install tags you actually use. Too many scripts can slow down your pages.
- Use tag sequencing. Load important tags first (like GA4) and delay less critical ones.
- Enable Consent Mode. If you’re targeting users in the EU or California, enable Consent Mode to respect cookie preferences.
- Monitor with Tag Assistant. Use the Google Tag Assistant to spot broken or duplicate tags.
- Test regularly. After publishing new tags, always use GTM’s Preview Mode to confirm everything works as expected.
WordPress + Tag Manager FAQ
Next steps for installing and using Google Tag Manager on WordPress
Installing Google Tag Manager on WordPress opens up powerful tracking, analytics, and conversion tools without needing to edit your site every time you run a new campaign.
If you’re just getting started, use a plugin to get up and running fast. Once you’re comfortable, experiment with custom tags, advanced triggers, and consent settings to take full control over how your data is collected and used.
Ready to upgrade your WordPress experience? Professional hosting improves speeds, security, and reliability for a website and a brand that people find engaging and trustworthy. Liquid Web’s WordPress hosting options configure business-class servers and support plans specifically for WordPress websites.
Don’t want to deal with server management and maintenance either? Our fully managed hosting for WordPress is the best in the industry. Our team are not only server IT experts, but WordPress hosting experts as well. Your server couldn’t be in better hands.
Click through below to explore all of our hosting for WordPress options—including VPS and dedicated servers—or chat with a WordPress expert right now to get answers and advice.
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