SEO finding
A script or stylesheet is mostly unused on every page that loads it
SEO Warning Severity: Medium
Part of the audit Page speed and Core Web Vitals. Finding id: seo.unusedJsCss.
What it costs you
Visitors download code their page never runs, and the browser still has to read it. Phones on slow connections feel it most.
What to do
Send each page the code it uses.
What it checks
- Unused script and style code
How to fix it
Load the third-party file later or drop it
- Ask who uses the tool behind [url]. If nobody does, remove its tag.
- If it is used, load it after the page is usable, or only on the pages that need it.
How to check: Run the lab test again and run this rule again.
Split or trim the stylesheet
- Open [example page] with the Coverage panel of the browser's developer tools and see which rules are used.
- Move rules that only one template uses into a stylesheet of that template.
- Delete rules that no page uses. Check pages after a click or a form error too, since their styles are not used on load.
How to check: Run the lab test again and run this rule again.
Split or trim the script
- Open [example page] with the Coverage panel of the browser's developer tools and see which parts of the file run.
- Remove libraries nothing calls.
- Load code for one feature only on the pages that have the feature, or only when the visitor first uses it.
How to check: Run the lab test again and run this rule again.
A real case
Vodafone split paid traffic between two versions of a landing page that differed only in loading speed. The version with a 31% better Largest Contentful Paint made 8% more sales.
Thresholds
| Name | Default | Meaning |
|---|---|---|
min_unused_bytes | 20000 | A file is reported when at least this many bytes of it go unused on every page that loads it. Our own choice, not a published limit. |
min_unused_pct | 50 | A file is reported when at least this share of it, in percent, goes unused on every page that loads it. Our own choice, not a published limit. |
How to verify by hand
The Coverage panel of the browser's developer tools, after using the menus, forms and dialogs of the page.
What this relies on
Code that does not run while the page loads in the lab is not needed for that page.