What AuditX checks
During the Lighthouse run the browser records uncaught JavaScript errors. The scan keeps only errors thrown by a script from a known analytics, advertising, social or tag manager host, or errors whose message names a tracking function such as gtag, fbq, dataLayer, _paq, ttq or clarity. Plain console.error messages and the hidden cross-origin message Script error are left out. Any remaining error gives a warning that quotes up to three messages and where they were thrown. A warning counts toward the technical score at 40 percent of what a fail would cost, here with double weight. If the page loads tracking tags and no such error was thrown, the check passes. If the page has no tracking tag and threw no such error, the result is an info note, which does not lower the score. It is an info note too when the console could not be read. The run never clicks a consent banner, so an error that only happens before consent is what this check sees.
Why it matters
The Google tag install snippet first defines window.dataLayer and the gtag function, so calls made before the tag script has loaded are queued instead of throwing an error.
A tracking call that throws an error does not send its event, so the visits or conversions it should record are missing from your reports.
How to fix it
- Open the page with the browser developer console open and find the error named in the result.
- Make sure the queueing stub from the install snippet of the platform runs before any call to gtag, fbq or dataLayer.push.
- If the tag waits for consent, let the calls that use it wait for consent too.
- Remove leftover calls to a tag that was taken off the site.
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
</script>
Does your site pass this check? A free scan runs it with every other check and shows the result in about a minute.
Scan my site