The fastest way to set up GA4 on WordPress is to install Google’s free Site Kit plugin, sign in with Google and connect a Google Analytics 4 property, which places the Google tag on every page for you. If you’d rather not add a plugin, you can paste the gtag.js snippet from your GA4 web data stream right after the opening <head> tag, or deploy it through Google Tag Manager.
This guide walks through all three methods step by step, then covers the settings most site owners skip: data retention, enhanced measurement, key events, consent mode and checking that data is actually arriving. It’s research-based, built from Google’s own help center and developer documentation and the official Site Kit plugin page, not from hands-on testing. Menu names reflect Google’s documentation as of November 2026.
Before you start: what you need
- A Google account with access to Google Analytics. Google Analytics is free for standard properties.
- Admin access to WordPress so you can install plugins or edit your theme’s header.
- A live, public site. Google’s Site Kit instructions say the site should not be in maintenance mode or password-protected during setup.
- A plan for consent. If you have visitors in regions that require cookie consent, decide on a consent banner (CMP) before you go live with tracking.
Step 1: Create a GA4 account, property and web data stream
If you plan to use Site Kit, you can skip ahead: Google’s help center notes that Site Kit can create the account, property and data stream for you during setup. For the manual and Tag Manager methods, create them first, following Google’s Set up Analytics for a website and/or app article:
- Create an account. Go to analytics.google.com. First-time users click Start measuring; otherwise go to Admin > Create > Account. Name the account (agencies usually use the client’s business name) and choose data-sharing settings.
- Create a property. Enter a property name, reporting time zone and currency, then answer the industry, business size and intended-use questions and click Create. New accounts must accept the Terms of Service and Data Processing Amendment.
- Add a web data stream. In Admin, under Data collection and modification, open Data streams > Add stream > Web. Enter your domain and a stream name. Google recommends leaving enhanced measurement turned on. Click Create stream.
- Copy your Measurement ID. Open the stream; under Stream details you’ll see an ID that starts with G-. Keep it handy.
Step 2: Choose how to add GA4 on WordPress
There are three common ways to get the Google tag onto a self-hosted WordPress site. Pick one, and only one: running two methods at once (for example Site Kit plus a pasted snippet) can send duplicate page views and inflate your numbers.
| Method | Cost | Skill level | Best for | Main trade-off |
|---|---|---|---|---|
| Site Kit by Google plugin | Free | Beginner | Most small business sites and bloggers | Adds a plugin; tracking beyond defaults needs other tools |
| Manual gtag.js snippet | Free | Intermediate | Lean sites that avoid extra plugins | Theme changes or updates can remove the code |
| Google Tag Manager | Free | Intermediate to advanced | Agencies, ad-heavy sites, custom event tracking | More setup; one more account to manage |
Method A: Site Kit by Google (easiest)
Site Kit by Google is Google’s official WordPress plugin. Its WordPress.org listing shows more than 5 million active installations, version 1.192.0 at the time of writing, and a commitment that the plugin is free and open source. Besides Analytics, it connects Search Console, AdSense, PageSpeed Insights, Tag Manager and Google Ads, and shows their data inside your WordPress dashboard. Google’s Site Kit setup article lists these steps:
- In WordPress, go to Plugins > Add New, search for “Site Kit”, then install and activate it.
- Click Site Kit in the left menu and tick Connect Google Analytics as part of your setup.
- Click Sign in with Google and choose the Google account that owns (or will own) the Analytics property.
- Grant the requested permissions, click Proceed to verify site ownership and Allow to give Site Kit access to your data.
- Click Add site to add the site to Search Console.
- Click Set up Google Analytics, choose your property (or let Site Kit create one) and click Complete setup.
Two details from the plugin’s FAQ are worth knowing: each WordPress admin who wants to see the dashboards connects their own Google account, and new properties can show a “gathering data” message for a few days. Because Site Kit also brings Search Console data into WordPress, it pairs naturally with an SEO plugin; our Yoast vs Rank Math comparison covers that choice.
Method B: Paste the gtag.js snippet manually
- In GA4, go to Admin > Data streams, click your web stream, then under Google tag choose View tag instructions > Install manually.
- Copy the whole snippet, from
<!-- Google tag (gtag.js) -->through the closing</script>. - Add it so it loads on every page. Google’s instruction is to paste the tag immediately after the opening
<head>element. On WordPress that usually means a child theme’s header, a block theme’s header template, or a trusted “header and footer code” plugin. Avoid editing a parent theme directly, because updates overwrite it. - Clear any page cache so visitors receive the updated HTML. If you’re choosing a cache plugin, see our WP Rocket vs W3 Total Cache breakdown.
One script is light, but every third-party tag adds some load. If you’re working on Core Web Vitals, our guide on how to speed up a WordPress site covers how to keep scripts in check.
Method C: Google Tag Manager
Google’s developer documentation recommends Tag Manager because you can change tracking without editing site code each time. You install the Tag Manager container once (Site Kit can do this too), then add a Google tag with your G- Measurement ID inside Tag Manager and publish the container. This is the best route for agencies that manage ad pixels, form tracking and consent for many clients, but it’s more than a simple blog needs.
Step 3: Confirm GA4 is collecting data
Google says data collection may take up to 30 minutes to begin. To check:
- Realtime report: open your site in another browser or on your phone, then look for your visit in GA4’s Realtime report.
- DebugView: for event-level checks, turn on debug mode with Google Tag Assistant (tagassistant.google.com) or Tag Manager’s preview mode, then open Admin > Data display > DebugView, per Google’s DebugView help page. Google notes events won’t show if consent mode is on and analytics consent hasn’t been granted, so accept your own banner while testing.
Step 4: Change these GA4 settings right after setup
Extend data retention to 14 months
Standard GA4 properties can keep user- and event-level data for 2 months or 14 months, according to Google’s data retention article. Go to Admin > Data settings > Data retention, set Event data retention to 14 months and save. Google says this setting doesn’t affect standard aggregated reports, only explorations and funnel reports, but those are exactly the reports you’ll want for year-over-year analysis. Changes take 24 hours to apply.
Review enhanced measurement
Enhanced measurement collects common interactions without extra code: page views, scrolls (the first time a visitor reaches 90% of a page), outbound link clicks, site search results, YouTube embed engagement, file downloads and form interactions. WordPress search uses the s parameter, which is in Google’s default list, so site search tracking typically works out of the box. Toggle individual events with the gear icon on your web stream’s Enhanced measurement panel. Form events can be noisy on sites with many forms; turn them off if they don’t match real submissions.
Mark your key events
GA4 now calls conversions “key events.” Decide which actions matter (a lead form submission, a thank-you page view, a click to call) and mark them as key events under Admin > Data display > Events. You can also create a new event based on an existing one, for example a page_view where the page location contains “/thank-you/”, and switch on Mark as key event while creating it.
Set up consent mode if you need it
If you show a cookie banner, Google’s consent mode documentation explains how tags adjust to a visitor’s choice. It uses four consent types: ad_storage, analytics_storage, ad_user_data and ad_personalization. A default consent state must be set on every page before the Google tag sends data, then updated when the visitor chooses. Most consent management plugins handle this for you; check that yours supports consent mode before relying on it.
Pros and cons of GA4 on WordPress
Pros
- Free for standard properties
- Official plugin makes setup a few clicks
- Connects with Google Ads, Search Console and Looker Studio
- Enhanced measurement tracks common actions without code
Cons
- Interface has a learning curve
- Uses cookies, so consent banners may be required
- Explorations limited to 14 months of data on standard properties
- Doesn’t show heatmaps or session recordings
Who each setup method is best for
- Site Kit: solo site owners, bloggers and small businesses who want Analytics and Search Console in one place with no code.
- Manual snippet: developers and performance-focused sites that keep plugins to a minimum and use a child theme.
- Tag Manager: agencies and marketers who run ads, track many custom events or manage tags across client sites. Agencies building client reports on top of GA4 may also want to compare AgencyAnalytics vs DashThis.
GA4 tells you what visitors do, not why. Pair it with a behavior tool such as Microsoft Clarity; see our Microsoft Clarity vs Hotjar comparison. And if cookie banners or GA4’s complexity are deal-breakers, read Plausible vs Google Analytics for a cookie-free alternative.
FAQ
Is it free to use GA4 on WordPress?
Yes. Standard Google Analytics properties are free, and the Site Kit plugin is free and open source. Google Analytics 360, the enterprise tier, is paid.
Do I need a plugin to add Google Analytics to WordPress?
No. You can paste the gtag.js snippet into your theme’s head or deploy it via Google Tag Manager. A plugin just makes setup and maintenance easier.
How long until GA4 shows data?
Google says collection can take up to 30 minutes to start, and the Realtime report is the quickest check. Standard reports and Site Kit’s dashboard can take longer to fill in, sometimes a few days.
Where do I find my GA4 Measurement ID?
In GA4, go to Admin > Data collection and modification > Data streams, open your web stream and copy the ID beginning with “G-” under Stream details.
Can I use Site Kit and a manual snippet together?
It’s best not to. Use one method to place the Google tag so each page view is counted once.













