How Do I Reduce Unused JavaScript in Squarespace?
You might’ve read about how you can reduce unused JavaScript on your website to improve page loading time. Generally this is true, but not with Squarespace.
Because we do not have access to Squarespace’s base code when creating a website, we cannot reduce any JavaScript that is used on Squarespace sites.
What Does “Reducing Unused JavaScript” Mean?
Reducing unused JavaScript is the process of using the the Coverage tool in DevTools to view if any JavaScript files are not being used, and removing them if possible. This can result in faster page load speed and less render-blocking resources.
The thing is Squarespace is a website builder, which means instead of us having to write our own code to build a website, Squarespace does it for us. The tradeoff is that you cannot remove any code that is used in the base code of the platform.
Will My SEO and Page Speed Suffer Since I Can’t Remove Unused JS?
Not likely. Squarespace does a great job of resource loading scripts and only utilizing scripts when necessary, so your Squarespace site page load time is not likely to be affected. As long as your website loads under 2.5 seconds, your SEO is not likely to suffer. You can check the load time of your website by opening DevTools, and using the “Measure Page Load” tool in the Performance tab. Look in the right-hand column to find the “DOM Content Loaded” value, and that is your page load time.
Since Squarespace handles to speed aspect of your website pretty well, what you should focus on much more for SEO is image optimization and on-page SEO.
Speeding Up Custom JavaScript Code
If you have a lot of custom code on your Squarespace site via third-party plugins, you might benefit from moving custom JavaScript to your Squarespace site’s footer code injection instead of adding it to the header coder injection. By using this simple tip, I am able to use more than 3,000 lines of custom JavaScript code on my site without experiencing any speed lags in website load time: