Google Tag Manager and GA4 Setup is an important step in tracking website performance and understanding visitor behaviour. If you own a WordPress website and are new to website analytics, this beginner-friendly guide will help you connect Google Tag Manager with Google Analytics 4 (GA4), configure tracking, test your setup, and publish it correctly.
Google Tag Manager (GTM) and Google Analytics 4 (GA4) are two essential Google tools that help you track and understand your website performance.
In this beginner-friendly guide, you will learn how to set up Google Tag Manager and Google Analytics 4 on a WordPress website with simple, step-by-step instructions.
We will use msabale.com as an example throughout this tutorial.
1. What Is Google Tag Manager (GTM)?
Google Tag Manager is a free tag management tool provided by Google. It allows you to add, manage, and update tracking codes on your website without repeatedly editing your website’s source code.
For example, you can manage:
- Google Analytics 4 tracking
- Google Ads conversion tracking
- Meta (Facebook) Pixel
- Contact form submission tracking
- Button click tracking
- Website event tracking
In simple words: Google Tag Manager helps you manage different tracking codes and control when they run on your website.
2. What Is Google Analytics 4 (GA4)?
Google Analytics 4 is a website analytics tool that helps you understand how visitors interact with your website.
It provides useful information such as:
- How many users visit your website?
- Which cities or countries do visitors come from?
- Which website pages receive the most traffic?
- Do visitors use mobile devices or desktops?
- How do visitors find your website?
- Which pages receive the most engagement?
- How many users visit your Contact page?
In simple words: GA4 collects website data and presents it through reports so you can understand your website performance.
3. Difference Between Google Tag Manager and Google Analytics 4
| Google Tag Manager | Google Analytics 4 |
|---|---|
| Manages tracking tags | Collects and reports website data |
| Controls tracking codes | Provides website analytics |
| Uses Tags and Triggers | Uses Events and Reports |
| Helps implement tracking | Helps analyze website performance |
For example, Google Tag Manager manages the tracking setup, while Google Analytics 4 helps you understand the information collected through that tracking.
4. Step-by-Step Google Tag Manager and GA4 Setup in WordPress
Before starting the setup, make sure you have:
- A Google Account (Gmail)
- A WordPress website
- WordPress Admin access
- A Google Tag Manager account
- A Google Analytics 4 property
- WPCode plugin or another suitable code integration method
Example website: https://www.msabale.com/
5. Step 1 – Create a Google Tag Manager Account
First, create your Google Tag Manager account.
- Visit https://tagmanager.google.com/
- Sign in using your Google Account.
- Click on Create Account.
- Enter your account details.
Example:
- Account Name: MSabale
- Country: India
- Set up your container:
- Container Name: www.msabale.com
- Target Platform: Web
- Click Create and accept the terms and conditions.
Your Google Tag Manager container will now be created.
You will receive a unique Container ID.
Example: GTM-TKF452WF
Important: A GTM account and a GTM container are different. You can create separate containers for different websites under one GTM account.
6. Step 2 – Add GTM Code to Your WordPress Website
Now, connect Google Tag Manager to your website.
- Log in to your WordPress Dashboard.
- Open the WPCode plugin.
- Go to Code Snippets → Header & Footer.
- Open Google Tag Manager and select your container.
- Find the official Google Tag Manager installation instructions.
- Choose the manual installation option.
Google provides two code snippets:
- First code: Add inside the website’s
<head>section. - Second code: Add immediately after the opening
<body>tag.
- Add both snippets to their correct locations using WPCode or another suitable integration method.
- Click Save Changes.
- If you use LiteSpeed Cache, go to LiteSpeed Cache → Toolbox → Purge All.
Then open your website and check whether it loads correctly.
Important: If WPCode does not provide a Body insertion field, do not paste the second snippet into the Footer as a replacement. Use a suitable theme hook or GTM integration plugin to place it immediately after the opening Body tag.
7. Step 3 – Create a Google Analytics 4 Property
Now, create a Google Analytics 4 property.
- Visit https://analytics.google.com/
- Sign in using your Google Account.
- Go to Admin → Create Property.
- Enter your Property Name.
Example: MSabale Website Analytics
- Select your reporting time zone and currency.
Example:
- Country: India
- Currency: Indian Rupee (INR)
- Complete the business details.
- Click Create Property.
Your GA4 property is now ready.
8. Step 4 – Create a GA4 Web Data Stream
A Web Data Stream connects your website with Google Analytics.
- In Google Analytics, go to Admin → Data Streams.
- Click Add Stream → Web.
- Enter your website URL:
https://www.msabale.com/ - Enter your Stream Name:
MSabale Website - Click Create Stream.
Google Analytics will generate a Measurement ID.
Example: G-QDJHPZ2WG8
You will need this ID when configuring Google Tag Manager.
Important: Understand the difference between these IDs:
- GTM Container ID:
GTM-TKF452WF - GA4 Measurement ID:
G-QDJHPZ2WG8
Always use the correct ID in the correct place.
9. Step 5 – Create a Google Tag in GTM
Now, connect GA4 with Google Tag Manager.
- Open https://tagmanager.google.com/
- Select your container.
- Go to Workspace → Tags.
- Click New.
- Click Tag Configuration.
- Under Choose Tag Type, select Google Analytics.
- Select Google Tag.
- Enter your GA4 Measurement ID in the Tag ID field:
G-QDJHPZ2WG8 - Enter the Tag Name:
GA4 – Google Tag - Configure the Trigger.
For a basic Google Tag setup, use the recommended Initialization – All Pages trigger so the Google Tag loads early on your website pages.
- Click Save.
Your GA4 Google Tag is now added to the GTM workspace.
Note: Google Tag is used for the basic GA4 setup. Google Analytics: GA4 Event is a separate tag type used to track specific user actions.
10. Step 6 – Test Your GTM Setup Using Preview Mode
After creating your tag, test whether it is working correctly.
- Open your Google Tag Manager Workspace.
- Click Preview in the top-right corner.
- Enter your website URL:
https://www.msabale.com/ - Click Connect.
- Your website will open in a new browser tab.
- Check the Tag Assistant Debug Window.
You should see that your website is connected.
- Select Summary or a Page View event from the left panel.
- Check the Tags Fired section.
If GA4 – Google Tag appears under Tags Fired, it means the tag has successfully triggered.
If it appears under Tags Not Fired, review your tag configuration and trigger settings.
Important: Seeing Connected in Tag Assistant only confirms that the debugging connection is established. You must separately verify whether the Google Tag actually fired.
11. Step 7 – Publish Your Google Tag Manager Container
After successful testing, publish your GTM changes to make them live on your website.
- Return to your original Google Tag Manager Workspace tab.
- Review the Workspace Changes section.
Example: Google Tag – Added
This means the tag has been added to your workspace. It does not mean the tag is already live.
- Click Submit in the top-right corner.
- Select Publish and Create Version.
- Enter the Version Name:
GA4 Setup – MSabale - Add a description:
Initial GA4 Google Tag setup for msabale.com - Click Publish.
Your GTM container will now be published with the new version.
12. Step 8 – Test Data in Google Analytics Realtime Reports
Now, check whether Google Analytics is receiving website data.
- Open https://analytics.google.com/
- Select your GA4 property.
- Go to Reports → Realtime.
- Open your website in another browser tab:
https://www.msabale.com/ - Visit a few pages on your website.
- Return to the GA4 Realtime Report.
You may see your own test visit under Active Users.
If data appears in Realtime, it is a positive sign that GA4 is receiving website activity.
Note: Data may take some time to appear. Allow up to 30 minutes for initial data collection and check again if necessary.
13. Common Mistakes to Avoid During Google Tag Manager and GA4 Setup
Mistake 1: Confusing GTM ID with GA4 Measurement ID
Both IDs are different. Make sure you use the correct ID in the correct location.
Mistake 2: Adding GTM Code to the Wrong Location
The first GTM snippet belongs inside the <head> section. The second snippet belongs immediately after the opening <body> tag.
Mistake 3: Selecting GA4 Event Instead of Google Tag
For the initial GA4 setup, select Google Tag. Use GA4 Event tags later when you want to track specific actions.
Mistake 4: Forgetting to Configure a Trigger
Your Google Tag needs an appropriate trigger to run on your website pages.
Mistake 5: Publishing Without Testing
Testing your Google Tag Manager and GA4 Setup with Tag Assistant helps confirm whether your tracking tag is working correctly.
Mistake 6: Installing the GTM Container Code Twice
Use only one correct GTM container installation on your website. Duplicate installations can cause duplicate tracking or inaccurate data.
Mistake 7: Adding Duplicate GA4 Tracking Codes
If you have configured GA4 through GTM, do not add another copy of the same GA4 gtag.js tracking code directly to your website header.
Duplicate tracking can result in inaccurate analytics data.
14. Important Google Analytics 4 Reports to Understand
After completing the setup, you can explore these GA4 reports.
| Report | What It Shows |
|---|---|
| Realtime | Active users on your website right now |
| Acquisition | Where your website traffic comes from |
| Engagement | How visitors interact with your website |
| Pages and Screens | Your most viewed website pages |
| Demographics | Available user location and demographic information |
| Events | Actions performed by website visitors |
| Tech Details | Devices and technologies used by visitors |
These reports help you understand website performance and identify opportunities for improvement.
15. What Should You Learn After Setting Up GTM and GA4?
Once your basic tracking setup is complete, you can learn more advanced tracking methods.
- Google Analytics 4 Event Tracking
- Contact Form Submission Tracking
- Button Click Tracking
- Phone Number Click Tracking
- WhatsApp Click Tracking
- Google Ads Conversion Tracking
- Google Search Console Integration
- Looker Studio SEO Dashboard
These advanced tracking methods help you understand more than website traffic. You can also measure enquiries, conversions, and important user actions.
Frequently Asked Questions (FAQs)
1. Is Google Tag Manager free?
Yes. Google Tag Manager offers free tag management for standard website use.
2. Do I need both Google Tag Manager and Google Analytics 4?
They have different purposes. GTM helps manage tracking tags, while GA4 collects and reports website analytics data. Using them together is a useful approach.
3. How do I install GTM on a WordPress website?
You can install GTM by adding Google’s official installation snippets to the correct Header and Body locations or by using a suitable integration method.
4. How long does it take for GA4 data to appear after publishing GTM?
Initial data may take some time to appear. Check the Realtime report and use Tag Assistant to verify your tracking setup.
5. What is the difference between Google Tag and GA4 Event?
Google Tag provides the basic Google Analytics connection. GA4 Event tags are used to track specific activities, such as button clicks and form submissions.
Conclusion
Google Tag Manager and Google Analytics 4 are valuable tools for website owners, SEO professionals, and digital marketers.
With the correct Google Tag Manager and GA4 Setup, you can track website traffic, understand visitor behaviour, and make better data-driven decisions.
If you manage a WordPress website, start with the basic Google Tag Manager and GA4 Setup. Once the installation is complete, learn advanced tracking methods such as form submissions, button clicks, and conversion tracking.
Start tracking your website performance today!