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.

DevTools Coverage Tool

This is what the Coverage tool looks like in DevTools. The “Usage Visualization” column shows you what percentage of JavaScript is not being used for specific files.

 

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.

Removing JavaScript from Third-Party Plugins

Click “Measure Page Load” in the Performance tab.

 
DevTools Performance Tool

Look for the DOM Content Loaded property to find how many seconds it takes for your site to load.

 

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:

Related Resources

  1. How and Where to Add Custom Code in Squarespace (CSS, HTML, and JavaScript)

  2. A Complete Guide to CSS Selectors in Squarespace 7.1

  3. 7 Proven Ways to Clean Up and Speed Up Custom Code - Squarespace

  4. 6 Helpful Squarespace 7.1 Code Snippets and Plugins

  5. How to Add, Update, and Delete jQuery in Squarespace

  6. 3 Ways to Use Code Blocks in Squarespace 7.1 (with Examples)

Caroline Smith

Caroline Smith is a solopreneur and front-end web developer with 5+ years of experience in web development.

https://launchhubstudio.com
Previous
Previous

Does Squarespace 7.1 Support Developer Mode?

Next
Next

Does Squarespace Offer Support for Squarespace 7.0?