I ran my website on Google insight and in the report, it shows me that there are unused Javascripts which are taking 7.29s
How can I remove them? pls, help!
I think optimizing load speed is a long story and would require a lot of technical knowledge. This shouldn't be something you do by following some online instruction. But if you have knowledge about JavaScript, here are some of the things I did to make my store 99 in Google Page Speed Insights.
Note: Don't follow this without technical background, I suggest you give this to your technical specialist.
Defer offscreen images:
Install lazysize script (https://github.com/aFarkas/lazysizes) and update image source in the theme
Properly size images:
Check the container size (wrap the image and crop the image as the same as container size)
Use img srcset instead of src to get 2 versions of image, 1 for retina screen and 1 for non-retina
Remove unused CSS and unused JS:
Check assets folder of the theme and remove unused CSS and JS file
Check and remove unused apps
If your store has not install any app you can comment {{ content_for_header }} code in theme.liquid (not recommended if you don't have a knowledge about the liquid)
Optimize, Minify code:
Minify HTML code: Add this code into theme.liquid file to minify HTML https://pastebin.com/raw/V9gRwnWR
Concat CSS files and minify all of them and load inline inside <head> tag
Concat JS files and minify and async load at the bottom of the page (before </body> tag)
Add font-display: swap into all external fonts
Though this is a a lot of technical work and you almost CANNOT do it without technical background, but understanding what needs to be done is important. Because not all technical guys know exactly what to do and you will need to work with him until he actually improves the load speed.
Thank you for your invaluable advice.
How would one go about hiring someone to improve the speed or seek out someone that could do this for our website to improve speed?
Thank you for your time!
@RichardNguyen
Amazing tips. Just as a minor note, as far as I am aware, removing files from the assets folder won't make a difference if they're not being used on the website.
Hey @RichardNguyen
great input for a no-coder to pass to a developer to point him in the right direction
I tried many things with content_for_header, the worst line of code for pagespeed.
I know we shouldnt, that's why i started doing it
I solved the problem, that the theme editor on those manipulated themes stopped working,
I implemented a backfall to {{ content_for_header }}, if it change.
I get very good results using an array, when erase parts, manipulate it, change position etc.
So far so good, but there is one major question:
there is nothing more powerful than commenting content_for_header,
I thought because of the not loaded scripts, but the shop is completely functional?
Do you know why?
Thank you, greetings from Barcelona
User | Count |
---|---|
28 | |
18 | |
17 | |
16 | |
9 |