How to Install Analytics on Every Page of Your Site
This check fails when crawled pages load no recognisable analytics tag, such as a GA4 measurement ID, a Google Tag Manager container, a Meta Pixel, or a script from Plausible, Matomo, Microsoft Clarity, Segment, PostHog, Hotjar, Fathom, Umami or Simple Analytics. By the end of this guide your tag will sit in the shared site template, so every page, including landing pages, blog posts and error pages, sends data.

Why it matters
Untracked pages are invisible in your reports. Sessions that pass through them get split or misattributed, conversions lose their source, and you can't see which content earns organic or AI-referral traffic. One untracked template, such as the blog or a landing page builder, can hide a large share of your traffic and lead to wrong decisions about what to fix or expand.
What you need
Step-by-step fix
List the pages missing a tag
Open the audit result and export the list of URLs reported without analytics. Group them by template: homepage, product, blog post, landing page, legal page, 404. A pattern almost always shows up, for example all /blog/ URLs or every page built in a separate landing page tool.
Spot-check one URL per group from the terminal.
curl -s https://example.com/blog/sample-post | grep -Eo 'G-[A-Z0-9]{6,}|GTM-[A-Z0-9]+|fbq\(|plausible|matomo|clarity\.ms|posthog|fathom|umami' | sort -uPick one tag and one install location
Choose a single method: either the GA4 gtag.js snippet directly, or a Google Tag Manager container that fires GA4 and any other tags. GTM is easier to maintain if marketing will add more pixels later. Then find the file every page shares, such as header.php, theme.liquid, app/layout.tsx, a base layout, or the CMS's site-wide "head code" field.
Add the snippet to the shared <head>
Paste the snippet as high in the <head> as possible in the shared template. For GTM, also add the <noscript> iframe right after the opening <body> tag. Replace the IDs with your own.
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-ABC1234');</script>
<!-- End Google Tag Manager -->
<!-- OR, without GTM: GA4 gtag.js -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-EXAMPLE123"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-EXAMPLE123');
</script>Cover pages outside the main template
Check every place that renders HTML without your main layout:
- Separate blog installs or subdomains (blog.example.com)
- Landing page builders and campaign microsites
- Custom 404 and 500 error templates
- Static HTML files uploaded directly (e.g. /promo.html)
- Checkout, account and search results templates
Add the same snippet to each one, or switch them to the shared layout.
Keep the tag present when using a consent banner
Don't remove the tag from the HTML until consent is given. Load it on every page, set Google Consent Mode v2 defaults to denied, and let your consent platform update them after the visitor chooses. That keeps you compliant and lets the tag show up in the page source.
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
analytics_storage: 'denied',
wait_for_update: 500
});
</script>
<!-- place this BEFORE the GTM or gtag.js snippet -->Remove duplicate tags
While editing, search the template, plugins and GTM for a second copy of the same ID. Having both a hard-coded gtag.js and a GTM-fired GA4 tag doubles page_view events and halves your bounce rate on paper. Keep exactly one source per measurement ID.
grep -rnE 'G-[A-Z0-9]{6,}|GTM-[A-Z0-9]+' ./wp-content/themes ./templates ./src 2>/dev/nullVerify on live pages and re-run the audit
Purge your CDN and page cache, then rerun the curl check from step 1 on one URL from each template group. Open GA4 Reports > Realtime or Admin > DebugView with Tag Assistant (tagassistant.google.com) connected, and click through the previously untracked pages. Finally, re-run the site audit and confirm the count of pages without analytics is zero.
for u in / /blog/sample-post /landing/spring-sale /does-not-exist; do printf '%s ' "$u"; curl -s "https://example.com$u" | grep -Eoc 'GTM-ABC1234|G-EXAMPLE123'; done
Platform-specific notes
WordPress
Use Site Kit by Google (Site Kit > Settings > Connected Services > Analytics) or add the snippet in a child theme via a `wp_head` action in functions.php. Avoid editing the parent theme's header.php, since theme updates overwrite it. Check that landing page plugins such as Elementor Canvas templates still call wp_head().
Shopify
The Google & YouTube app sends data through Shopify's sandboxed web pixels, which don't appear in page HTML. Checkout tracking also runs through Settings > Customer events. For a tag that's visible on storefront pages, add GTM or gtag.js to Online Store > Themes > Edit code > layout/theme.liquid inside <head>. Use only one GA4 path to avoid double counting.
Wix
Go to Settings > Marketing Integrations > Google Analytics (or Google Tag Manager) and connect your ID. Alternatively, use Settings > Custom Code > + Add Custom Code, set 'Add Code to Pages' to All pages and place it in Head. These apply site-wide, including blog and store pages.
Webflow
Paste the snippet in Site settings > Custom code > Head code, or enter your GA4 ID under Site settings > Apps & integrations > Google Analytics. Publish to all domains afterwards. Page-level custom code only affects that page, so don't use it for analytics.
Next.js
Add the tag once in app/layout.tsx (App Router) or pages/_document.tsx (Pages Router). The @next/third-parties package provides <GoogleTagManager gtmId="GTM-ABC1234" /> and <GoogleAnalytics gaId="G-EXAMPLE123" />. Make sure app/not-found.tsx and any route groups with their own root layout also include it.
Check that it worked
✅ How to verify
- Run curl on one URL per template and confirm your G-, GTM- or tracker script appears in the raw HTML.
- Use Tag Assistant (tagassistant.google.com) and confirm the tag fires on homepage, blog, landing and 404 pages.
- Check GA4 Reports > Realtime or Admin > DebugView for page_view events from previously untracked URLs.
- Re-run the site audit and confirm it reports analytics on all crawled pages.
⚠️ Common mistakes
- Installing the tag through a page-level custom code field, so new pages and templates ship without it.
- Blocking the whole script until consent instead of using Consent Mode, which leaves most pages with no tag in their HTML.
- Forgetting separate systems such as a blog subdomain, landing page builder, static HTML files or the custom 404 page.
- Adding GA4 both directly and through GTM, which double-counts page views.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
How do I check if Google Analytics is installed on every page?
Crawl your site with an audit tool, or curl a sample of URLs from each template and search the HTML for your G- or GTM- ID. Tag Assistant and GA4 Realtime confirm the tag actually fires, not just that it's present.
Should I use Google Tag Manager or the GA4 gtag.js snippet?
Either works. gtag.js is simpler for GA4 only. GTM is better if you'll add a Meta Pixel, Clarity or conversion tags later, because marketers can manage them without template edits. Use one or the other for GA4, not both.
Do privacy-friendly tools like Plausible or Fathom count?
Yes. Plausible, Fathom, Umami, Simple Analytics, Matomo, PostHog, Clarity, Hotjar and Segment are all valid. The script just needs to load on every page from a recognisable URL.
Why are some pages still showing no analytics after I added the tag?
The usual causes are cached HTML on a CDN, templates that don't use the shared layout (error pages, landing builders, subdomains), or a tag that's only injected by JavaScript after consent. Purge the cache and check the raw HTML of each affected template.
How to Fix Duplicate Analytics Tags (Google Tag Loaded Twice)
How to Fix Old URLs That Redirect to the Homepage
How to Fix Legacy Universal Analytics (UA-) Tracking Code
How to Fix Old URLs That Return 404 After a Redesign
How to Fix a Missing Cookie Consent Banner for Tracking Tags
How to Fix an Indexed Staging Site in Google and Bing