GA4 + GTM for WordPress Sites – Essential Tracking Made Simple

September 9, 2025
Illustration of a person working on a laptop with WordPress, GA4, and Google Tag Manager icons displayed, symbolizing website tracking and analytics setup.
Analytics Mates icon set sail

Got questions, feeling stuck, or just want a fresh perspective? Book 15 minutes with an analytics specialist.

If you have a WordPress site, one of the things you need to consider is not just about setting it up properly, but to make sure you understand what visitors are doing on your site. Are people filling out your forms? Are they downloading your resources? Are they engaging with your content beyond just scrolling through? If you don’t have a tracking in place then you’re missing out on important insights. In this blog post, we’ll cover not only the technical basics of integrating your Wordpress site with GTM and GA4 but also to share with you essential steps you need to take. Let’s get started.

Why Tracking Matters for WordPress Sites

Google Analytics 4 (GA4) and Google Tag Manager (GTM), these tools  have a crucial role in all of this. They help you see above just surface-level metrics and understand how users are truly engaging or interacting with your site. We’re not just counting how many people visited the site, but with proper tracking you can actually track how many filled out your contact form, or engaged with specific content. That kind of insight makes all the difference in reaching your goal and aim for growth.

Core Setup of GA4 + GTM on WordPress

This may seem a bit technical, but should be easy to follow  once you go through each of the steps. The crucial thing here is to set up accurate tracking.

Step 1: Install the GTM Container

The first step is adding the Google Tag Manager container to your WordPress site. You have two options, but we’d recommend going for the plugin option, since it is easy, flexible and reliable.

Plugin installation: Use a WordPress plugin like “GTM4WP – A Google Tag Manager (GTM) plugin for WordPress” or a dedicated GTM plugin to easily add your container code.

WordPress plugin search results showing the GTM4WP plugin highlighted for installation, used to integrate Google Tag Manager with WordPress.

All you have to do once this is installed is to go to your GTM account and copy your GTM container ID.

Google Tag Manager workspace dashboard showing container status, tag options, and live version details for a WordPress site integration.

In your newly installed plugin (GTM4WP), just paste the GTM container ID. Then simply just save it and you’re good to go.

WordPress settings page showing the Google Tag Manager for WordPress options with a field to enter the GTM container ID.

There are a few extra setup steps required if you plan to fully rely on this plugin.

Advanced settings panel in the Google Tag Manager for WordPress plugin showing options for DataLayer, environment parameters, and container configuration.

The second option is through theme installation, this is a bit too technical and the down side is it’s not flexible. Steps include placing the GTM container code directly into your theme’s header and body files. This approach works well if you prefer direct control, but it may require doing everything all over again after a theme update.

Step 2: Connect GTM to GA4

Once GTM is installed, you’ll want to link it to your GA4 property. We’ll not fully delve through the steps, but here is a quick  guide on how to do it: 

  1. In GTM, create a GA4 Configuration Tag and paste in your Measurement ID from GA4.
  2. Set the tag to trigger on All Pages, ensuring every page view is tracked.
  3. Publish your container so the changes take effect on your live site.
Google Tag Manager setup screen showing a GA4 configuration tag with page view tracking enabled for all pages.

Step 3: Verify Your Events

Now it’s time to confirm that your setup is working.

  1. Open Preview Mode in GTM and test your site.
  2. You can also test and check using GA4 DebugView. 
  3. If they appear correctly, your setup is functioning as expected.

Using GTM to Simplify Tracking

Tracking can be done using the  WordPress plugins, but in order  to better manage your tracking, we’d recommend focusing on using one platform or tool, through GTM.  GTM simplifies the entire process by giving you a central dashboard to manage tracking without updating codes every time. .

Instead of asking your developer to update tracking scripts manually, GTM allows you to do it yourself with just a few steps and clicks.  

The Power of the DataLayer

The DataLayer is like a bridge between your website and GTM. It carries information about user interactions (like products viewed or forms submitted), making your tracking setup far more accurate and reliable. Think of it as the foundation for advanced insights. For more information or if you want to better understand about DataLayer you can check out our blog post here: Debugging GTM Data Layer Issues: Expert Solutions

Benefits of GTM Over Hardcoding

  • Using GTM reduces the constant coding updates , you can simply add or adjust tags from GTM without editing your site code.
  • Can help prevent issues or errors along the way,  which means less risk of breaking your website compared to hardcoding scripts.

Leveraging AI to Streamline Your Tracking Setup

All these steps could feel a bit too technical especially if you are new to analytics. If you feel like you’re struggling or you think you’ve bump into a wall, you can always resort to asking help from AI. By using AI prompts, you can generate step-by-step guides, troubleshoot common errors, or even draft custom tracking scripts faster. We’ve been sharing how to leverage AI when working on tracking events and or analyzing data from GA4, but here’s a quick tip on how to use it effectively. 

  1. You need to make sure you clarify your goal and be specific about what you want to track (e.g., button clicks, form submissions, scroll depth).
  2. Feed the AI more context, sample will mention your platform (WordPress), tools (GA4 + GTM), and what stage you are in (setup, testing, or optimization).
  3. Based on experience we’d suggest asking for  structured output , a  step-by-step guide, sample GTM triggers, or debugging advice.
  4. Most importantly, refine your prompt. Draft it then ask AI to refine it, if you think the first response is too generic, reframe the prompt with more details until you get exactly what you need.

Sample AI Prompt You Can Try

Here’s an example of a clear and useful prompt to guide your GTM setup:

Prompt 1: Tracking Form Submissions

 "I’m using Google Tag Manager with GA4 on my WordPress site. Please walk me through creating a trigger to track when users submit my contact form, including the event parameters I should set in GA4."

Prompt 2: Debugging Setup Issues

"I’ve installed GA4 and GTM on WordPress, but my events are not showing in GA4 DebugView. Can you provide step-by-step troubleshooting instructions to identify and fix common issues?"

Prompt 3: Building a DataLayer Push

 "I want to capture product views on my WordPress site using the GTM DataLayer. Can you create a sample DataLayer push code for a product name, price, and category, and explain how to test if it works?"

Common Pitfalls and How to Avoid Them

Many site owners run into issues that can skew their data or even break their reporting entirely. The good news is most of these problems are preventable if you know what to watch out for.

1. Double-counting Events

One of the most frequent mistakes is having multiple tracking setups running at the same time. For example, you might have GA4 installed directly on your site and then also added through GTM. This leads to double-counting events and inflated metrics.
How to avoid it: Check your source code and GTM container to ensure GA4 is only firing once. Run a test in GA4 DebugView to confirm events are not duplicated.

2. Misfired Tags After Updates

WordPress theme or plugin updates can sometimes cause GTM tags to misfire. A change in element IDs or structure can break triggers you previously set up.
How to avoid it: After every theme or plugin update, revisit your GTM Preview Mode to confirm tags are firing correctly. It only takes a few minutes and saves you from missing important data.

3. Forgetting to Audit Tracking

It is easy to assume tracking is working fine once set up, but forgetting to audit can leave gaps in your data. Even small site changes can affect event tracking.How to avoid it: Schedule regular audits of your GTM and GA4 setup. Test key events like form submissions, button clicks, and downloads at least once a quarter. You can check and grab our free GA4/GTM audit checklist template and make sure your site is collecting the data you actually need.

FAQs 

Do I need both GA4 and GTM for my WordPress site, or is one enough?

A: GA4 can run on its own, but GTM makes managing and scaling tracking much easier without editing code constantly.

Can I use a plugin instead of manually installing GTM on WordPress?

A: Yes, several plugins make this easy, but double-check that the GTM container ID is placed correctly.

What’s the difference between tracking in GA4 directly versus using GTM?

A: GA4 tracks events by default, while GTM gives you full control over what, when, and how events fire.

How often should I audit my tracking setup?

A: At least quarterly, or anytime you make design, plugin, or form changes on your site.

Can I track events without coding knowledge?

A: Yes, GTM uses triggers and tags that don’t require coding. You’ll only need developer help for advanced setups.

Will tracking slow down my WordPress site?

A: Properly configured GA4 and GTM shouldn’t slow down performance. Issues usually come from poorly optimized plugins.

What’s the easiest way to test if my events are firing correctly?

A: Use GTM Preview Mode or GA4’s DebugView to test in real-time.

Can AI really help me set up tracking?

A: Yes, AI can generate setup instructions, suggest missing events, and even provide quick debugging tips.

What happens if I don’t move to GA4?

A: You’ll lose visibility into your traffic since Universal Analytics has stopped processing new data.

Do I need a developer to set up eCommerce tracking in WordPress?

A: For WooCommerce and similar plugins, yes, at least for the initial setup, since it requires pushing structured data to the DataLayer.

Conclusion

Remember that this is not supposed to be a tedious or overwhelming guide, so simply start with what you think is important then build from there as your site grows. Remember that  GTM offers flexibility, GA4 gives you insights, and together they make sure everything is not a guessing game. Overall, just keep your tracking simple, reliable, and improving  with your business. 

Thank you for reading!

‍We're always looking for ways to improve our Google Analytics 4 blog content. Please share your feedback so we can make it even better.

Get free Google Analytics 4 reporting templates sent to your inbox...

Thank you! You have been subscribed to GA4 Updates!
Oops! Something went wrong while submitting the form.
top arrow
By using this website, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts.. View our Privacy Policy for more information.