Can we reduce JavaScript execution time by removing scripts from a head tag?

4 0 1

I want to speed up the loading of a store and the analytics show that JavaScript is taking much time to loading. How can we reduce or minimize it?

Thanks in advance.

1 Like

You can integrate Cloudflare and reduce the load time significantly.

We are a Shopify Partner Company
Built more than 100 Shopify Stores
Connect to me on or skype at
Check portfolio at
Shopify Partner
1843 170 525

Shopify already serves assets via their CDN which is powered by Fastly with fallback to Akamai. While Cloudflare sure has some awesome features and considerably more POPs, I think it wouldn't really address the root causes.


Most apps add a considerably amount of scripts. If you have any apps installed, carefully assess which ones are loading what and whether you really need that app i.e. is it worth it for the slow down? Second, if you have been trialing some apps, many leave behind code after uninstall that may still be loading unnecessary resources such as scripts. Do a proper cleanup.


Be mindful of apps that load yet another instance of jQuery. I often count 3 or even 5 jQuery libs loaded up on some stores here.


A lot of your assets are simply aren't prepared well in that they are not minified - take your stylesheets for instance or the main JS script of many themes (Shopify themes included). You can do this manually or automate it using build tools / packagers.


But first and foremost is reduce the amount of script that needs to be interpreted and executed - sure you can reduce scripts from 300kB to 40kB using minification and compression, serve it from a different CDN etc, but that will still be 300kB of JS the browser engine needs to chew on.


Last but not least, the more fancy JS your theme and / or apps are using, the worse it gets with repaints. jQuery isn't the fastest kid on the block so keep the widgetry to a minimum and only what really improves user experience rather than what boosts your vanity storefront looks.


Best wishes!

I turn coffee in to code - since 1998