to install Google Tag Manager on WordPress and send data to Google Analytics 4 (GA4), you only need to add one snippet to your site. After that, GA4 and every other tracking tag is managed from inside Tag Manager, with no more code edits. This guide walks through the setup, the mistake that trips up most beginners, and how to confirm it works.
Why Use Tag Manager Instead of Pasting GA4 Directly?
Pasting the GA4 code straight into your theme works, but every new tracking tool means another code edit. With Google Tag Manager (GTM), you install one container once. Later you can add GA4, a Meta pixel, ad conversion tags, or verification tags from the GTM dashboard, and test them before they go live.
The tradeoff is one extra tool to learn. If you only ever need basic GA4 reports, a plugin that connects GA4 directly can be simpler. If you expect to add more tags, GTM saves time.
What You Need Before You Start
- A Google account
- A GA4 property for your site, with its Measurement ID (it starts with G-)
- Admin access to your WordPress dashboard
- A self-hosted WordPress site where you can install plugins
Step 1: Create the Tag Manager Account and Container
- Go to Google Tag Manager and sign in.
- Create an account and name it after your site.
- Create a container, choose Web as the target platform, and accept the terms.
- Copy your container ID. It looks like GTM-XXXXXXX.
Step 2: Install Google Tag Manager on WordPress
Tag Manager needs two snippets: one in the head of your pages and a fallback right after the opening body tag. A plugin handles both for you.
Option A: a plugin (recommended for most sites). Google Tag Manager for WordPress (GTM4WP) is the most widely used option.
- In WordPress, go to Plugins, Add New, search for “Google Tag Manager for WordPress,” then install and activate it.
- Go to Settings, Google Tag Manager.
- Paste your container ID into the Google Tag Manager ID field and save.
Option B: manual or a code snippet plugin. Paste the head snippet as high as possible in the head, and the noscript snippet right after the opening body tag. A header and footer snippet plugin such as WPCode makes this safer than editing theme files, and it survives theme updates better.
Step 3: Add the Google Tag
Inside your GTM workspace:
- Go to Tags, New.
- Choose Google tag as the tag type.
- Enter your GA4 Measurement ID (the one that starts with G-).
- Set the trigger to All Pages. Some guides recommend the Initialization trigger instead, but All Pages works for a basic setup.
- Name the tag and save it.
The Mistake to Avoid: Starting With a GA4 Event Tag
A common beginner error is choosing Google Analytics: GA4 Event as the first tag. When you do, GTM shows the warning “No Google tag found in this container,” next to your Measurement ID.
That warning means GA4 event tags depend on a base Google tag, and you haven’t created one yet. The fix is to close the event tag, create the Google tag first (Step 3), and only then add event tags for things like button clicks or form submissions. The GTM4WP documentation says the same thing: add the generic Google tag first, then check that the message next to the ID says a Google tag was found in this container.
Step 4: Test in Preview Mode
- In GTM, click Preview.
- Enter your site’s URL and connect.
- In the Tag Assistant panel, confirm that your Google tag shows as fired on page load.
If the connection fails, install Google’s Tag Assistant Companion extension for Chrome. The older Tag Assistant Legacy extension was discontinued in October 2023.
Step 5: Publish and Verify in GA4 Realtime
- In GTM, click Submit, then Publish.
- In GA4, open Reports, Realtime.
- Visit your site in another browser tab and click around.
- Confirm you appear as an active user.
The warning on your GA4 data stream page that data collection isn’t active can lag behind reality. Realtime is the faster check.
If Nothing Shows Up
- Check the container ID in the plugin settings for typos.
- Confirm the container is published, not just saved.
- Clear your cache. A caching plugin or host cache can keep serving the old page without the snippet.
- Try another browser or turn off ad blockers. Many block tracking scripts.
- View the page source and search for “GTM-” to confirm the snippet is on the page.
- Look for duplicates. Make sure only one tool installs GA4.
Quick Checklist
- Create the GTM account and container.
- Install the container on WordPress with a plugin or snippets.
- Create the Google tag with your Measurement ID.
- Test in Preview mode.
- Publish the container.
- Verify in GA4 Realtime.
- Add event tags only after the Google tag works.
Frequently Asked Questions
Is Google Tag Manager free? Yes. Guides describe it as a free, web-based service from Google.
Do I need Tag Manager to use GA4 on WordPress? No. Plugins can connect GA4 directly. GTM is most useful when you expect to add several tracking tags over time.
Where do the GTM snippets go? One goes in the head of every page and the noscript fallback goes right after the opening body tag. GTM4WP places both for you.
Can I use GTM and a GA4 plugin together? You can, but be careful not to send the same pageviews twice.