How to Set Up Google Analytics for WordPress
If you want to set up Google Analytics on your WordPress site, the fastest and most reliable method is to create a Google Analytics 4 (GA4) property, get your Measurement ID, and connect it to WordPress through a tracking plugin such as Site Kit by Google or a header and footer scripts plugin. Once connected, your site will start sending visitor data to Google Analytics within a few hours, giving you visibility into traffic sources, page views, and visitor behavior without touching a line of code.
This guide walks through the entire process step by step, so even if you have used Google Analytics before but never connected it to a WordPress site, you will be able to follow along and get your tracking live today.
Why Set Up Google Analytics On Your WordPress Site?
Google Analytics tells you who is visiting your website, where they came from, what pages they viewed, and how long they stayed. For a small business running on WordPress, this data answers practical questions like:
- Which blog posts or pages are driving the most traffic
- Whether visitors are coming from search, social media, or referrals
- Which pages people leave from quickly, which may signal a problem
- How mobile visitors behave compared to desktop visitors
Without this data, you are guessing about what is working on your site. For a deeper look at how this data supports your broader marketing decisions, our guide on using Google Analytics for your SEO strategy breaks down how to turn these numbers into action.
Step 1: Create A Google Analytics 4 Property
- Go to analytics.google.com and sign in with a Google account.
- Click Admin in the bottom left corner, then click Create Account under the Account column (or select an existing account).
- Under the Property column, click Create Property.
- Enter your website name, time zone, and currency, then click Next.
- Fill in basic business details, click Create, and accept the Terms of Service.
Google will generate a new GA4 property for your website, but it is not connected to WordPress yet.
Step 2: Set Up A Data Stream And Find Your Measurement ID
- Inside your new property, click Data Streams.
- Click Add Stream and choose Web.
- Enter your website URL and a stream name, then click Create Stream.
- Google will show you a Measurement ID, which starts with “G-” followed by a string of letters and numbers.
Copy this Measurement ID. This is what actually connects your WordPress site to your Analytics account, so keep the tab open or paste it somewhere you can find it in the next step.
Step 3: Connect Google Analytics To WordPress
You have two main options for connecting your Measurement ID to WordPress. Both work well, so pick whichever fits your comfort level.
Option A: Use a plugin (recommended)
- From your WordPress dashboard, go to Plugins > Add New.
- Search for “Site Kit by Google” and click Install, then Activate.
- Follow the setup wizard and sign in with the same Google account used to create your Analytics property.
- When prompted, select the GA4 property you created in Step 1.
- Site Kit will automatically insert the tracking code into your site.

Option B: Add the tracking code manually
- Install a plugin such as “Insert Headers and Footers,” or use your theme’s built-in header script option.
- Copy the Global Site Tag snippet from your Analytics property and paste it into the header script section so it loads on every page.
- Save your changes.
If you already use Google Tag Manager, you can route your GA4 tag through Tag Manager instead of pasting code directly. Our walkthrough on setting up Google Tag Manager for WordPress covers when this makes sense for a small business.
Step 4: Confirm Google Analytics Is Tracking Correctly
Once the tracking code is live, confirm it is actually working before you move on.
- Open your website in a new browser tab or private window and browse a few pages.
- Go back to Google Analytics and click Reports > Realtime.
- You should see your visit appear within a minute or two, showing your active page and location.
If nothing shows up, double check that the Measurement ID matches, the tracking plugin is activated, and no caching plugin or ad blocker is stripping the script.

A Note On Universal Analytics vs GA4
If you set up Google Analytics on an older website years ago, you may have used Universal Analytics, which Google has since retired in favor of GA4. If you are starting fresh today, GA4 is your only option, and the steps above already reflect that. If you are migrating an older site, our comparison of Universal Analytics vs Google Analytics 4 explains what changed.
Frequently Asked Questions
No. Using a plugin like Site Kit by Google handles the technical connection for you, so no coding knowledge is required.
Realtime data appears within minutes. Full reports, such as audience and traffic source breakdowns, typically take 24 to 48 hours to populate.
Yes. Many site owners route their GA4 tag through Tag Manager so they can manage multiple tracking tools from one place without editing site code each time.
Yes, Site Kit by Google is a free official WordPress plugin that connects several Google tools, including Analytics, Search Console, and AdSense, directly to your dashboard.
Get Help Setting Up Google Analytics The Right Way
Setting up Google Analytics is only useful if it is configured correctly from day one. A wrong Measurement ID, duplicate tracking code, or missed data stream can leave you with incomplete data for months. If you would rather have this set up correctly the first time, our team can handle your WordPress setup and analytics configuration for you.
