Choose a language

Laptop showing an abstract analytics dashboard on a desk

How to Add GA4 to WordPress Without Duplicate Tracking

Published November 5, 2026 · Mis à jour le November 16, 2026 · 15 min read

The reason your GA4 numbers look inflated is almost always the same: two things are firing the same Measurement ID. A plugin adds the Google tag, and a snippet you pasted into your theme header adds it again, so every pageview is counted twice. Fixing it takes three moves: pick exactly one delivery method, remove what you had before, then verify with Tag Assistant that the tag fires once.

This guide walks through creating your GA4 account and web data stream, compares the four install routes (Site Kit, a GA4 plugin, a hardcoded Google tag, and Google Tag Manager), and ends each route with a one-tag verification test. Nothing here covers report reading or BigQuery exports, the goal is clean collection first.

The path in 6 steps

The steps of this page, in order.

  1. 01 Create the property Set up your GA4 account and web data stream, then copy the G-XXXXXXXXXX Measurement ID.
  2. 02 Pick one route Choose Site Kit, a GA4 plugin, a hardcoded Google tag, or GTM, not two of them.
  3. 03 Remove the old tag Deactivate the previous plugin or delete the header snippet so nothing double-fires.
  4. 04 Place the new tag Follow the exact placement steps for the route you chose.
  5. 05 Verify a single fire Use Tag Assistant and GA4 Realtime to confirm one tag fire per page load.
  6. 06 Filter and consent Exclude logged-in admins and editors, and check that your banner talks to Consent Mode.

01 / 11

How do I create a GA4 property and get my Measurement ID?

You create one account, one property, one web data stream, and Google hands you a Measurement ID that starts with G-.

Start at analytics.google.com: create an account for your business, then a property inside it, then a Web data stream for your domain. The stream is what generates the G-XXXXXXXXXX Measurement ID, that ID is the only thing every install route below needs, so copy it into a note before you close the screen. If you later paste a different ID into a plugin than the one in your theme, you are looking at two properties, not one.

Leave Enhanced Measurement switched on unless you have a reason not to: it collects pageviews, scrolls, outbound clicks, and video plays without extra code. One property, one stream, one ID, keep that chain intact from here on.

  1. Create the account

    Sign in to Google Analytics, click Admin, then Create account. Name it after your business and set your data-sharing preferences.

  2. Create the property

    Inside the account, choose Create property. Set your reporting time zone and currency, then answer the industry and business-size questions.

  3. Create the Web data stream

    Choose Web, enter your site URL and a stream name such as your domain. The stream appears under Data streams.

  4. Review Enhanced Measurement

    Leave it on to capture pageviews, scrolls, outbound clicks, and video plays. You can switch individual events off later.

  5. Copy the Measurement ID

    In the Web stream details, find the Measurement ID that starts with G-. Save it where you keep site credentials, you will type it into one install method only.

Going further

How GA4 differs

02 / 11

Which install method should I use on WordPress?

Pick the route that matches what you want to run later, and choose only one.

Think in terms of what you want to run later. Site Kit, Google's own connector, keeps a free, official link between your site and your GA4 property, but it won't manage an ads stack. A GA4 plugin puts a settings screen and basic dashboards inside wp-admin, which suits owners who dislike hopping between tabs.

The hardcoded Google tag fits a child theme and no plugin appetite; Google Tag Manager (GTM), a container that fires tags from one snippet, fits anyone adding ads, pixels or event tags later. Whichever you choose, switch the other three off, that is what keeps counting single.

Install method: cost, effort, and who it fits

MethodTypical costSetup effortChoose this ifWhat it blocks later
Site Kit (Google connector)FreeLow, connect your Google accountYou want an official, free link and no ads stackComplex ad, pixel and event tag setups
GA4 pluginFree core; paid tiers per site, see the vendor's pricing pageLow, paste Measurement ID in a settings fieldYou want a wp-admin settings screen and basic dashboardsNothing major, but heavy tag logic
Hardcoded Google tagFreeMedium, edit functions.php in a child theme; editing the parent theme risks losing changes on updateYou have a child theme and no plugin appetiteNon-developers changing tags later
Google Tag ManagerFreeMedium, add one container snippet, then configure tags in the GTM UIYou will add ads, pixels or event tags laterNothing; it is the most flexible, but the most to learn

Plugin prices change: confirm the current figure on the vendor's pricing page before you buy.

03 / 11

What should I do before I install anything?

The most important step on this page comes before installation: find out what is already tracking your site.

Open Plugins and note every analytics or tag-management tool that is active. Then check your theme's header.php and any header/footer code plugin for a Google tag snippet, the script that carries your Measurement ID. If you find both a plugin and a snippet, you already have duplicate tracking, so remove one setup before you add another.

You need an administrator login on WordPress and edit access to your GA4 property. Write down what you will delete first, so a plugin tag and a hardcoded tag never fire together.

Plugin present?

List every active analytics or tag-manager plugin.

Snippet present?

Search header.php and your header/footer code plugin for a Google tag.

Theme file checked?

Confirm whether the tag lives in the theme and will survive an update.

GA4 access ready?

Sign in to the GA4 property with edit rights before you change anything.

04 / 11

Where exactly does the tag go in each method?

Each route has one correct placement, and one place where a second tag usually sneaks in.

With Site Kit or a GA4 plugin, you paste or select the Measurement ID in the plugin's own settings screen and let it insert the tag. Never also paste the snippet into your theme, that is where the second tag sneaks in. For the manual Google tag, add the gtag.js snippet through a wp_head hook in a child theme or a code-snippets plugin, not directly in header.php.

Already double-tracking? Capture the current Measurement ID first. Deactivate the plugin OR remove the hardcoded snippet, never both at once. Clear your cache, then re-verify. A plugin tag and a hardcoded tag must never coexist.

Diagram of three ways to install analytics: plugin, tag manager or code

Going further

Migrating a double setup

05 / 11

How do I prove only one tag is firing?

Load one page with Tag Assistant open and watch how many times your Measurement ID appears, one is correct, two means trouble.

Tag Assistant records every tag that fires on a page load. You want exactly one Google tag carrying your G-XXXXXXXXXX Measurement ID (the identifier GA4 assigns to your data stream). Two entries mean a plugin tag and a hardcoded tag are both active.

GA4 Realtime is your second check. Open your site in another tab, load a page, and confirm a single page_view event lands, not two. Repeat on a post or product page, since a sitewide plugin and a theme-only snippet can behave differently.

Tag Assistant first

Open Tag Assistant in Chrome, load one page, and count how many times your G-XXXXXXXXXX Measurement ID appears. One is correct; two means duplicate tracking.

Then GA4 Realtime

Open your site in a second tab and load a page. In GA4 Realtime, confirm a single page_view event appears for that visit rather than a doubled count.

Run it on multiple templates

Check the homepage, a post, and a product page. A plugin may load sitewide while a snippet loads only on the theme template, so different templates can show different tag counts.

Clear cache, then repeat

Clear your caching layer before retesting. A cached page can keep serving old tags and hide the fix you just made.

Two people reviewing a site admin dashboard on a laptop

06 / 11

Why are my pageviews still doubled?

Match the symptom to the cause, most duplicate tracking traces back to four common mistakes.

A plugin tag and a hardcoded Google tag both load gtag.js, and they fire the same Measurement ID, that is the classic failure mode. Disable one, then confirm in the page source that only one gtag.js request carries your ID.

Watch for a plugin installed twice, a snippet plugin duplicating a theme hook, a cache or staging copy serving a tracked page, or a GTM container that also holds a GA4 tag left over from a migration. If you later consolidate into GTM, GA4 must live in one place only.

Symptom-to-cause troubleshooting

SymptomLikely causeFirst check
Doubled pageviewsPlugin tag and header snippet both load gtag.js with the same IDView page source; count gtag.js loads
Doubled eventsGA4 tag fires twice inside one container, or two containers on the pageOpen Tag Assistant; list every GA4 tag firing
Only some pages doubledA staging or cached copy serves the tracked page with the tag still activeCompare a live page and a staging URL side by side

Illustrative troubleshooting map; causes are common patterns, not measured prevalence.

Going further

Later, with GTM?

08 / 11

Do I need to pay a plugin or hire someone?

Site Kit is free, a premium plugin costs from about $99 a year (Analytify StartUp, two sites, October 2026 price), and hiring someone is only worth it if you're adding a tag manager or custom events.

Site Kit is free and inserts the Google tag for you, which covers most blogs and small stores. Paid GA4 plugins usually bill annually per site, so treat any quote as an order of magnitude rather than a fixed rate.

Hiring help pays off when you stack a tag manager container, ad pixels, or WooCommerce ecommerce events on top. A single hardcoded tag in a child theme stays a do-it-yourself job.

Worked example

Cost breakdown: free vs. paid plugin vs. one-off setup help

Free route
Site Kit plugin, $0
Paid route
premium plugin, e.g. Analytify StartUp at $99/year for two sites (vendor price, October 2026)
Do-it-yourself tag in a child theme
one evening of your time, $0 in licenses
  1. Site Kit for one year$0

    0 × 12

    The plugin inserts the Google tag for you. Free is enough when you only need pageviews.

  2. Paid plugin for one year$99/year

    100 + 0

    Analytify StartUp price published by the vendor in October 2026; other plugins differ.

  3. One-off setup helpyour quote + $99/year

    one project + 100 + 0

    Worth it when you add a tag manager container, ad pixels, or WooCommerce ecommerce events.

What this result assumes
  • The vendor's price page must be checked on the day you buy; license terms and site limits vary by plugin.
  • Setup help is quoted per project, so it is not a recurring cost.

09 / 11

So which setup should I lock in?

Choose one method, remove every other, verify a single tag fire, and only then start reading your reports.

For a blog or content site, Site Kit or a GA4 plugin covers pageviews with logged-in admins excluded. A WooCommerce store needs a plugin that sends ecommerce events, or GTM if you will add ads and pixels. If a tag manager is in your future, install nothing extra now and start from the GTM guides instead.

Whichever you pick, end with one test: load a page with Google Tag Assistant or GA4 Realtime and confirm exactly one tag fires. That single check is what makes the reports trustworthy.

One method chosen

Pick exactly one delivery path: Site Kit, a GA4 plugin, or GTM. Never leave a plugin tag and a hardcoded Google tag active together.

Old tag removed

Delete any hardcoded gtag.js snippet or duplicate plugin tag from your theme, header, or another plugin. Confirm no second Measurement ID is loaded.

Single fire verified

Use Google Tag Assistant or GA4 Realtime on a test page. You should see one page_view per load, not two. Test a second page.

If you serve EU or UK visitors, set up a consent banner and Consent Mode so GA4 respects the choice. Check Google's official consent help page for current setup steps.

10 / 11

Frequently asked questions

Frequently asked questions

11 / 11

Sources, data and disclaimer

The Web Insider editorial team
About the author The Web Insider editorial team

Web Insider is a practical magazine for people who build, run or grow a website. Every fact is checked against its official source, and every test shows its proof.

Your feedback

Was this page helpful?

Share

Could this page help someone?

Related reading

Read next

Analyst reviewing tag routing on a large wall screen
Websites & Platforms

GTM on WordPress: Install It Without Skewing Data

A non-commercial walkthrough to get your GTM container live on WordPress in under 30 minutes. The real work is data integrity: one method, no duplicate tags, verified before publish.

·16 min
Two colleagues arranging blank planning cards on a dark wall board
Websites & Platforms

How to Organize a WordPress Site So It Stays Easy to Run

A practical system for solo owners and small teams who need their WordPress site to stay manageable as it grows. Pages vs posts, taxonomy, media, roles, and maintenance routines.

·16 min
Two colleagues reviewing a website admin screen on a large monitor
Websites & Platforms

WordPress Admin: How to Log In and Manage Your Site Safely

The WordPress admin lives at yourdomain.com/wp-admin on self-hosted sites, and behind the WordPress.com dashboard on hosted ones. Here is how to log in safely, find your way around, and recover access when something breaks.

·16 min
E-commerce team checking store tracking on a laptop
Websites & Platforms

Google Tag Manager on PrestaShop: What to Check

GTM on PrestaShop only works when the container loads everywhere and a data layer feeds it real order values. Here is the order to check things so you find what is broken.

·17 min
Small web team working together at a desk with a website on screen
Websites & Platforms

WordPress Cron Jobs: Fix Missed Schedules

WP-Cron is not a real scheduler: it checks for due tasks on every page load. Here is how it works, why tasks run late, and how to make them reliable.

·15 min
E-commerce team checking store tracking on a laptop
Websites & Platforms

Google Tag Manager on Shopify: Go-Live Checklist

Shopify's checkout upgrade replaced the old thank-you page scripts with custom web pixels. Before you add GTM, confirm which install route fits your store and audit for duplicate tracking.

·19 min
Explore the topicData & Analytics

Audience measurement, Google Analytics 4 and Google Tag Manager: set them up, check them and keep your data reliable.

Explore the topicWebsites & Platforms

WordPress, Shopify, PrestaShop and WooCommerce: run, integrate and maintain a site without making it fragile.

Explore the topicGuides & How-Tos

Methods, training and practical benchmarks to scope a web project, test a site and make better decisions.

Explore the topicSecurity & Compliance

Backups, updates, GDPR, cookies and audience measurement: keep a site safe and compliant.