Code
Remove unused JavaScript
An unused JavaScript is a resource that does not contribute to rendering the page and does not affect how its content appears.
In other words, it is part of the code but not used.
These JS files are typically used by third parties to track data, such as Google Analytics and Facebook.
Why it is important
TUnused JavaScript can slow down your page load speed.
The rendering process is slowed down if JavaScript is render-blocking because the browser cannot proceed until it has downloaded, parsed, compiled, and evaluated the script.
Although JavaScript is asynchronous (i.e., not rendering-blocking), the code competes for bandwidth with other resources during download; this significantly affects performance.
Those without unlimited data plans will also be wasting data by sending unused code over the network.
How the audit fails
Sitefig uses the Lighthouse tool, which flags every JavaScript file with over 20 kibibytes of unused code.
See Find unused JavaScript with the Coverage tab for manual detection.
Fixing the problem
In Chrome DevTools, the Coverage tab displays unused code on a line-by-line basis.
You can use this tool to review unused JavaScript code and then remove it from your source code.
There are also several other tools and options to detect your unused JavaScript code. Visit How to remove unused JavaScript site.
If your website runs on WordPress, you can search for and use special plugins that remove unused JavaScript from its pages.