JavaScript (JS) files - Site Speed

The JavaScript (JS) files in my store are contributing to an increased Total Blocking Time (TBT) score.

I need to speed up my site especially mobile as its terribly low.

I’m guessing it’s something I can’t do myself?

Any tips on anyone to help on this one. UK based preferably.

1 Like

Hi Lage,

Depends on what the JS is doing as to if you need a Developer.

Likely you are using external libraries in your theme which will need to be removed and then see if we can use CSS or plain JS to perform the same functionality.

We are U.K based (Shropshire & London developers) so feel free to reach out: support@flairconsultancy.com

Kind regards, Liam

Hi, @LAGE24
Excessive or unoptimized JavaScript increases execution time on page load, which shows up as slower mobile performance.
These practical steps help reduce that overhead:

  1. Defer non-critical theme scripts
    Only load essential scripts for above-the-fold content first, and defer the rest so they don’t block rendering.
    < script src=“{{ ‘theme.js’ | asset_url }}” defer>

  2. Delay third-party app scripts until interaction
    You can delay apps until scroll or click, which reduces main-thread work and improves interactivity.

< script>

const load=()=>[“https://example-app-script.js”].forEach(u=>{

let s=document.createElement(“script”);s.src=u;s.defer=true;document.body.appendChild(s);

});

[“scroll”,“click”].forEach(e=>window.addEventListener(e,load,{once:true}));

  1. Remove unused apps

Even uninstalled apps sometimes leave code behind in your theme.

< script src=“{{ ‘slider.js’ | asset_url }}” defer>

load homepage features like sliders only on pages where they’re used .

Implementing the above steps should help reduce JS execution time and improve overall speed.

Disclaimer : I’m the developer of Website Speedy . It’s completely optional.