Asset 20 8 2
Does AI recommend your business? Run the free check →

Join 15,000 business owners, marketers and entrepreneurs. The Sunday newsletter you'll be annoyed only arrives once a week.

Article

Do You Need to Add Google Analytics Code to Every Page? Here's the Real Answer

If you are skim reading
Yes, the Google Analytics tag has to be on every page you want counted: Google's guide to setting up the Google tag says to place the snippet on every page you want to track, straight after the opening <head> tag.

Yes, the Google Analytics tag has to be on every page you want counted: Google's guide to setting up the Google tag says to place the snippet on every page you want to track, straight after the opening <head> tag. You add it once, though, through your theme header, a plugin, Google Tag Manager or your CMS settings, and the real job is checking the few pages that sit outside that system, because that's where data quietly goes missing.

What "every page" means

Google Analytics 4 works by firing a small piece of JavaScript, the gtag.js snippet, every time a page loads. That script sends a hit back to Google's servers saying "someone just viewed this page." If the snippet isn't present, that page is invisible. No hit, no data, no record it ever happened.

So technically, yes, every single page needs that code running on it. But here's where people get confused. They picture themselves opening every HTML file on their site and pasting a chunk of JavaScript into each one by hand. Nobody does that, and nobody should. If your site has 200 pages, you don't touch 200 files. You add the snippet once, in one place, and every page inherits it because of how websites are built.

How the code reaches every page

Most sites use a shared template. Your header, your footer, your navigation, these are the same file or the same include across the whole site. When you add the GA4 snippet to that shared header file, it appears on every page that uses that header, which on most sites is all of them.

  • WordPress: you add it once in the theme's header.php, or more sensibly through a plugin like Site Kit or Insert Headers and Footers, and it propagates to every page and post automatically.
  • Shopify: you paste it into theme.liquid, once, and it covers the whole storefront including product pages, collections and checkout (with some caveats I'll get to).
  • Squarespace and Wix: there's a dedicated field in settings for your GA4 measurement ID, no manual paste at all.
  • Custom-built sites: whoever built your site should have it in a global template partial, not repeated per page.

If you're not sure which measurement ID you're even looking for, I've written a separate walkthrough on where to find your Google Analytics tracking ID, worth checking before you start hunting through code.

Where it goes wrong (a real example)

I audited a client's site last year, a coaching business with around 340 pages once you counted blog posts, service pages and a resources library. Their GA4 dashboard showed roughly 3,800 sessions a month, which felt low given the ad spend and email list size they had.

I ran the site through Screaming Frog and searched the raw HTML for their measurement ID string. Forty-seven pages didn't have it. Not because anyone was careless, but because their web developer had built a separate landing page flow for paid campaigns using a page builder plugin that sat outside the main theme template. Those 47 pages, which were getting the bulk of the paid traffic, were sending zero data to GA4. The campaigns looked like they were underperforming. They weren't underperforming. They were untracked.

So when the numbers look wrong, suspect missing pages before you blame Google. Most "my analytics numbers look wrong" problems aren't Google's fault or a tracking bug, they're a handful of pages that were built outside the normal system and never got the snippet at all. Landing page tools, checkout flows, gated PDF download pages, subdomains for a blog or a shop, these are exactly the places code goes missing, because they're not part of the template everything else shares.

The fix for pages like those 47 takes minutes once you know where to look. Open the page builder's own settings (most have a site-wide "header scripts" or "tracking code" field), paste in either the Google tag snippet or your Google Tag Manager container, never both, and republish every page that uses the builder. Then run the check below again on a handful of those pages; a fix you haven't re-checked isn't a fix.

On WordPress, a plugin keeps the tag in one place through theme changes, and the best WordPress Google Analytics plugin roundup compares the options.

How to check every page is tracked

You don't need to guess. Here's the ten-minute version I use on client audits:

  • Crawl the site with Screaming Frog. Its FAQ says the free version stops at 500 URLs a crawl and locks the configuration options, including custom source code search, so this step needs the paid licence.
  • With a licence, go to Configuration, then Custom, then Search, and add a filter for your GA4 measurement ID, something like "G-XXXXXXX". If you installed through Google Tag Manager, search for your GTM- container ID instead, because the G- ID lives inside the container, not in the page source.
  • Run the crawl. It'll flag every page where that string does not appear in the source.
  • Cross-check the flagged pages manually, since some are built with different template systems on purpose (payment gateways, third-party booking widgets).

No licence? There are three free checks, from quickest to most thorough:

  • One page: right-click, choose View Page Source, press Ctrl+F (Cmd+F on a Mac) and search for your G- or GTM- ID. No match means no tag.
  • One page, confirmed firing: Google's tag setup guide says to verify your implementation with Tag Assistant. Open Google Tag Assistant, enter the page address, click Connect, and look for your tag ID in what it reports.
  • Live traffic: open GA4's Realtime report in one tab, click through your landing pages and checkout in another, and watch each page title appear. A page you visited that never shows up is untracked.

For a whole site over 500 pages without paying, split the crawl by folder, or, if you're comfortable with a terminal, a few lines of script can fetch every address in your sitemap and print any page whose source lacks your ID. The paid licence is worth it if you're doing this for more than one site.

Running more than one site? See my note on whether each website needs its own Google Analytics account.

What Google Tag Manager changes, and what it doesn't

A lot of people think installing Google Tag Manager solves the "every page" problem completely, and it mostly does, but it doesn't remove the requirement, it just moves it. You still need the GTM container snippet on every page. Not sure what the tool does? I've explained what Google Tag Manager is in plain terms. What changes is that once GTM is there, you manage all your tags, including GA4, from inside the GTM interface rather than editing code again for every new tracking need.

So the practical upside is real: add a new conversion tag, a Facebook pixel, a heatmap script, whatever, and you never touch the page code again, you just add a tag inside GTM and publish. But if GTM itself is missing from a page (same landing-page-builder problem as before), nothing fires. So GTM needs its own check. Tag Manager Help's page on previewing containers gives the steps: in the Workspace tab click Preview (top right), Tag Assistant opens in a new tab, enter your page address and click Connect, then return to the Tag Assistant tab and click Continue. It shows which tags fired and in what order; your GA4 Google tag, carrying your G- ID, should fire on the first page view. If it doesn't, open its trigger and make sure it covers all pages, then publish the container, because preview tests a draft and nothing changes on the live site until you publish.

Work with me

Want AI doing the heavy lifting in your marketing?

I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.

Building a dashboard? Here's an overview of the Google Analytics API for developers.

The places code most commonly gets missed

  • Subdomains. If your blog lives on blog.yoursite.com and your main site is yoursite.com, the tag has to be on both. Google's help article on cross-domain measurement says to keep subdomains on the same cookie domain, otherwise visits between them can show as self-referrals. For a separate domain (yoursite.com and a shop on yourshop.com), set up cross-domain measurement in Admin, Data streams, your web stream, Configure tag settings, Configure your domains.
  • Landing page builders. Unbounce, Instapage, and similar tools sit outside your main CMS, so the snippet has to be added inside that tool's own settings, not assumed to carry over.
  • Checkout and payment pages. Shopify's checkout isn't part of the regular theme, so theme.liquid doesn't reach it. Shopify's Help Center says custom pixels (under Customer events in the admin) collect customer events on checkout and post-purchase pages without editing theme code, so that's where checkout tracking goes now, not a pasted snippet.
  • PDFs and downloadable resources. These aren't HTML pages at all, so no snippet can run on them. If you want download data, you need an event trigger set up separately, not the standard page-view snippet.
  • Old or orphaned pages. Pages that predate your current template, or that were hand-coded once and forgotten, quietly stop matching whatever your current install method is.

Miss any of these and your reports show only the parts of the site that happened to inherit the code, while looking complete. If you want to see exactly what GA4 is capable of recording once it's firing everywhere, I go through it in detail in what Google Analytics tracks on your website (and what it quietly misses), which is worth reading alongside this.

Do multiple properties change the "every page" answer?

If you run more than one site, or a site with separate business units, you might be tempted to spin up multiple GA4 properties and worry about which snippet goes where. The tracking rule doesn't change, each property still needs its own snippet on every page it should measure, but the account structure question is a different one and I've laid out the actual limits in how many Google Analytics accounts you can set up, since the free tier caps things in ways that catch people out.

Once every page reports, session replay tools show what visitors do on the pages you can finally see.

Adding the snippet everywhere isn't the whole job. The ICO's guide to cookies under PECR says you must tell people about the cookies you set and get their consent, with exemptions for cookies that are strictly necessary, such as a shopping basket; analytics isn't in its list of examples. Check the ICO's current guidance before relying on any exemption for analytics. In practice that means your consent banner logic has to run on every page too, in step with the tracking code, and a page with the tag but no banner is its own gap. I've covered the specifics in whether Google Analytics requires cookie consent under GDPR, but the short version is that having the tag on every page and having consent handled on every page are two separate checks, and skipping the second one is its own kind of exposure.

If "tag" still sounds like two different things, What are tags in Google Analytics? separates them.

My actual recommendation

If you're building or rebuilding a site, decide on your method once and stick to it: theme template, plugin, or GTM container, pick one, install it site-wide, and treat any page that skips your normal build process (landing pages, checkout, subdomains) as a page you must manually verify rather than assume. Run a full-site check every few months (Screaming Frog with a licence, or the free checks above), especially after a redesign, a new plugin, or a developer handover, because those are the moments code silently drops off pages nobody thought to double-check.

And if you're only just setting analytics up for the first time, it's worth reading when you should start using Google Analytics first, because getting the install right from day one saves you the exact audit headache I described above.

Developers who've untangled a tracking install worth writing up can pitch it through the developers contributor page.

Frequently asked questions

Where in the page should the Google tag go?

In the head. Google's setup guide says to paste the snippet immediately after the opening head tag on every page you want to track. Plugins and CMS settings fields put it there for you.

What happens if a page is missing the GA4 tracking code?

That page sends no data at all. It won't show up in your reports as low traffic, it simply won't exist in Google Analytics, which is why missing pages are easy to overlook rather than easy to spot.

Do PDFs and downloads need the GA4 tag?

They can't run it, because a PDF isn't a web page. Track the click on the link that points to the file instead: GA4's enhanced measurement can record file downloads as an event, or you can set up a click trigger in Tag Manager.

Can I check one page without a crawler?

Yes. View Page Source and search for your G- or GTM- ID, or use Tag Assistant to confirm the tag fires. For the whole site you need a crawl with source search, which in Screaming Frog needs a licence.

Run a business, a brand or a blog? I feature tools, products and expert guest posts for an audience of 15,000. See how it works

Published and maintained by the Lilach Bullock team, covering marketing, AI and business growth.
Your buyers are asking AI who to use. Does it say you?

See for free whether ChatGPT, Claude, Perplexity, Gemini and Google name you, and get the plan to become the answer.

Check my AI visibility →
Sundays only

Get the Sunday newsletter.

One email a week. AI experiments, marketing tactics, and the workflows Lilach is building right now in her own business.

Subscribe free

Let’s get your marketing running on AI.

Book a free 30-minute call

We figure out what you need, where AI fits in, and what working together would look like.

Book the call →

Or take the 30-second calculator

You’ll see the hours and the money quietly leaking out of your week, and the three workflows worth building first.

Take the calculator →

Or grab the free AI resource library

Prompt packs, templates, checklists, and swipe files. The exact tools I build for paying clients. Yours, free.

Get the library →
Keep reading

More from the blog.