Black Friday · Sale on every paid plan See prices →

StorePinger / Blog

How to add Google Analytics to WordPress in 2026, and what it will not tell a store owner

Last updated: November 4, 2026

Say you have a WooCommerce store, 600 visits a day, and no analytics yet. Learning how to add Google Analytics to WordPress takes about thirty minutes: create a property, copy a Measurement ID that starts with G-, and get the Google tag onto every page through a plugin or by hand. Then the part the tutorials skip: in many regions the tag may not load until the visitor agrees, the purchase event on your thank-you page has to be tested, and Google Analytics 4 (GA4) will never show you yesterday's refunds, your stock or which city your buyers live in. This guide does the setup honestly and ends with the questions GA4 leaves open and the no-cookie way to answer them inside WordPress.

Every step below comes from Google's own instructions or the plugin's own listing, read on November 4, 2026.

Key takeaways

  • You need a GA4 property and its Measurement ID (starts with G-). Everything else is getting that ID onto your pages.
  • Three ways: Google's free Site Kit plugin, the free Google Analytics for WooCommerce extension if you run a store, or pasting the tag yourself.
  • GA4 uses first-party cookies, so where consent rules apply the tag must wait for consent. Install a consent tool first, not later.
  • For a store, test the purchase event with a real order in a private window before trusting any revenue figure.
  • GA4 counts browser events, not orders. Refunds, stock, cities of buyers and live carts live in WordPress, not in GA4.

What do you need before you start?

A Google account, a GA4 property for your site, and the property's Measurement ID. Per Google's instructions, the ID is under Admin, then Data streams, then your web stream, under Stream details, and it starts with G- (or AW- for a Google Ads tag). Copy it once and you can use it with any of the three methods below.

  1. Sign in at analytics.google.com and create an account and a property if you have none.
  2. Add a web data stream for your domain.
  3. Open the stream and copy the Measurement ID.
  4. Decide who else needs access and add them now, so you are not the only login.
  5. Set data retention to 14 months under Admin before any data arrives, because the setting is not applied to data already collected.

If you still have an old property with an ID that starts with UA-, it is a Universal Analytics property and not what you want. The G- ID of a GA4 property is the one every method below needs.

How to add Google Analytics to WordPress with Google's Site Kit plugin

Install Site Kit from the WordPress plugin directory, sign in with the Google account that owns the property, tick Analytics during setup, choose the existing property and click Complete Setup. Site Kit is Google's own plugin, free, with 5+ million active installations per its WordPress.org listing, and it places the tag for you.

  1. In WordPress go to Plugins > Add New and search for Site Kit by Google. Install and activate.
  2. Click Start setup and sign in with Google. Approve the permissions it asks for.
  3. When offered, connect Google Analytics and select your existing property.
  4. Click Complete Setup. The Google tag is now on every page.
  5. Open any page of your site in a private window, then check the Realtime report in GA4 for an active user.

Site Kit asks for permissions on several Google services at once. Read the list before approving and untick anything you do not need. The connection can be changed later from the Site Kit settings page without touching the tag.

Site Kit also connects Search Console, AdSense, PageSpeed Insights, Tag Manager and Google Ads, which is useful if you want them and a distraction if you do not. Connect only Analytics to start.

How to add GA4 to a WooCommerce store with the official extension

Install the free Google Analytics for WooCommerce extension, go to WooCommerce, then Settings, then Integration, then Google Analytics, paste the G- ID, and turn on ecommerce tracking. It sends product views, add to cart, checkout steps and purchases as GA4 events. Do not also add the tag through Site Kit or a theme option, or every purchase is counted twice.

The extension is listed on WordPress.org with 100,000+ active installations and is free. Per its documentation, page views "are not tracked for logged-in admin users", which is why your own test order will not appear unless you log out, and purchase tracking requires a payment gateway that redirects the shopper to the order received page. The same documentation says the extension is integrated with the WP Consent API but "does not provide any UI, like a cookie banner", so a consent tool is still your job. The WooCommerce Analytics vs Google Analytics guide covers what those events do and do not capture.

How to add Google Analytics to WordPress without a plugin

Get the tag snippet from GA4 (Admin, Data streams, your stream, View tag instructions, Install manually) and place it in the head of every page. Google's instruction is to paste the tag "immediately after the <head> on each page of your website". In WordPress the safe place is a child theme's functions file using the wp_head hook, not the parent theme's header file.

The reason is updates. Anything you paste into a theme's header.php is removed the next time the theme updates. A child theme keeps your code. The no-plugin guide has the exact code and the test steps. Use this route only if you are comfortable editing PHP and you have a backup.

Which method should you pick?

A store should use the Google Analytics for WooCommerce extension, because it sends the ecommerce events. A content site should use Site Kit, because it also brings Search Console into the dashboard. Pasting the tag by hand suits people who already maintain a child theme and want no extra plugin. Whichever you choose, use exactly one.

MethodBest forSends WooCommerce events?Survives theme updates?Extra plugin?
Site Kit by GoogleBlogs, brochure sites, anyone who wants Search Console tooNo, page views and standard events onlyYesYes, by Google, free
Google Analytics for WooCommerceStoresYes: product views, add to cart, checkout, purchaseYesYes, by Woo, free
Manual tag in a child themeDevelopers, minimal sitesNo, unless you write the eventsYes, in a child theme. No, in the parent themeNo
A third-party analytics plugin that places the tagPeople who want GA4 reports inside WordPressDepends on the plugin and planYesYes, often paid for ecommerce

One combination to avoid: Site Kit for the tag and the WooCommerce extension for events. Each adds the Google tag, so every page view and every purchase is sent twice. If you want Site Kit's Search Console view and the store events, connect Site Kit without Analytics and let the WooCommerce extension carry the tag.

What about consent and cookies?

GA4's tags use first-party cookies to tell users and sessions apart, per Google's cookie documentation. Where consent rules apply to your visitors, the tag has to wait until the visitor agrees, which means a consent tool must be installed and configured before analytics, not after. Without it the numbers are incomplete and you may have a compliance problem.

The word "consent" covers two separate things. One is the banner the visitor sees. The other is the signal your site sends to Google's tag about what the visitor chose, which Google calls consent mode. A banner without the signal shows a pretty box and still loads the tag. The signal without a banner has nothing to report. You need a plugin that provides both, and you need it before the analytics tag exists on the site, because a tag that loaded once before consent has already set its cookie.

Three practical points:

  • Pick a consent plugin that supports Google's consent mode, so GA4 knows whether the visitor agreed.
  • Expect a share of visitors to decline. Every one of them is a visit GA4 does not see and an order it does not count.
  • Check whether your other scripts, such as ad pixels, also need consent. Usually they do.

A tracker that sets no cookies and keeps data in your own database may not need the same consent setup as GA4, depending on the rules in your visitors’ countries, which is one reason store owners run one alongside GA4. The Google Analytics alternative page explains how that works.

How do you check that it is working?

Open your site in a private window and look for an active user in GA4's Realtime report within a minute. For a store, place a real test order the same way and look for the purchase event with the right value. Standard reports take 24 to 48 hours to fill, so judge the setup by Realtime first.

  1. Private window, so your admin exclusion does not hide you.
  2. Visit three pages. Realtime should show one user and three page views.
  3. Add a product to the cart. Realtime should show an add_to_cart event if the WooCommerce extension is active.
  4. Complete a cheap order with your usual gateway. Look for purchase with the order total.
  5. If purchase is missing, check for a cached thank-you page, a gateway that returns by webhook without sending the shopper back, or a consent setting that blocked the event.
  6. If purchase appears twice, you have two tags. Remove one and test again.

How do you read the first week of data?

Ignore the first two days, then read three reports: Realtime for a sanity check, Acquisition for where visitors came from, and the Monetization report for purchase events if the WooCommerce extension is active. Compare GA4's purchase count with WooCommerce's paid orders for the same days and write the ratio down.

A worked example, not a customer result. In the first full week GA4 shows 3,800 users, 4,900 sessions and 62 purchases. WooCommerce Analytics shows 78 paid orders. The ratio is 62 divided by 78, or about 0.79. That ratio is now your baseline. If it drops to 0.5 next month, a plugin update broke the purchase event or a consent change blocked more visitors. If it climbs past 1.0, the tag is doubled. The absolute GA4 numbers are less useful than that ratio, which is why the comparison guide spends so long on it.

What will Google Analytics not tell a store owner?

GA4 counts events sent from browsers. It will not show refunds, order statuses, stock, coupon costs or the exact revenue your accountant sees, and it loses every visitor who declined cookies or blocked the script. It also keeps event data for only 2 or 14 months on standard properties, per Google's retention settings. A store needs a second set of numbers from its own database.

QuestionGA4Where the answer lives
How many orders and how much net revenue yesterday?Approximate, minus untracked shoppersWooCommerce Analytics (exact)
What was refunded?No, unless you send refund eventsWooCommerce orders
Which city do my buyers live in?City of the visit, aggregated, if trackedBilling and shipping addresses in orders. StorePinger's sales by city
Who is on the store right now with a cart?Active users, no cartLive visitors
Which carts were abandoned, and can I email them?NoCart recovery
Which channel brought paid orders?Yes, for tracked shoppers, outside WordPressOrder Attribution, sales by source
Did ChatGPT send buyers?Yes, an AI Assistant channelStorePinger names AI tools as a source in WordPress

A worked example, not a customer result. A store takes 100 orders in a week. Fifteen shoppers declined cookies, five used an ad blocker and two paid by bank redirect without returning. GA4 shows 78 purchases. WooCommerce shows 100. Neither is wrong. The 22-order gap is why the ad budget should be set on shares in GA4 and on totals in WooCommerce, never the reverse.

What is replacing Google Analytics for WordPress stores?

For ad attribution, nothing yet, because the ad platforms are built around it. For the daily dashboard, analytics plugins that run inside WordPress, store data in your own database and read orders directly are replacing it. They need no consent banner for the tracker, show live visitors with carts, and put sales next to traffic. StorePinger is one. Others as of November 2026 include Independent Analytics, Burst Statistics and Koko Analytics, each with a different scope.

What makes the in-WordPress category different is not the charts. It is where the data lives and what it is joined to. A plugin in your database can put yesterday's refunds next to yesterday's visits, show the city of the buyer from the shipping address rather than from an IP guess, and list the carts that were left with their value. GA4 cannot do any of that, because it never sees your orders table. The two tools are not rivals for the same job. They are two jobs.

The honest position for most stores is both: GA4 for Google Ads and for multi-visit paths, and an in-WordPress plugin for the questions in the table above. StorePinger's free plan covers live visitors, the world map, visitors by country, today's visitors and page views. Pro adds traffic sources including AI tools, sales by source, the conversion funnel, session recordings stored on your own hosting, cart recovery and reports. No cookies are set by its tracker, IP addresses are not stored, and nothing about your visitors is sent to StorePinger.

Common mistakes

  • Two tags. Site Kit plus a theme option plus the WooCommerce extension is three copies of the same tag and three purchase events per order. Pick one.
  • Pasting into header.php. The next theme update deletes it. Use a child theme or a plugin.
  • Testing while logged in. Admin visits are excluded by default. Use a private window.
  • Installing consent after analytics. Do it first.
  • Trusting GA4 revenue. It is a sample of tracked shoppers. Use WooCommerce for totals.
  • Forgetting data retention. Standard properties keep event data for 2 or 14 months. Set it to 14 on day one.
  • Reading GA4 daily. It is a weekly tool. The sales report email covers the daily check.

Conclusion

Adding Google Analytics to WordPress is a Measurement ID and one of three delivery methods: Site Kit, the WooCommerce extension, or a few lines in a child theme. Doing it well is the consent tool first, one tag only, and a real test order before you believe a number. Doing it honestly means knowing what GA4 is for. It is the map of how people found you and the feed for your ad accounts. It is not the ledger, not the live view and not the cart list. Set it up this afternoon, then open the StorePinger features page to see the questions it cannot answer being answered inside your WordPress dashboard, starting with the free live visitors view.

FAQ

Frequently asked questions

How do I add Google Analytics to WordPress without a plugin?

Copy the Google tag snippet from GA4 under Admin, Data streams, your web stream, View tag instructions, Install manually. Google says to paste it immediately after the head tag on every page. In WordPress the safe way is a few lines in a child theme's functions file on the wp_head hook, because code pasted into the parent theme's header file is removed on the next theme update.

How do I set up GA4 on WordPress?

Create a GA4 property at analytics.google.com, add a web data stream and copy the Measurement ID that starts with G-. Then install Site Kit by Google and connect Analytics, or for a store install the free Google Analytics for WooCommerce extension and paste the ID under WooCommerce, Settings, Integration. Install a consent tool first and test in a private window.

Is Google Analytics free for WordPress?

Yes. GA4 has a free tier, Site Kit by Google is free and open source with 5+ million active installations, and the Google Analytics for WooCommerce extension is free with 100,000+ active installations as of November 2026. Paid add-ons exist, including Google Analytics Pro for WooCommerce at $79 per year on woocommerce.com, but most stores do not need them.

Why is Google Analytics not tracking my WooCommerce purchases?

The official extension's documentation says purchase tracking requires a gateway that redirects the shopper to the order received page, and that page views are not tracked for logged-in admins. Other common causes are a cached thank-you page, a consent setting that blocked the event, or a second copy of the tag causing doubles. Test with a real order in a private window.

Do I need a cookie banner for Google Analytics on WordPress?

GA4's tags use first-party cookies per Google's documentation, so where consent rules apply to your visitors the tag must wait for consent. The WooCommerce extension works with the WP Consent API but provides no banner of its own. Install a consent plugin that supports Google consent mode before you add analytics, and expect some visitors to decline.

How long does Google Analytics keep my data?

For standard GA4 properties, Google's retention settings offer 2 months or 14 months for event data. Longer options of 26, 38 and 50 months are only for paid 360 properties. Set it to 14 months when you create the property, because the setting is not retroactive and the default is the shorter option for many properties.

What is replacing Google Analytics for store owners?

For ad attribution nothing has replaced it yet. For the daily dashboard, in-WordPress analytics plugins that store data in your own database and read orders directly are replacing it, because they show live visitors with carts, sales next to traffic and need no banner for the tracker. StorePinger, Independent Analytics, Burst Statistics and Koko Analytics are examples as of November 2026.

Can I use Google Analytics and a WordPress analytics plugin together?

Yes, and most stores that advertise should. Keep GA4 for Google Ads and multi-visit paths, and use the in-WordPress plugin for live visitors, sales by source, refunds, cities and cart recovery. The two will not agree on totals because GA4 only counts tracked shoppers, so compare shares in GA4 and totals in WooCommerce.

See every visitor. Feel every sale.

Start free with live visitors, or get every feature with Pro.

See plansStart free