Setting up Google Analytics 4 on your WordPress site is essential for understanding your audience and making data-driven decisions. This comprehensive guide walks you through every step of the GA4 installation process, from creating your account to tracking custom events.
What is Google Analytics 4?
Google Analytics 4 (GA4) is the latest version of Google’s web analytics platform. Unlike Universal Analytics, GA4 uses an event-based tracking model that provides deeper insights into user behavior across websites and apps. With enhanced privacy controls and machine learning capabilities, GA4 helps you understand your visitors while respecting their privacy.
Why You Need GA4 on WordPress
Google Analytics 4 provides critical insights that help you grow your WordPress site:
- Understand Your Audience: Discover who visits your site, where they come from, and what content they engage with most
- Track User Behavior: Monitor how visitors navigate through your pages and identify drop-off points
- Measure Conversions: Track form submissions, purchases, downloads, and other important actions
- Make Data-Driven Decisions: Use real data to improve content strategy, user experience, and marketing campaigns
- Future-Proof Analytics: Universal Analytics stopped collecting data in July 2023, making GA4 the only option for Google Analytics tracking


Prerequisites Before You Start
Before beginning the installation process, make sure you have:
- A WordPress website with admin access
- A Google account (Gmail or Google Workspace)
- Access to edit your WordPress theme files or install plugins
- Basic familiarity with WordPress dashboard navigation
Step 1: Create Your Google Analytics 4 Account
Creating a GA4 account is the first step in tracking your WordPress site. Follow these instructions to get started.
Navigate to the Google Analytics website and sign in with your Google account. If you’re new to Google Analytics, you’ll see a welcome screen prompting you to start measuring. Click the “Start measuring” button to begin.
Enter your account name, which typically should be your business or website name. Configure the account data sharing settings according to your preferences. These settings control what data you share with Google for benchmarking and technical support.
Click “Next” to proceed to the property creation screen. Enter your property name, select your reporting time zone, and choose your currency. The property name usually matches your website name for easy identification.
Click “Next” to provide business information. Select your industry category, business size, and how you plan to use Google Analytics. This information helps Google customize your reports and recommendations.
Accept the Terms of Service agreement and click “Create” to finalize your GA4 property.
Step 2: Set Up Your Data Stream
After creating your property, you need to set up a data stream to collect information from your WordPress site.
On the data stream setup page, select “Web” as your platform since you’re tracking a WordPress website.
Enter your website URL in the provided field. Make sure to include the full URL including “https://” or “http://”. Enter your stream name, which is typically your website name or domain.
Enable Enhanced Measurement by toggling the switch. This feature automatically tracks page views, scrolls, outbound clicks, site search, video engagement, and file downloads without additional code.
Click “Create stream” to generate your tracking code. You’ll now see your data stream details page with your Measurement ID (starts with “G-“) and tracking code snippet.
Step 3: Install GA4 on WordPress (3 Methods)
There are three primary methods to install Google Analytics 4 on WordPress. Choose the method that best fits your technical comfort level and requirements.
Site Kit by Google is the official WordPress plugin from Google. It’s the easiest and most reliable method for beginners.
Log into your WordPress dashboard and navigate to Plugins > Add New. Search for “Site Kit by Google” and click “Install Now” on the official plugin by Google. After installation completes, click “Activate” to enable the plugin.
The Site Kit setup wizard will launch automatically. Click “Start setup” and sign in with the same Google account you used to create your GA4 property. Grant the necessary permissions to allow Site Kit to connect with your Google account.
Site Kit will automatically detect your GA4 property. Select the property you created earlier from the dropdown menu. If you have multiple properties, ensure you select the correct one for this website.
Complete the setup wizard by following the remaining prompts. Site Kit will automatically insert the tracking code on all your pages without requiring any manual code editing.
MonsterInsights is a premium WordPress plugin that offers advanced GA4 features and an intuitive dashboard.
Purchase and download MonsterInsights from their official website. Navigate to Plugins > Add New > Upload Plugin in your WordPress dashboard. Upload the plugin ZIP file and click “Install Now” followed by “Activate.”
After activation, the MonsterInsights setup wizard launches automatically. Click “Connect with Google Analytics” and sign in with your Google account. Grant the necessary permissions to link MonsterInsights with Google Analytics.
Select your GA4 property from the list of available properties. MonsterInsights will automatically configure tracking on your site. Enable enhanced tracking features like file download tracking, outbound link tracking, and affiliate link tracking from the MonsterInsights settings panel.
Manual installation gives you complete control but requires editing theme files. This method is recommended only if you’re comfortable working with code.
Copy your GA4 Measurement ID from the data stream details page in Google Analytics. Navigate to Appearance > Theme File Editor in your WordPress dashboard. You’ll see a warning about editing theme files directly. Click “I understand” to proceed.
Locate and click on the “header.php” file in the right sidebar. Find the opening <head> tag near the top of the file. Immediately after this tag, paste your complete GA4 tracking code.
The tracking code should look like this:
<!-- Google tag (gtag.js) -->
<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>Replace “G-XXXXXXXXXX” with your actual Measurement ID. Click “Update File” to save your changes.
Important Note: If you update your WordPress theme, you’ll need to re-add this code. Consider using a child theme to prevent losing customizations during theme updates.
Step 4: Verify Your GA4 Installation
After installing the tracking code, verification ensures everything works correctly.
Open your Google Analytics 4 property and navigate to Reports > Realtime in the left sidebar. Keep this window open while you perform the next step.
In a new browser tab or incognito window, visit your WordPress website. Navigate to different pages and interact with various elements on your site.
Return to the Google Analytics Realtime report. You should see your activity appear within seconds. The report shows active users, pageviews, events, and traffic sources in real-time.
If you don’t see any activity after a few minutes, check that you installed the tracking code correctly and that you’re not blocking cookies or using an ad blocker that prevents analytics tracking.
Install the Google Tag Assistant Chrome extension for more detailed verification. After installation, navigate to your WordPress site and click the Tag Assistant extension icon in your browser toolbar.
The extension will analyze your page and display all Google tags it detects. You should see your GA4 Measurement ID listed with a green checkmark indicating successful implementation.
If Tag Assistant shows errors or warnings, click on them to view detailed explanations and troubleshooting steps.
Step 5: Configure Essential GA4 Settings
Proper configuration ensures you collect the most relevant data while respecting user privacy.
Google Signals allows you to track users across devices and enables remarketing features. Navigate to Admin > Data Settings > Data Collection in your GA4 property. Toggle on “Google signals data collection” and save your settings.
Note that enabling Google Signals requires updating your privacy policy to inform users about cross-device tracking and remarketing.
Excluding your own visits prevents skewing your analytics data. Navigate to Admin > Data Streams and click on your web data stream. Scroll down and click “Configure tag settings” then “Show more” and select “Define internal traffic.”
Click “Create” to add a new internal traffic rule. Enter a descriptive name like “Office Network” or “My IP Address.” For the matching conditions, select “IP address” and choose the matching type (equals, begins with, etc.). Enter your IP address in the value field.
To find your IP address, search “what is my IP” in Google. Click “Create” to save the rule. Navigate to Admin > Data Settings > Data Filters and change the internal traffic filter from “Testing” to “Active” to apply your rule.
User properties help you understand your audience better. Navigate to Admin > Data Display > Custom Definitions. Click “Create custom dimension” to add properties relevant to your business.
Common user properties for WordPress sites include user role (subscriber, customer, member), registration date, and lifetime value. Configure these based on the data your plugins or theme can provide.
Step 6: Set Up Custom Events
Custom events track specific user interactions that matter to your business goals.
While Enhanced Measurement captures basic interactions automatically, custom events provide deeper insights into specific actions.
- Form Submissions: Track contact forms, newsletter signups, and lead generation forms. Most form plugins like Contact Form 7, Gravity Forms, and WPForms offer GA4 integration options in their settings.
- Button Clicks: Monitor clicks on important buttons like “Get Started,” “Download,” or “Schedule Demo.” You can use Google Tag Manager or add event tracking code to specific buttons.
- Video Engagement: Track how many users watch your embedded videos and how long they watch. Enhanced Measurement tracks YouTube videos automatically, but custom events provide more detailed metrics.
- Scroll Depth: While Enhanced Measurement tracks scrolling, custom events can trigger at specific scroll percentages (25%, 50%, 75%, 100%) to understand content engagement better.
If you’re using Site Kit or MonsterInsights, these plugins often include event tracking features that don’t require coding knowledge.
In Site Kit, navigate to Settings > Connected Services > Analytics and explore the available event tracking options. Enable the events relevant to your site.
In MonsterInsights, go to Insights > Settings > Conversions and configure event tracking through the visual interface. MonsterInsights Pro offers form tracking, link tracking, and custom event tracking without writing code.
Step 7: Create Important Reports and Explorations
GA4’s reporting interface differs significantly from Universal Analytics. Understanding how to navigate and create reports is essential.
Navigate to Reports in the left sidebar to access standard reports. The Reports Snapshot provides an overview of your key metrics including users, sessions, engagement rate, and events.
The Realtime report shows current activity on your site. This is useful for monitoring traffic spikes, campaign launches, or checking if tracking works correctly.
Under Life Cycle, you’ll find Acquisition reports showing how users find your site, Engagement reports revealing what they do on your site, Monetization for e-commerce tracking, and Retention reports showing how often users return.
Under User, the Demographics and Tech reports provide insights into your audience characteristics and the technology they use to access your site.
Explorations are GA4’s advanced analysis tool allowing you to create custom reports. Navigate to Explore in the left sidebar and click “Blank” to create a new exploration from scratch.
Choose your technique (free form, funnel analysis, path exploration, segment overlap, cohort exploration, or user lifetime) based on what you want to analyze.
Add dimensions (like page title, source, medium, or event name) and metrics (like users, sessions, conversions, or engagement rate) from the Variables panel. Drag these into your visualization to build your custom report.
Save your exploration by clicking the untitled exploration name at the top and entering a descriptive title. Saved explorations appear in your Explore library for quick access.
Advanced GA4 Features for WordPress
Once you’ve mastered the basics, these advanced features provide even deeper insights.
Setting Up Conversion Tracking
Conversions are the key actions you want users to take on your site. Navigate to Admin > Events and identify events you want to mark as conversions. Common conversions include form submissions, purchases, newsletter signups, and file downloads.
Toggle the “Mark as conversion” switch for relevant events. These conversions will now appear in your acquisition and engagement reports, helping you understand which traffic sources and content drive the most valuable actions.
Creating Audiences for Remarketing
Audiences allow you to segment users based on behavior for remarketing campaigns. Navigate to Admin > Audiences and click “New audience.”
Choose to build a custom audience or use a suggested audience template. For custom audiences, define conditions based on dimensions like page visits, event triggers, user properties, or session duration.
Name your audience descriptively and click “Save.” After creating audiences, you can use them in Google Ads remarketing campaigns to re-engage visitors who didn’t convert.
Linking GA4 with Search Console
Connecting Google Search Console provides valuable organic search data. Navigate to Admin > Product Links > Search Console Links and click “Link.”
Choose your Search Console property from the list (you must have admin access to both properties). Select the web data stream you want to link and click “Submit.”
After linking, you’ll see organic search queries, impressions, and click data in your GA4 acquisition reports, helping you understand which search terms drive traffic to your site.
Setting Up E-commerce Tracking
For WordPress sites using WooCommerce, Easy Digital Downloads, or other e-commerce plugins, e-commerce tracking provides essential revenue insights.
Most major e-commerce plugins offer GA4 integration either natively or through extensions. In WooCommerce, install the “Google Analytics for WooCommerce” plugin by MonsterInsights or similar extensions.
Configure the plugin with your GA4 Measurement ID and enable e-commerce tracking. The plugin will automatically track purchase events, revenue, product views, add-to-cart actions, and checkout steps.
Navigate to Reports > Monetization > Ecommerce purchases in GA4 to view your e-commerce data including total revenue, transactions, average purchase revenue, and products purchased.
Troubleshooting Common GA4 Issues
Even with careful setup, you might encounter issues. Here are solutions to common problems.
Data Not Appearing in Reports
If you’re not seeing any data in GA4 after installation, first verify that your tracking code is installed correctly. Use Google Tag Assistant to check for implementation errors.
Ensure you’re looking at the correct date range in reports. GA4 defaults to the last 7 days, but if you just installed tracking, data will only appear from the installation date forward.
Check that you haven’t accidentally filtered out all traffic with internal traffic filters or other data filters. Navigate to Admin > Data Settings > Data Filters to review active filters.
Confirm that you’re not using ad blockers or privacy extensions that prevent analytics tracking. Test in an incognito window with extensions disabled.
Duplicate Data or Inflated Numbers
Duplicate tracking occurs when you’ve installed the GA4 code multiple times. Check if you have tracking code in both your theme files and a plugin. Remove one instance to prevent double-counting.
Verify that you don’t have both Universal Analytics and GA4 code incorrectly configured. While you can run both simultaneously, improper setup can cause issues.
Check for conflicting plugins. If you’re using multiple analytics plugins, they might interfere with each other. Deactivate all but one analytics plugin.
Events Not Tracking
If custom events aren’t appearing, verify that the event code is implemented correctly. Check your browser’s developer console for JavaScript errors that might prevent event tracking.
Ensure event names follow GA4’s naming conventions. Event names are case-sensitive, must start with a letter, and can only contain letters, numbers, and underscores.
Use the DebugView in GA4 to test events in real-time. Navigate to Admin > DebugView and then trigger events on your site. DebugView shows events as they fire, helping you identify configuration issues.
GA4 Best Practices for WordPress Sites
Following these best practices ensures you get the most value from Google Analytics 4.
Regular Data Audits
Schedule monthly reviews of your GA4 setup to ensure tracking remains accurate. Check that all important events are firing correctly, review your internal traffic filters, and verify that conversion tracking works properly.
Privacy and GDPR Compliance
Configure GA4 to respect user privacy and comply with regulations like GDPR and CCPA. Navigate to Admin > Data Settings > Data Retention and configure how long user-level and event-level data is retained.
Implement a cookie consent banner on your WordPress site using plugins like CookieYes or Complianz. Configure the plugin to prevent GA4 from loading until users accept analytics cookies.
Update your privacy policy to disclose your use of Google Analytics, what data you collect, how you use it, and how users can opt out. Link to your privacy policy in your website footer.
Performance Optimization
GA4 tracking code is lightweight, but improper implementation can affect page speed. Always load the tracking code asynchronously using the async attribute in the script tag.
If you’re using Google Tag Manager to deploy GA4, configure it to load asynchronously and minimize the number of tags that fire on every page load.
Monitor your site’s Core Web Vitals in Google Search Console to ensure analytics tracking doesn’t negatively impact page experience metrics.
Documentation and Team Training
Document your GA4 setup including what events you track, how conversions are defined, and any custom configurations. This documentation helps team members understand the data and makes troubleshooting easier.
Train your team on how to access and interpret GA4 reports. Focus on the reports most relevant to each team member’s role rather than overwhelming them with every available report.
Migrating from Universal Analytics to GA4
If you previously used Universal Analytics, understanding the differences helps you adapt to GA4.
Key Differences Between UA and GA4
GA4 uses an event-based data model instead of the session-based model in Universal Analytics. Every interaction is an event, making the system more flexible but requiring a different analytical approach.
Bounce rate has been replaced with engagement rate in GA4. Engagement rate measures the percentage of engaged sessions (sessions lasting longer than 10 seconds, with a conversion event, or with 2+ page views).
Views and filters work differently in GA4. Instead of multiple views, you create data streams and use data filters. This simplifies administration but requires rethinking how you segment data.
Running Both Platforms Simultaneously
You can run Universal Analytics and GA4 simultaneously during your transition period, though Universal Analytics no longer collects new data as of July 2023.
If you have historical UA data, export important reports and segments before Google deletes your data. Google typically retains UA data for at least six months after data collection stops.
Focus on learning GA4’s interface and reporting capabilities while you still have historical context from UA. This parallel period helps you understand how metrics compare between platforms.
Conclusion
Setting up Google Analytics 4 on your WordPress site is a crucial step toward understanding your audience and growing your website. While the initial setup takes about 15 minutes, taking time to configure advanced features and create custom reports maximizes the value you get from your analytics data.
Start with the basic installation using one of the three methods outlined in this guide. Verify that tracking works correctly, configure essential settings like internal traffic filters, and gradually add custom events and conversions as you become comfortable with the platform.
Remember that analytics is an ongoing process, not a one-time setup. Regularly review your data, test new tracking implementations, and adjust your configuration based on your evolving business needs. With properly configured GA4, you’ll have the insights needed to make informed decisions that grow your WordPress site.
Frequently Asked Questions
Data typically appears in real-time reports within seconds of installation. Standard reports update within 24-48 hours as GA4 processes and aggregates data. If you don’t see data in real-time reports within a few minutes, check your installation.
You could run both simultaneously while Universal Analytics was active, but UA stopped collecting data in July 2023. If you have both tracking codes installed, you should remove the UA code as it no longer functions.
No coding knowledge is required if you use plugins like Site Kit by Google or MonsterInsights. These plugins handle all technical implementation through visual interfaces. Manual installation requires basic HTML knowledge but is generally unnecessary.
Yes, GA4 is completely free for most websites. Google also offers GA4 360, a premium version with higher data limits and additional features, but the standard GA4 platform provides all essential analytics features at no cost.
First, ensure the actions you want to track as conversions are being recorded as events. Then navigate to Admin > Events in your GA4 property and toggle “Mark as conversion” for relevant events. These conversions will then appear throughout your reports.
When implemented correctly using the async script tag, GA4 has minimal impact on page load times. The tracking code is lightweight and loads asynchronously, meaning it doesn’t block other page content from loading. Always test your Core Web Vitals after implementing any tracking code.
GA4 provides highly accurate data, but no analytics platform is 100% perfect. Factors like ad blockers, privacy extensions, cookie restrictions, and sampling in large datasets can affect accuracy. For most websites, GA4 provides reliable insights for making informed decisions.
No, you cannot directly transfer historical data from Universal Analytics to GA4 due to the fundamental differences in data models. You should export important historical reports from UA before Google deletes the data. Moving forward, all new data will be collected in GA4.

