How to Add Analytics to WordPress (Free Plugin, No Code)

Jamal Brooks·10 min read

Key Takeaways

  • You can add analytics to WordPress in about ten minutes with a free plugin and no code: install, connect a measurement ID, publish, and confirm the tracking tag fires.
  • A plugin is the safest install method for most sites because it survives theme updates, unlike pasting a script into a theme file that gets wiped on the next update.
  • Track four things that actually matter on a WordPress site: traffic sources, top content, on-site actions (form submits, add-to-cart, link clicks), and the checkout or signup that turns a visit into money.
  • Page-view analytics tells you what people looked at, but not which visit paid you; last-click tools lose paid and organic sales to cookie loss and iOS privacy, so the sale files under direct.
  • The modern best practice is first-party, revenue-attached tracking: capture the source on your own domain at click time and stamp it onto the settled Stripe sale, so your numbers survive cookie loss, iOS privacy, and data retention.

To add analytics to WordPress, install a free analytics plugin from your admin dashboard, connect it to a measurement ID, publish any page, and confirm the tracking tag fires in your real-time report. The whole thing takes about ten minutes and needs no code. A plugin is the right method for most sites because it re-injects the snippet on every page and survives theme updates, which a script pasted into a theme file does not.

This guide walks the full setup, shows exactly what to track on a WordPress site, and explains why counting page views is only half the job. The number that decides whether your marketing works is not traffic, it is which visit turned into a paid order, and standard analytics loses that thread the moment a cookie expires.

Why use a plugin instead of pasting code

Use a plugin because it survives updates and needs no code. When you paste a tracking script into your theme's header.php or footer.php file, it works until the next theme update overwrites those files and silently deletes your tag. You then lose data for weeks before you notice the graph flatlined. A plugin stores the snippet in the database and re-adds it on every page load, independent of the theme, so an update never breaks tracking.

There are three no-code ways to add a tag, in order of how much control they give you:

  • A dedicated analytics plugin. Simplest path. You enter a measurement ID, it handles the rest. Good when you need only one analytics tool.

  • A tag-manager plugin. You install one container, then add and edit every future tag from a dashboard without touching WordPress again. Better when you expect to add ad pixels, heatmaps, or conversion tags later.

  • A code-snippets plugin. Lets you paste a raw snippet into a box that survives updates, without editing theme files. Use only when a tool has no plugin of its own.


For most creators and small businesses, a dedicated analytics or tag-manager plugin covers everything. Editing theme files should be your last resort, and if you do it, use a child theme so an update leaves your changes alone.

How to add analytics to WordPress step by step

Follow these steps to go from zero tracking to verified data in about ten minutes. The exact plugin name varies, but every no-code analytics plugin follows this same shape, so the steps transfer no matter which one you pick.

Get your measurement ID first. Create a property for your site and copy its measurement or site ID. For Google Analytics 4 this starts with G-. For most privacy-focused tools it is your domain or a short site key. Keep this tab open, you will paste the ID in a moment.

Install the plugin from the WordPress admin. In your dashboard go to Plugins, then Add New. Search for your analytics tool by name, click Install Now on the official plugin, then click Activate. You never download or upload a file by hand, WordPress fetches it for you.

Connect the plugin to your ID. After activation, a new settings page appears, usually under Settings or its own menu. Open it, paste in the measurement ID you copied, and save. Some plugins offer a one-click sign-in that pulls the property in automatically, which avoids copy-paste mistakes.

Enable enhanced or event tracking if the plugin offers it. Many plugins have a toggle for outbound link clicks, file downloads, scroll depth, and form submissions. Turn these on now. They cost nothing and give you the on-site actions you will want later.

Publish or refresh a page, then verify the tag fires. This is the step people skip and regret. Open your real-time report, then visit your own site in a separate tab. Within a few seconds you should see one active visitor, yourself. If you do not, the ID is wrong, a caching plugin is stripping the script, or an ad blocker is hiding you, try an incognito window with blockers off.

Wait 24 to 48 hours before judging anything. Analytics needs a day or two to collect a baseline, so do not draw conclusions from the first afternoon of data. Once numbers accumulate, move on to deciding what actually matters.

What to track on a WordPress site

Track four categories: where traffic comes from, what content holds attention, what actions people take, and what turns a visit into money. Vanity metrics like raw page views feel good but rarely change a decision. The table below maps each metric to why it matters, so you measure things that lead to action.

MetricWhat it tells youWhy it matters
Traffic sourcesWhich channels send visitors (search, social, email, ads, referral)Tells you where to spend time and budget; a channel that sends traffic but no buyers is a trap
Top landing pagesWhich pages people arrive on firstShows what content is winning search and social so you can make more of it
Bounce or engagement rateWhether arrivals stay and interact or leave immediatelyA high bounce on a key page signals slow load, weak headline, or mismatched intent
On-site eventsClicks, form submits, add-to-cart, downloads, video playsThese are the micro-conversions that predict a sale; a drop here explains a drop in revenue
Checkout or signup startsHow many people begin the money stepThe gap between starts and completions is usually your single most expensive leak
Completed conversionsPaid orders, subscriptions, or qualified signupsThe only metric that pays your bills; everything else is a leading indicator of this one
Revenue by sourceWhich channel produced real, non-refunded moneyThe number that decides your marketing budget, and the one standard analytics gets wrong most often

The first six rows come out of the box or with a toggle. The last row, revenue by source, is where nearly every WordPress setup falls apart, and it is the row that actually decides where your money should go.

The gap page-view analytics cannot close

Standard analytics counts visits and events, but it cannot reliably tell you which visit paid you, and it loses the original traffic source before the sale settles. This is not a plugin flaw. It is baked into how last-click, cookie-based tracking works, and it gets worse every year.

Here is the failure in plain terms. Someone clicks your Instagram link on Monday, then comes back Thursday through a Google search to buy. Cookie-based analytics either credits the whole sale to Google (last click) or loses the Monday touch entirely because the cookie expired, was blocked, or was capped by privacy rules. On iOS, Apple's tracking limits shorten cookie lifetimes and strip identifiers, so many mobile visits arrive with no usable source at all. The result is the same everywhere: paid and organic sales file themselves under direct, and a channel that actually earned money looks worthless.

If you sell through WooCommerce, a Stripe checkout, or any embedded payment on your site, this gap distorts your ROAS. You cut a campaign that was actually profitable because the dashboard showed no revenue from it, when the real problem was that the sale lost its source on the way to checkout. This is the same failure covered in our guide to first-party ad attribution, and it is why platform-reported conversions so often disagree with what hit your bank account.

The modern fix: first-party, revenue-attached tracking

The current best practice is to capture the traffic source on your own domain at click time, then stamp it onto the real Stripe sale when it settles, so attribution rides with the order instead of a browser cookie. This survives cookie loss, iOS privacy, and short data-retention windows, because none of those can touch data you recorded first-party and attached to a settled charge.

The mechanism is straightforward. When a visitor lands on your site, a first-party snippet reads the traffic source and any ad click ID (the fbclid, gclid, or ttclid the ad platform appended to your link) and stores it as first-party data on your own domain. When that visitor buys, the source is already with them, so it gets written onto the Stripe charge at the moment of sale. Because attribution lives on the order and not a cookie, three things become true that page-view analytics never can:

  • Refunds and chargebacks correct the number. A campaign that looked profitable but generated refunds shows its true, lower return, because the revenue figure updates when the charge reverses.

  • Renewals keep crediting the source. For subscriptions, every renewal payment still points back to the channel that acquired the customer, so you can measure real lifetime value, not just the first payment.

  • The source survives data retention. Even after cookies expire and analytics windows close, the source is permanently recorded on the order, so your ROAS and LTV do not decay over time.


This is the approach Affiliateo is built around: it joins your WordPress traffic to real Stripe revenue and stamps the ad source at the moment of sale, so your reporting reflects money you kept rather than views you collected. For why cookies were never the right foundation, see our explainer on cookieless tracking, and for the mechanics of tying paid clicks to settled charges, see attributing Stripe revenue to marketing channels.

Getting UTMs and events right on WordPress

Even with revenue-attached tracking, tag your own links with UTMs so your campaigns arrive labeled instead of anonymous. UTM parameters are the query strings you append to a link (utm_source, utm_medium, utm_campaign) that tell analytics where a click came from. They work in any tool and are the cleanest way to separate newsletter clicks from Instagram bio clicks from paid ads. Keep the naming convention consistent from day one, because renaming sources later fractures your historical reports. Our UTM tracking guide covers a naming scheme that scales.

For on-site actions, prefer event tracking over guessing from page views. A visit to your pricing page tells you far less than a click on the buy button. Most analytics plugins fire events for form submissions, button clicks, and add-to-cart out of the box, and a tag-manager plugin lets you add new ones without editing WordPress. Events are what let you build a real funnel, from landing to checkout start to purchase, and see the exact step where people leave. That step-by-step view is the subject of our conversion funnel tracking guide, which ranks leaks by lost revenue rather than by drop-off percent.

To compare tools before committing, our roundup of conversion tracking software walks through what to look for, and if search is a major channel, the method for tying organic rankings to real money is in measuring SEO revenue.

Common WordPress analytics mistakes to avoid

Most broken WordPress analytics traces back to a short list of avoidable mistakes. Check these before blaming the tool.

  • Not excluding your own traffic. Your visits and your team's inflate every metric, especially on a low-traffic site. Filter your IP or use the plugin's exclusion for logged-in admins.

  • Letting caching strip the tag. Aggressive page caching can serve a cached copy without the script. Clear the cache after install and after any settings change, then re-verify in real time.

  • Ignoring consent rules. In many regions you must ask before setting analytics cookies. A consent plugin that blocks the tag until the visitor agrees keeps you compliant, and first-party measurement reduces how much you depend on cookies in the first place.

  • Trusting page views as a success metric. Views are a leading indicator, not an outcome. Tie the story back to events and completed conversions, the bottom rows of the table above.

  • Judging revenue from last-click reports. If money is on the line, do not set budget from a report that loses sources to cookie loss. Attach revenue to the sale, not the session.


Fix those five and your analytics will be accurate and actionable, not just a chart that goes up.

Putting it together

Adding analytics to WordPress is a ten-minute plugin install, but making it useful is a different job. Install a free plugin, connect your ID, verify the tag fires, and turn on event tracking, that part is genuinely easy and needs no code. The harder, more valuable step is deciding what to measure and making sure the numbers reflect reality.

Track the four things that matter, traffic sources, top content, on-site actions, and completed conversions, and treat page views as a signal rather than a scoreboard. Then close the gap standard analytics leaves open by attaching revenue to the source at the moment of sale, so cookie loss and iOS privacy cannot quietly rewrite which channel earned your money. If you are also building the payment side of your site, our guide to accepting payments online pairs naturally with this, because the cleanest attribution starts at the checkout itself. Get both right and your analytics stops being a vanity dashboard and starts telling you where to spend your next hour and your next dollar.

wordpressanalyticssetup

Written by Jamal Brooks

Jamal is a product engineer at Affiliateo who writes about payments, integrations, and technical best practices.

Frequently Asked Questions

Related Articles