How to Add Google Analytics 4 to WordPress (2026 Guide)

· first published 2021 · canyonthemes

Add Google Analytics

You cannot improve a website you cannot measure. Comments and social replies tell you what a handful of vocal readers think; analytics tells you what everyone actually does: which posts get read, where visitors come from, what device they use and where they leave. Google Analytics remains the most widely used free tool for this, and connecting it to WordPress takes about fifteen minutes.

One important update: the version many older tutorials describe, Universal Analytics, stopped processing data on 1 July 2023 and its properties have since been deleted. The current version is Google Analytics 4 (GA4). Everything below refers to GA4.

Last updated: 2026. Tested with WordPress 6.8 and Site Kit by Google.

Steps on adding Google Analytics to your WordPress website

There are four steps: create a GA4 property, choose how you will connect it (plugin or manual tag), complete the connection, and verify data is flowing. Pick one connection method; installing the tag twice inflates every number you see.

1. Sign up for Google Analytics and create a GA4 property

Sign in to analytics.google.com with a Google account. Use an account you control long-term rather than a freelancer’s or a temporary address, because access to historic data lives with that account. Click Start measuring, name the account (your company or your name), then create a property named after the website. An account can hold several properties, so a clear name saves confusion later.

Set the reporting time zone and currency to match your business, answer the short business-details questions, then under Data collection choose Web. Enter your URL and a stream name. GA4 creates a web data stream and shows a Measurement ID in the format G-XXXXXXXXXX. Copy it; this is what WordPress needs. Leave Enhanced measurement switched on: it records scrolls, outbound clicks, site search and file downloads without extra setup.

2. Choose a Google Analytics plugin (or go manual)

You have three sound options:

  • Site Kit by Google (free, official). Connects Analytics, Search Console, PageSpeed Insights and AdSense, and shows a summary inside the WordPress dashboard. The best default for most sites.
  • MonsterInsights, ExactMetrics or Analytify. Third-party plugins with richer in-dashboard reports and e-commerce tracking; free tiers exist, with paid upgrades for advanced reports.
  • Manual tag. Paste the GA4 snippet into your site header. No plugin, no dashboard reports, but zero overhead. Works with any theme that has a header-scripts option or via a small “insert headers” plugin such as WPCode.

Whichever you choose, check the plugin’s last-updated date and that it declares compatibility with your WordPress version. Analytics plugins load on every page view, so a neglected one is both a performance and a security risk. Our Top Google Analytics Plugins for WordPress post compares the current options in more depth.

3. Integrate Google Analytics with your website

With Site Kit: install and activate it from Plugins > Add New. Click Start setup, sign in with the same Google account that owns the GA4 property, and grant the requested permissions. Site Kit verifies site ownership and connects Search Console first. Back in the dashboard, open Site Kit > Settings > Connect more services and choose Analytics. Select your account, property and web data stream from the dropdowns and click Configure Analytics. Site Kit inserts the tag for you; do not paste it anywhere else.

Manually: in GA4 go to Admin > Data streams > your stream > View tag instructions > Install manually and copy the snippet. Paste it into your theme’s header-scripts field (in Canyon themes this is under Appearance > Customize > Header Scripts) or into WPCode’s Header box. Never paste it directly into header.php of a theme you did not build; the next theme update will erase it.

If your audience includes EU or UK visitors, connect a consent banner (Complianz, CookieYes, or the consent mode built into your analytics plugin) so the tag respects the visitor’s choice. GA4 supports Consent Mode v2 and most current plugins handle it automatically.

4. Begin analyzing the data of your website

Verify immediately rather than waiting a day. In GA4 open Reports > Realtime, then load your site in a private browser window. Your visit should appear within a minute. If it does not, check that the Measurement ID matches, that no caching plugin is serving an old page, and that an ad blocker is not stripping the tag in your test browser.

Standard reports fill in over 24–48 hours. Start with three: Acquisition > Traffic acquisition (where visitors come from), Engagement > Pages and screens (what they read), and Tech > Overview (device and browser split, useful when checking how your theme behaves on mobile). GA4 reports on events rather than the old pageviews-and-sessions model, so expect the numbers to differ from what you remember in Universal Analytics. Add Search Console linking in Site Kit to see the queries that bring you organic traffic alongside the pages they land on.

Which Canyon theme fits

Every Canyon theme has a Customizer field for header scripts, so the manual method above works without touching template files. If you are building a content site and want clean post templates for engagement tracking, look at Bloge for blogs or News One for multi-category magazine layouts.

Summary

Create a GA4 property, copy the G- Measurement ID, connect it once through Site Kit or a header snippet, and confirm in Realtime. From there, review Traffic acquisition and Pages reports monthly and adjust your content plan on what readers actually do rather than what you assume.

FAQ

Is Universal Analytics still available?
No. Universal Analytics stopped collecting data on 1 July 2023 and Google has since removed the properties and their historic data. Any tutorial that mentions a UA- tracking ID or ‘Create a Universal Analytics property’ is out of date; use a GA4 property with a G- Measurement ID.
Do I need a plugin to add Google Analytics to WordPress?
No. You can paste the GA4 snippet into your theme’s header-scripts option or use a lightweight header-insertion plugin. A plugin like Site Kit adds convenience, dashboard reports and Search Console linking, but the tracking itself is identical.
Why does Google Analytics show no data?
Common causes are a mismatched Measurement ID, a caching plugin serving pages generated before the tag was added, an ad blocker in your test browser, or a consent banner blocking the tag until the visitor accepts. Check Reports > Realtime in a private window after clearing the cache.