Table of Contents
- Introduction
- What You Need Before You Start
- Step 1: Create a Google Analytics 4 Property
- Step 2: Get Your GA4 Tracking ID
- Step 3: Install Google Analytics 4 in WordPress
- Method 1: Using a Plugin
- Method 2: Adding the Tracking Script Manually
- Step 4: Verify Your Installation
- Troubleshooting Common Issues
- Conclusion
Introduction
Google Analytics 4 (GA4) is the latest version of Google Analytics, offering enhanced tracking capabilities and a more comprehensive view of user interactions on your website. If you're using WordPress, integrating GA4 can provide invaluable insights into your site's traffic and user behavior. This guide will walk you through the steps to install Google Analytics 4 in WordPress, either through a plugin or by adding the tracking script directly to your theme's header.
What You Need Before You Start
- A Google account to access Google Analytics.
- A WordPress website with admin access.
- Basic understanding of WordPress dashboard and settings.
Step 1: Create a Google Analytics 4 Property
1. Go to the Google Analytics website and sign in with your Google account. 2. Click on 'Admin' in the lower left corner. 3. In the 'Account' column, select 'Create Account' and follow the prompts to set up your account. 4. In the 'Property' column, select 'Create Property'. Enter your property name, select the reporting time zone, and currency, then click 'Next'. 5. Fill in the required business information and click 'Create'. 6. Accept the terms of service, and you will be directed to the property setup screen.
Step 2: Get Your GA4 Tracking ID
1. After creating your property, you will see a 'Data Streams' section. Click on 'Web'. 2. Enter your website URL and a stream name, then click 'Create Stream'. 3. On the next screen, you will find your Measurement ID, which looks something like 'G-XXXXXXXXXX'. Copy this ID; you will need it for the next steps.
Step 3: Install Google Analytics 4 in WordPress
Method 1: Using a Plugin
One of the simplest ways to install GA4 on your WordPress site is by using a dedicated plugin. Here's how to do it:
- 1. From your WordPress dashboard, go to 'Plugins' > 'Add New'.
- 2. Search for 'Site Kit by Google' or 'GA Google Analytics'.
- 3. Install and activate the plugin.
- 4. Once activated, go to the plugin settings page and connect your Google account.
- 5. Select your GA4 property from the list and save the settings.
Method 2: Adding the Tracking Script Manually
If you prefer not to use a plugin, you can manually add the GA4 tracking code to your theme's header. Here's how:
- 1. From your WordPress dashboard, go to 'Appearance' > 'Theme Editor'.
- 2. Locate the 'header.php' file in the right-hand sidebar.
- 3. Before the closing </head> tag, paste the following GA4 tracking script:
<script async src='https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX'></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>4. Replace 'G-XXXXXXXXXX' with your actual Measurement ID. 5. Click 'Update File' to save your changes.
Step 4: Verify Your Installation
After implementing GA4, it's essential to ensure that the tracking is working correctly: 1. Go back to your Google Analytics account and navigate to the 'Realtime' report. 2. Open your website in a new tab and perform some actions. 3. You should see active users on your site reflected in the Realtime report.
Troubleshooting Common Issues
If you do not see data coming into your GA4 account, consider the following troubleshooting steps: - Check if the Measurement ID is correctly entered in the tracking code. - Ensure that your site is not set to 'noindex' or 'disallow' in your robots.txt, as this can prevent tracking. - Clear your cache if you are using a caching plugin, and try accessing your site in incognito mode.
Conclusion
Installing Google Analytics 4 on your WordPress site is crucial for understanding your audience and improving your content strategy. Whether you choose to use a plugin or add the tracking code manually, the steps outlined in this guide will help you set up GA4 efficiently. Regularly monitor your analytics to gain insights and make data-driven decisions for your website.

Work with Figmantor
We are an experienced team of experts in AI integrations, WordPress development, Showit customizations, and Next.js web development. From fixing bugs and optimizing speed to converting designs into production-ready platforms, we handle your project end-to-end with premium code quality.
Related Articles
How to Convert Figma to Elementor WordPress — Complete Guide 2026
Learn the complete step-by-step process for converting Figma designs into pixel-perfect WordPress Elementor websites. Covers design audits, asset optimizations, containers, and QA.
ShowitFigma to Showit: Build Stunning Showit Websites From Your Designs
Discover how to transform your Figma mockups into beautiful, drag-and-drop Showit websites. Learn the custom canvas settings, mobile-first design, and WordPress blog styling.
