Duplicate pageviews inflate session counts, distort engagement metrics, and break attribution in GA4. WordPress sites that use both theme-level analytics and Google Tag Manager (GTM) are especially prone to firing page_view twice on each load.
The good news: itâs easy to diagnose and fix.
Letâs walk through the fastest way to identify and resolve duplicate pageviews on your site.
1. How to Spot the Issue
- In GA4 Realtime or DebugView, check if two page_view events fire on a single page load.
- In the browser console, run:
window.dataLayer?.filter(d => d.event === 'gtm.historyChange' || d.event === 'page_view')
- If a theme or plugin also injects GA code, youâll likely see two pageview sources.
2. The Most Common Causes
- A theme or plugin has GA/gtag enabled while GTM also sends GA4 events.
- Both gtag.js and the GTM container are installed simultaneously.
- A SPA-like plugin triggers history changes without proper GTM configuration.
- Multiple GTM containers are present on the site.
3. The Fix (Pick Your Setup)
A) Using GTM Only (Recommended)
- Remove any GA/gtag snippets from theme settings or plugins.
- Keep only the GTM container code in the site head/body.
- In GTM, use:
- GA4 Configuration tag
- Optional: GA4 Event tag for page_view (if not relying on automatic page measurement).
B) Using gtag.js Only (Less Common for WordPress)
- Remove the GTM container from the site.
- Keep only the gtag.js GA4 snippet in the head.
C) SPA or Ajax Navigation
- In GTM, enable the History Change trigger for virtual pageviews.
- Push updated page_location and page_title after route changes.
4. Practical Checklist
- Check theme options/Customizer for âGoogle Analyticsâ fields â turn them off if using GTM.
- Deactivate overlapping analytics plugins or set them to âUse GTM mode.â
- Ensure only one GTM container is published sitewide.
- For caching/CDN, purge after changes to avoid old code still firing.
5. Verify the Fix
- Open GTM Preview, load a page, and confirm only one page_view per load.
- Check in GA4 DebugView that page_view fires once with correct page_location and page_title.
- Navigate across 3â4 pages to ensure no extra pageviews appear from history events.
Final Thoughts
Duplicate pageviews can quietly skew KPIs, sessions, and attribution. Standardizing on a single source of truthâpreferably GTMâkeeps GA4 clean and reliable.
Once your site sends one accurate page_view per load, your Explorations, audiences, and conversion paths become trustworthy again.
đ Need help auditing your setup or cleaning up your tag stack? Book a free consultation.