How to Install Google Tag Manager on WordPress (2026 Step-by-Step Guide)
Google Tag Manager (GTM) is the right tool when you'll be running more than one tracking tag - GA4 + Meta Pixel + LinkedIn Insight + conversion APIs - because it lets you manage all of them from one container without redeploying WordPress every time you change a tag. Installation on WordPress takes about 10 minutes.
What you'll need before you start
- •A WordPress site you can administer (wordpress.org or wordpress.com Business+)
- •A Google account
- •About 10 minutes
How to install Google Tag Manager on WordPress: Step-by-step
- 1
Create a GTM container at tagmanager.google.com
Go to tagmanager.google.com and sign in. Click Create Account, fill in account name (your company), country, container name (your site URL), and target platform Web. Accept the Terms of Service. GTM gives you two snippets: a
<script>block for the<head>and a<noscript>block for immediately after the<body>tag. Both contain your container ID in the formatGTM-XXXXXXX. - 2
Install a GTM-aware plugin (recommended path)
The cleanest WordPress path is GTM4WP (Google Tag Manager for WordPress) by Thomas Geiger. In your WordPress admin: Plugins → Add New Plugin → search GTM4WP → Install Now → Activate. The plugin handles both snippets correctly, including the
<noscript>placement, and exposes a powerful data layer for events. - 3
Connect GTM4WP to your container
In WordPress, go to Settings → Google Tag Manager. Paste your
GTM-XXXXXXXcontainer ID into the Google Tag Manager ID field. Set Container code on/off to On - Code is added but the container has to be edited manually (gives you the most flexibility) and Container code placement to Off (manual coding) or Codeless injection depending on your theme. For most themes Codeless injection works without code changes. - 4
Alternative: paste GTM snippets manually
If you don't want a plugin, edit your theme's
header.php: paste the<script>block immediately after the opening<head>tag. Then paste the<noscript>block immediately after the opening<body>tag (you'll find that inheader.phptoo). Save. Use a child theme so updates don't wipe out your changes. - 5
Add your first tag inside GTM (for example, GA4)
Back in tagmanager.google.com, click Tags → New. Choose Google Analytics: GA4 Configuration, paste your GA4 Measurement ID (
G-XXXXXXXXXX), set the trigger to All Pages, save. Click Submit in the top-right to publish the container - tags don't go live until you submit. - 6
Verify the container is firing
Use GTM's built-in Preview mode (button at the top-right): paste your site URL and click Connect. A new browser window opens running your site with GTM's debug overlay - you should see your GA4 tag listed under "Tags Fired". If yes, you're done.
How to verify your setup is working
The fastest verification is GTM's Preview mode - click Preview in the GTM dashboard, paste your site URL, and confirm tags fire. Outside Preview, the free Google Tag Assistant Chrome extension shows every tag firing on the page along with its container ID. If GA4 tags are configured, GA4's Realtime report will also show traffic from your test session.
Common issues and fixes
GTM Preview says "GTM container not found on this page"
The GTM snippet isn't actually in the rendered page. View source on your live site (Ctrl+U / Cmd+U) and search for GTM-XXXXXXX - if you don't find it, the plugin or theme code didn't deploy. Clear all caches (WP Rocket, W3 Total Cache, Cloudflare) and re-check.
I had Universal Analytics installed and now I have duplicate tracking
Universal Analytics was retired in 2024 - any UA tags still firing are inert. But duplicate firing of the GA4 tag IS possible if you installed both Site Kit (which has GA4) AND a manual GA4 tag in GTM. Pick one path: either use Site Kit for GA4 OR use GTM. If you go with GTM, disable GA4 in Site Kit (Site Kit → Settings → Connected Services → disconnect Analytics).
Site Kit says it can manage GTM - should I use that instead of GTM4WP?
Site Kit can install the GTM container snippet but doesn't expose the rich data layer that GTM4WP does. If you only need GTM as a vehicle for GA4, Site Kit is fine. If you'll use GTM for ecommerce events, scroll tracking, form tracking, or advanced triggers, GTM4WP is much better - it pushes WordPress-specific events (gtm4wp.userLoggedIn, gtm4wp.contentBatch, comment events) into the data layer automatically.
Frequently asked questions
Is Google Tag Manager free?
Yes - completely free for any site, regardless of traffic. There's a paid 360 tier (six figures annually) that's relevant only for the largest enterprises. For nearly every WordPress site, the free version is more than enough.
Do I need Google Tag Manager if I already have Google Analytics?
Not necessarily. If GA4 is the only tag you'll ever run, install GA4 directly via Site Kit and skip GTM. Add GTM the moment you need a second tag (Meta Pixel, LinkedIn Insight, conversion APIs, etc.) - managing them all through GTM is much cleaner than wiring each one separately into WordPress.
Should I use GTM4WP or Site Kit for Google Tag Manager on WordPress?
GTM4WP if you'll use GTM for advanced tracking (ecommerce, form events, scroll depth, custom dimensions). Site Kit if you only need GTM as a vehicle for GA4. GTM4WP exposes a much richer data layer with WordPress-aware events; Site Kit's GTM support is more basic.
Can I install Google Tag Manager on WordPress.com (the hosted version)?
Only on the Business, Commerce, or Enterprise plans, which allow custom code and plugins. Free, Personal, and Premium plans don't allow GTM installation. The cheapest workaround is to switch to wordpress.org self-hosted (about $5-15/month for hosting).
How do I track WooCommerce purchases with Google Tag Manager?
GTM4WP has built-in WooCommerce integration - toggle it on under Settings → Google Tag Manager → Integration → WooCommerce. The plugin pushes ecommerce events (view_item, add_to_cart, begin_checkout, purchase) into the data layer automatically. Then create matching tags in GTM that consume those events and forward them to GA4 / Meta / your destinations.
How do I know if Google Tag Manager is working on WordPress?
Use GTM's Preview mode (button in the top-right of tagmanager.google.com) to see exactly which tags fire and which triggers match. Outside Preview, install the free Google Tag Assistant Chrome extension - it shows every tag firing on the page. If you have any tags in your GTM container, those tags should appear in their respective platforms (GA4, Meta Events Manager, etc.).
Related Guides
Once you're set up, MeasureBoard turns the data into action
MeasureBoard connects to your analytics, search, and SEO tooling and generates AI-powered weekly reports, GEO readiness scores, and a dedicated AI analyst that answers questions in plain English. Free to start, connects in 30 seconds.
Get Started Free