No dead Universal Analytics code
Why this matters
UA shut down in July 2023. The snippet still downloads roughly 45 KB on every page load, and its presence makes cookie-consent scanners report a broken setup.
How this tool detects it
The tool looks for three Universal Analytics signatures: a reference to google-analytics.com/analytics.js, a ga('create') call, and any UA- prefixed property ID.
A hit on any one of them means residual UA code is present. The count of hits is reported too, so you can see exactly which signals were found.
Note that this is a separate check from "GA4 is not installed". A site can be running GA4 perfectly and still carry dead UA code, and that combination still needs cleaning up.
Where this check can mislead you
Static analysis has limits. These are the cases where this particular check will report a result that does not match reality — worth knowing before you act on it.
- Dynamically loaded UA code is not detected. An analytics.js inserted through JavaScript is invisible in static source.
- Cannot confirm a UA property is genuinely dead. The judgement is based on code signatures, not server state. In theory a UA property could still be receiving data, though Google has stopped processing since July 2023.
- Deliberate retention and forgotten cleanup look the same. Some sites load UA conditionally for historical purposes; this tool flags it for removal either way.
Examples
<script src="https://www.google-analytics.com/analytics.js"></script>
<script>
ga('create', 'UA-12345-1', 'auto');
ga('send', 'pageview');
</script>
After UA shut down, this code still downloads (around 45 KB) and still executes, but every hit goes to an endpoint that no longer accepts data.
<!-- still in footer.php, loads only on pages with comments -->
<?php if ( comments_open() ) : ?>
<script src="https://www.google-analytics.com/analytics.js"></script>
<?php endif; ?>
The homepage scans clean, but article pages carry this. It explains why "some pages have wrong numbers and others look fine" — only certain templates are losing data.
<!-- new code works, old code keeps running alongside -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-NEW123"></script>
<script>
gtag('js', new Date());
gtag('config','G-NEW123');
</script>
<script src="https://www.google-analytics.com/analytics.js"></script>
The most dangerous state: GA4 reports normally so nothing looks wrong, yet every page still downloads an extra 45 KB and consent scanners keep flagging a problem that is not there.
How to fix it
- Search your source for
analytics.js,ga('create'andUA-, and remove every hit. - While cleaning up, check your cookie consent banner too. Most scanners see
analytics.jsand report broken cookie handling even when your CMP is working correctly — that false positive disappears once the UA code is gone. - Delete the matching UA property in the GA4 admin so nobody on the team assumes it is still collecting.
- If you need the historical data: UA data was deleted in July 2024 and cannot be recovered. If it was never exported, there is no path to it now.
Verify it worked
After making changes, confirm delivery rather than assuming. These steps require your Google login, which is exactly why this tool stops short of them.
- Filter the Network panel for
google-analytics.comand see whether requests still go out. Requests returning 4xx or 5xx confirm dead code. - Search the Sources panel for
analytics.jsandga(, then confirm each hit needs removing. - Re-run this tool after cleanup and confirm the check turns green.
- Check the cookie banner while you are there: most scanners report a consent problem as soon as they see UA code, and that false positive goes away when it is removed.
Related checks
Check whether your site has this problem — no login required.