JS Error Test
What is it?
JavaScript runtime errors are unhandled exceptions thrown while the page loads in the browser. They can break interactive features, leave content unrendered, and signal poor code quality to anyone inspecting the browser console, including search engines that crawl the web by rendering pages the same way real browsers do. This test scans the page you submit for runtime errors emitted during load so you can see exactly which scripts are failing and which interactions are at risk.
Why JavaScript errors hurt SEO and UX
A page that throws errors during load is a page where something is not working as intended. The visible symptoms range from minor (a tracking pixel that quietly fails) to severe (a content section that never renders because a script crashed before reaching it). When Google crawls a JavaScript-heavy site, it executes scripts much like a real browser; errors that prevent content from rendering can prevent that content from being indexed at all.
Beyond indexing, JavaScript errors are usually a leading indicator of a poor user experience. Forms that do not submit, buttons that do nothing, layouts that break in specific browsers, all of these typically trace back to an unhandled error in the console. Search engines factor user behavior signals (bounce rate, return-to-search-results) into ranking decisions, so a page that consistently breaks for users will see its rankings degrade over time.
Common sources of JavaScript errors
- Calling a method on a null or undefined value, often because an element the script expected was missing or named differently.
- Race conditions between the DOM and the script, where the script runs before the elements it needs exist.
- Missing or 404 script files, typically caused by a typo or a deleted asset.
- Third-party tags that fail to load or throw their own errors, which still surface in your console.
- Unsupported syntax in older browsers, when a build does not transpile modern JavaScript for the browsers you support.
This test reports the JavaScript errors emitted while loading your page, so you know exactly which scripts are failing. The fix guide below walks through diagnosing errors with browser DevTools, common patches for the most frequent error types, and how to add error monitoring so future regressions are caught before users complain.
Pass rate:
-
Top 100 websites: 83%This value indicates the percent of top 100 most visited websites in the US that pass this test (in the past 12 months).
-
All websites: 82%This value indicates the percent of all websites analyzed in SEO Site Checkup (500,000+) in the past 12 months.
| 2021 | 74% |
|---|---|
| 2022 | 58% |
| 2023 | 79% |
| 2024 | 83% |
100
75
50
25
0
How do I fix it?
This test fails when the browser encounters JavaScript runtime errors as the page loads. Unhandled errors can break interactive features, leave content unrendered, and signal poor code quality, all of which hurt the user experience that search engines factor into rankings. Fixing this issue means identifying the offending script, reproducing the error in DevTools, and shipping a patch that handles the failure cleanly.
Where to make the change
- Open browser DevTools: the Console tab lists every error with the file, line number, and stack trace. Reproduce the issue locally and use sourcemaps to map back to the original code.
- Application code: wrap risky operations in
try / catch, validate external data before using it, and provide fallbacks when DOM elements or APIs are missing. - Third-party scripts: check whether the error originates in an analytics, advertising, or chat-widget script. If yes, contact the vendor or load the script with
deferso it does not block the rest of the page.
Common causes and how to resolve them
- Calling a method on
nullorundefined: guard with optional chaining (?.) or check the value exists before calling. - Race condition between the DOM and the script: wait for
DOMContentLoadedor place the script tag at the end of<body>withdefer. - Missing or 404 script file: a typo in the
srcattribute or a deleted asset triggers a load error. Fix the path or remove the tag. - Unsupported syntax in older browsers: if you support legacy browsers, transpile modern JavaScript with a tool such as Babel and serve appropriate polyfills.
- CORS error blocking a fetch: the API must include the correct
Access-Control-Allow-Originheader. Either configure the API or proxy the request through your own backend.
Best practices
- Add error monitoring: a service such as Sentry, Bugsnag, or Datadog RUM captures errors from real users and groups them by frequency, so you fix what hurts most first.
- Fail loudly in development, gracefully in production: log unexpected errors but never let them break the rendered page. Show a fallback UI instead of a blank screen.
- Treat errors as bugs in the build: add lint rules and unit tests for the most common error paths so they cannot ship again.
- Defer non-critical scripts: using
deferorasyncon third-party scripts limits the blast radius when one of them throws.