How to Add Google Tag Manager to WordPress (2026): Track Everything Without Touching Code

In this guide

Every analytics tool, ad pixel, and conversion script on your site starts as a snippet of code pasted into your theme. Add a few of them and your header becomes a mess that only a developer dares to touch. That is the problem this guide solves: when you add Google Tag Manager to WordPress, you paste one container snippet once, and every later tag is managed from Google’s dashboard, not your theme files.

Google Tag Manager (GTM) is free, and setup takes about 15 minutes. Below are three ways to add Google Tag Manager to WordPress — a dedicated plugin, Google’s Site Kit, and manual code — then a first GA4 tag, verified with Preview mode before anything goes live.

What Is Google Tag Manager?

Google Tag Manager is a free tag management system from Google. It is a container: a small script that loads on your pages and then loads whatever other scripts you have configured, when your rules tell it to.

GTM itself measures nothing and does not replace Google Analytics: it is a switchboard between your WordPress site and every tracking tool you use — GA4, Google Ads, Meta Pixel, and more.

Everything in GTM comes down to three ideas: a tag sends data somewhere (a GA4 pageview tag), a trigger decides when it fires (“on every page view”), and a variable holds a changing value (the page URL, a product price from the data layer).

Once the container is on your site, adding a new pixel means creating a tag in GTM and clicking Publish — no theme edits, no developer tickets. That freedom is the whole reason to add Google Tag Manager to WordPress.

Why Add Google Tag Manager to Your WordPress Site?

If your site only runs GA4 and nothing else, you can add the GA4 tag directly and skip GTM — our guide on how to add Google Analytics to WordPress covers that path. GTM earns its place the moment a second or third tool arrives, and that is when most site owners decide to add Google Tag Manager to WordPress.

First, it keeps your theme clean: one container snippet replaces a pile of header scripts, and when a tool changes its code you update one tag.

Second, changes are fast and safe: every edit is a new version with a one-click rollback, and nothing goes live until you click Submit and publish.

Third, it unlocks tracking a plain GA4 install cannot do alone: clicks, downloads, scroll depth, form submissions, and video plays can all become events with triggers — no custom code.

The trade-off is one more layer to debug: when a tag does not fire, the cause can sit in the container, the trigger, or the page. Preview mode, covered below, shows you which one.

Before You Start: A 2-Minute Checklist

You need three things before you add Google Tag Manager to WordPress — none costs money.

You need a Google account with access to your site’s Google tools — one account per business keeps permissions simple. You also need administrator access to your WordPress dashboard, which all three methods below require. Finally, have a backup if your site earns money: the install is low risk, but a backup turns a bad day into a five-minute restore. If you have not set one up yet, read our WordPress security checklist first.

How to Add Google Tag Manager to WordPress: 3 Methods Compared

Three practical ways to add Google Tag Manager to WordPress exist, all ending with the same container on every page; they differ in effort, control, and extras.

Method Setup time Skill needed Cost Best for
GTM4WP plugin 10 minutes Beginner $0 Most sites
Site Kit by Google 10 minutes Beginner $0 Google-tool users
Manual code with WPCode 15 minutes Can copy code $0 (free plugin) Full control

The plugin method is our recommendation for most sites: GTM4WP is built for this one job, places both snippets correctly, and adds data layer events for common WordPress actions. Site Kit is the right pick if you already use it for Analytics and Search Console, while the manual method suits anyone who wants zero extra plugins.

First, create the container: at tagmanager.google.com, click Create Account, name the account after your business and the container after your domain, and choose Web. Accept the terms, and Google shows your install code and container ID (GTM-XXXXXXX), reopenable from Admin > Install Google Tag Manager.

Method 1: Add Google Tag Manager to WordPress with the GTM4WP Plugin

GTM4WP — “Google Tag Manager for WordPress”, by Thomas Geiger — is the dedicated plugin for this job: 700,000+ active installs on WordPress.org, a 4.5/5 rating, version 2.1.1 (5 November 2026), needs WordPress 6.3+ and PHP 8.0+, and is free — see its WordPress.org listing.

Install and enter your container ID

In Plugins > Add New, search for “GTM4WP” and install and activate it. Then go to Settings > Google Tag Manager, paste just your container ID (GTM-XXXXXXX, not the whole snippet) into the ID field, and save — the plugin places the container code on every page.

That is the whole install: the plugin puts the main script in the head and the fallback snippet after the opening body tag, using the wp_body_open hook (supported by GeneratePress, the theme this site uses).

Turn On the Extras

On its settings page, the most useful options push page author, post type, and category into the data layer automatically, so you can build triggers such as “fire only on blog posts” without writing code.

If you run WooCommerce, enable its integration: it pushes purchase and cart data into the data layer in GA4 format, the foundation of e-commerce tracking in GTM. Form plugins get similar treatment, so a “form submitted” trigger works without custom JavaScript. Leave advanced options alone on a first install — that is all it takes to add Google Tag Manager to WordPress with GTM4WP.

Method 2: Add Google Tag Manager to WordPress with Site Kit by Google

Site Kit is Google’s own official WordPress plugin, connecting Search Console, Analytics, PageSpeed Insights, AdSense, and Tag Manager and showing their data inside your dashboard. It has 5 million+ active installs, is free with no paid tier, and version 1.192.0 was released on 16 November 2026.

Connect Site Kit, Then Tag Manager

Install “Site Kit by Google”, activate it, and follow the setup wizard: sign in with Google, verify ownership through Search Console, and connect Analytics — all through OAuth, so you never paste tracking code yourself.

Then, under Site Kit > Settings > Connect More Services, connect Tag Manager and pick the account and container you created earlier. Site Kit places the snippet — no code, no container ID to copy.

What Site Kit does and does not do

Site Kit handles placement only: tags, triggers, and variables are still built at tagmanager.google.com, and Site Kit shows no GTM reporting inside WordPress.

You open WordPress to see traffic and search data, and Tag Manager to manage tags. But for WooCommerce or form data layer extras, Site Kit falls short — GTM4WP is the better tool. Choose Site Kit to add Google Tag Manager to WordPress when you want one plugin for all of Google’s tools.

A Google Tag Manager workspace with tag, trigger and variable cards

Method 3: Add Google Tag Manager to WordPress Manually with WPCode

The manual method means pasting the container snippets yourself — but not into your theme files. Editing header.php directly is a bad idea: a theme update overwrites your edit, and a typo can break the site. A code snippets plugin stores the code outside your theme, so it survives updates. WPCode is the standard choice: free, more than 2 million active installations, with paid plans from $49 per year for features you do not need here.

Copy the Snippets

In Tag Manager, open Admin > Install Google Tag Manager. Google’s current install screen shows a single snippet to paste immediately after the opening <head> tag. Older containers show two parts: a head script and a <noscript> iframe right after the opening <body> tag (a fallback for visitors with JavaScript disabled). Copy whichever your screen shows, from your own install screen — never from a tutorial, and never type a container ID from memory.

Place the Snippets

Install WPCode, then go to Code Snippets > + Add Snippet, choose Add Your Custom Code, pick HTML Snippet, paste the head snippet, set the location to Site Wide Header, and save and activate.

If your install shows the older two-part code, create a second HTML snippet with the <noscript> iframe at Site Wide Body. That completes the manual install. Choose this method to add Google Tag Manager to WordPress for full control and no extra GTM plugin; the trade-off is maintaining the snippets yourself.

Add Your First Tag: Connect GA4 Inside Tag Manager

A container with no tags does nothing, so the next step after you add Google Tag Manager to WordPress is your first tag: GA4. If you have no GA4 property yet, create one at analytics.google.com first, and note your Measurement ID (it starts with G-).

In your GTM workspace, go to Tags > New, name the tag “GA4 – All Pages”, choose Google Tag, and paste your Measurement ID into the Tag ID field. Then click Triggering and choose Initialization – All Pages, which runs before ordinary page-view triggers, as Google recommends.

Save the tag, then click Submit at the top right, name the version “v1 – GA4 tag added”, and publish. Until you publish, nothing changes on your live site — workspace edits stay drafts. Check GA4’s Realtime report a few minutes later: if your visit appears, the tag works.

Verify the Install with Preview Mode and Tag Assistant

Never trust an untested install: GTM’s Preview mode opens your site with Tag Assistant connected and shows exactly which tags fired, which did not, and why. This check is essential after you add Google Tag Manager to WordPress by any method.

Click Preview in the top right of your GTM workspace, enter your site’s address, and click Connect. Your site opens with Tag Assistant connected; browse it and Tag Assistant marks every tag as fired or not fired.

Check three things: your container appears (Tag Assistant shows a green “Connected” banner with your container ID), your GA4 tag fires on page view, and the tag does not fire twice — a double-fired GA4 tag usually means the code is also hard-coded in your theme or added by another plugin.

A website browser window with a tag preview and debug panel showing fired tags

Also check your page source: your GTM-XXXXXXX ID should appear once in the head. If Preview and the source check pass, the install is correct. If you also want a sitemap in place first, our guide to how to add a sitemap to WordPress covers that in a few minutes.

The dataLayer in Plain English

The data layer is the part of GTM that confuses people most, and it is simpler than it sounds: a JavaScript array, dataLayer, that passes information to GTM that is not visible in the page code — an order value, a form type, a login state. Once you add Google Tag Manager to WordPress with GTM4WP, the plugin creates and fills it automatically.

When you need a custom event, the site pushes a message into it, like this:

dataLayer.push({'event': 'form_submitted', 'form_name': 'contact'});

In GTM, a Custom Event trigger listens for form_submitted and fires a tag when it hears it — with form_name available inside, so one tag handles every form.

You do not need to write data layer code to use GTM well: the page data GTM4WP provides and the built-in variables — Page URL, Click Text, Form ID — cover most sites’ first year of tracking. Learn the data layer when you want purchases or sign-ups measured precisely.

Troubleshooting: When Tags Do Not Fire

Most problems after you add Google Tag Manager to WordPress have boring causes — work through this list first.

The container ID is wrong. Copy it from Admin > Install Google Tag Manager, never from memory — one mistyped character sends data nowhere.

Two GTM containers are installed. A plugin plus a manual snippet, or Site Kit plus GTM4WP, loads the container twice and doubles your data — pick one method and remove the other.

The tag was never published. Changes stay drafts until you click Submit — Preview tests drafts, but visitors only see published versions.

A caching plugin serves old pages. Clear your caching plugin and CDN cache after installing the container, or visitors keep getting pre-install pages; our guide to how to speed up WordPress explains how to clear them safely.

If none of these fits, use Tag Assistant’s error messages — they name the failing tag and usually the reason. And if your tracking involves personal data, note that tags such as reCAPTCHA have their own privacy notes; our guide on how to add Google reCAPTCHA to WordPress covers those.

What Does Google Tag Manager Cost?

Google Tag Manager is free: the standard version costs $0, with no tag limits, no usage caps, and no expiry. Tag Manager 360 is the paid enterprise version — unlimited workspaces (the free version includes three) and support with SLAs — and Google does not publish its price. The plugins you use to add Google Tag Manager to WordPress are free too: GTM4WP, Site Kit (no paid tier), and WPCode’s free version handles the manual method. For structured data in the same container, see our guide to how to add schema markup to WordPress.

Our Verdict

Our verdict: The easiest way to add Google Tag Manager to WordPress is the GTM4WP plugin: install it, paste your GTM-XXXXXXX container ID, save, and verify with Preview mode — ten minutes, with WooCommerce and form data layer extras included free. Choose Site Kit instead if you already use Google’s plugin for Analytics and Search Console. Choose the manual WPCode method only if you want full control and no extra GTM plugin. Whichever method you pick, add one tag (GA4), test it in Preview mode, publish, then check GA4 Realtime.

Frequently Asked Questions

Is Google Tag Manager free?

Yes. The standard Google Tag Manager is free, with no tag limits, no usage caps, and no expiry. The paid Tag Manager 360 version is aimed at large organisations and adds unlimited workspaces and support with service-level agreements; Google does not publish its price.

Do I still need Google Analytics if I use Google Tag Manager?

Yes. Tag Manager measures nothing on its own — it is a container that loads other tools. You still need GA4 (or another analytics tool) as a tag inside the container. GTM manages the tags; GA4 collects and reports the data.

Can I add Google Tag Manager to WordPress without a plugin?

Yes. Copy the container snippet from Admin > Install Google Tag Manager and place it with a code snippets plugin such as WPCode, using the Site Wide Header location (and Site Wide Body for the noscript part, if your install shows two snippets). Never paste the code directly into your theme files, because a theme update will overwrite it.

Where do I find my GTM container ID?

Your container ID looks like GTM-XXXXXXX. You can find it at the top of any workspace in Tag Manager, next to “Workspace Changes”, or under Admin > Install Google Tag Manager. It is also visible in your site’s page source once the container is installed.

Why is my tag not firing in Preview mode?

The most common causes are an unpublished container version (click Submit to publish), a second GTM installation loading the container twice, a caching plugin serving old pages, or an ad blocker stopping the script. Check Preview mode’s tag list first: it shows which tags fired and which did not for each event.

Does Google Tag Manager slow down WordPress?

A single container adds one small script to your pages, and its effect on load time is minimal. What slows a site down is a container stuffed with dozens of heavy marketing tags. Keep your container lean, remove tags you no longer use, and test your speed after adding new tags.

Prices and versions verified 21 November 2026 from the official sources: tagmanager.google.com, wordpress.org/plugins/duracelltomi-google-tag-manager (GTM4WP version 2.1.1, 700,000+ active installs), wordpress.org/plugins/google-site-kit (Site Kit version 1.192.0, 5 million+ active installs), and wpcode.com (WPCode free version; paid plans from $49/year). Prices change over time, so confirm the current price on the vendor’s pricing page before you buy.

Leave a Comment