← Run an audit
Home / Checks / 5 of 11
high severity

No dead Universal Analytics code

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.

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.

Examples

WrongWrong: all three pieces, fully broken
<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.

WrongSubtle case: leftover UA code in a theme template, present on some pages only
<!-- 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.

WrongSubtle case: UA and GA4 coexisting, so reports still show 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

  1. Search your source for analytics.js, ga('create' and UA-, and remove every hit.
  2. While cleaning up, check your cookie consent banner too. Most scanners see analytics.js and report broken cookie handling even when your CMP is working correctly — that false positive disappears once the UA code is gone.
  3. Delete the matching UA property in the GA4 admin so nobody on the team assumes it is still collecting.
  4. 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.

Related checks

One thing static analysis cannot tell you: this page reads published code, so it shows what is installed, never what actually fires. To confirm delivery, use GTM Preview and GA4 DebugView — both require your Google login.

Check whether your site has this problem — no login required.