Technote

SEO Intro

Series No measurement, no improvement Part 2 of 8

Three ways to add analytics to WordPress, and what each costs

A plugin, code in your child theme, or a tag manager. All three work, but they charge different prices: convenience, control, or an extra layer that hides what has accumulated.

Once you have chosen an analytics tool, a piece of tracking code has to go into the site. WordPress gives you three ways to do that, and all three produce numbers. The difference shows up six months later: who can maintain it, whether anyone can tell what is inside it, and whether it survives a change of staff.

Option 1 — a plugin

The quickest route. Install, connect the account, done — and a marketer does not have to wait for a developer. Many such plugins also wire up the tool’s recommended events automatically, turning days of setup into minutes.

The price is one more plugin: more code to keep updated, more assets loading on every page, and one more thing that may stop being maintained. There is a subtler cost too — the events a plugin creates for you often come with names you cannot choose, which collides with the naming discipline in the next part.

Option 2 — code in the child theme

Here the tracking code is emitted by the theme itself. What runs, and when, is visible in the code; conditions are easy to add; and because nothing loads except the tracker, it is the lightest of the three.

There is one condition you must not break: put the code in the child theme, never in the parent. Edit the parent directly and the next theme update quietly removes your work, leaving a data gap nobody can explain.

The same code — where it lives decides what you still have six months from now

The price here is that every change means touching code. If adding one event requires a development request each time, in practice the events never get added.

Option 3 — a tag manager

The site carries a single container, and tags are added and edited inside it. Marketers can add events without a deployment, which makes this the most flexible of the three.

The price is the flip side of that flexibility. The site’s code shows only the container, so what actually runs lives outside the site. After a year or two the container fills with tags nobody can account for, and because nobody can prove they are safe to delete, they stay — running in every visitor’s browser.

What each approach gains, and what it gives up in exchange

One check, whichever you choose

Confirm that the tag fires exactly once. Sites frequently end up with a plugin installed while an older snippet is still in the theme, or with the same tool loaded by both a plugin and the tag manager. Every visit is then counted twice, every figure inflates, and the only symptom is a conversion rate that looks oddly low months later. The final part covers how to check.

Write down which route you took and where the code lives — a single paragraph. It is the first thing lost when the person responsible changes.

How plugin count relates to maintenance load is covered in the Themes & plugins archive, and among the free tools we build and publish there is a diagnostic plugin that checks a site’s own condition.

Next part

With the tag in place, the question becomes what to record. To give away the conclusion of the next part: count meaning, not clicks.

More on this topic

All technotes
₩270,000 · Join the program