How to clear unused code ?

Highlighted
Tourist
6 0 2

Hi @OliUK ,

Thanks for your comprehensive input (and also feedback about one of my products, always very useful!).

Your explanation regarding how the app scripts runs after the main page loads makes a lot of sense, seeing as from a layman perspective, it does load only after everything else has loaded. However, it still doesn't change the fact that a huge portion of opportunities suggested by Google lighthouse speed test is related to removing unused JavaScript. I noticed a few of them could be related to Facebook, just a wild guess based on static.xx.fbcdn.net (could be completely wrong here). And also, I've been told that not necessarily removing scripts help but aggregating them makes pages load quicker? I've tried aggregating these when I implemented lazy loading based on tips from Shopify forums as well previously. 

URLTransfer SizePotential Savings

168.3 KiB
118.5 KiB
121 KiB
101 KiB
93.7 KiB
78.1 KiB
65.7 KiB
63.2 KiB
113.3 KiB
53.8 KiB
69.4 KiB
52.5 KiB
98.6 KiB
50.2 KiB
56.9 KiB
47.8 KiB
71.3 KiB
43.8 KiB
…sdk/xfbml.customerchat.js
(connect.facebook.net)
74.9 KiB
43.5 KiB
34.4 KiB
31.1 KiB
72.8 KiB
30.4 KiB
32.1 KiB
30 KiB
31 KiB
29.1 KiB
/logger-1.min.js
(cdn.lr-ingest.io)
112.1 KiB
27.1 KiB
64 KiB
21.4 KiB
23 KiB
21.2 KiB
/cartsync.production.min.js?shop=…
(checkouts-public.s3.amazonaws.com)
36.8 KiB
20.7 KiB
22.7 KiB
20.7 KiB

 

And regarding 'Eliminate render-blocking resources', I've removed the unused one. Thanks for that. However, the ones for my theme still contribute a good 2s to potential savings. Is there a way to optimise these? I noticed Google suggests deferring non-critical js/styles.

URLTransfer SizePotential Savings

25.9 KiB
1,080 ms
2.7 KiB
780 ms

 

Thanks again for your help.

Maverick

0 Likes
Highlighted
Shopify Partner
173 2 26

Hi @Maverickyeung ,

All those fbcdn links are coming from Facebook I think (or at least their content delivery network). I've had a quick look at the files from those requests and I don't really understand what their purpose is. As far as I know, only Facebook services can use the FBCDN. It might be an idea to look into your theme's 'theme.liquid' file and make sure there aren't any double-ups or mysterious names in the <head></head> section of the template. They'll probably be in the format of '<script src="XXX".....' or 'include XXX', and just make sure you test anything that you remove.

In terms of the requests from your theme in 'eliminate render....', I personally wouldn't touch any theme related files and requests. There's just a lot of complexity there and it would be hard to start pulling things out without breaking things. That said, the top request is a stylesheet and there are tools that claim to show the unused code from the used. 

Cheers,

Oli

 

——————————

Founder @ www.preproduct.io

Test and make sales for future products

 

 

0 Likes
Highlighted
Tourist
28 0 1

Hi Oli,
My site is https://www.sjdlace.com
I have tried many ways to speed up, but it doesn’t work.
Would you please give me some valuable feedback? Thank you so much, you are really the shiny treasure in Shopify community.
Cheers!

0 Likes
Highlighted
Shopify Partner
173 2 26

Hi @wangecho ,

Thanks for the kind words. Happy to have a quick look at your store.

SJD Lace loads pretty fast for me actually and the only large request Google mentions that's slowing down your initial page load is your theme's stylesheet. So, nothing we can really do there.

In the 'Remove unused Javascript' section there's quite a few requests from your theme, but there are also three different requests from Google Tag manager, with two different id codes. Is there any chance you've got Google Tag Manager installed twice? This could be a way to increase your score a little (it might be listed twice in the <head> section of the theme.liquid file in your theme's folder) .

In general though, your store runs a lot faster for me than I'd expect, given the Google speed test score.

Cheers,

Oli

 

——————————

Founder @ www.preproduct.io

Test and make sales for future products

 

 

0 Likes
Highlighted
New Member
2 0 0

Hi @OliUK 

any chance you could help me with possible speeding up my site?

https://www.southwestslates.co.uk/

I'm unsure what many of the issues are when checking the score, but it seems quite low!

Many thnaks,

Daryl

0 Likes
Highlighted
Shopify Partner
173 2 26

Hi @Daryl_SSW ,

Yep, sure.

The Google report mentions that you haven't got lazy loading for your images. Lazy loading comes with a lot of themes out the box, but it's quite easy to add in manually. You just need to add this attribute to any <img> tag: loading="lazy" 

i.e.:

 

<img id="something" src="something-else" loading="lazy">

 

Also, Google mentions these requests are slowing down your page load:

URLTransfer SizePotential Savings

36.6 KiB
1,110 ms
5 KiB
150 ms
21.8 KiB
300 ms
85 KiB
1,680 ms

 

The top ones from your theme, so can't really be helped. The bottom one looks pretty substantial, maybe get in touch with the developers if you're still using the app and ask what can be done to speed things up.

Good luck

Oli

 

——————————

Founder @ www.preproduct.io

Test and make sales for future products

 

 

0 Likes
Highlighted
New Member
2 0 0

@OliUK  Thanks for the reply.

So would that mean adding that code to every image on the site? Do you offer a service or know of an app that does this for you?

I'm unsure which app that is, I'm not sure I've even added an app from Gravity-apps!

Cheers,

Dary

0 Likes
Highlighted
Shopify Partner
173 2 26

Hi @Daryl_SSW ,

Well it would mean adding that code to every template file in your theme, i.e. adding it just once for the product page template would mean all of the product pages get it.
I don't offer such a service, just because my Shopify app keeps me at capacity. I'd say any web developer could do it no problem though, junior etc.

Yeah, I know what you mean. The publisher name often isn't much of a clue. I had another look and if you search 'Change Image On Hover Effect' on the Shopify appstore, it should come up. They look small-ish, so I'm sure they'll be happy to help.

Cheers,

Oli

0 Likes
Highlighted
New Member
2 0 0

I have a similar issue. My website is severly slowed down & bugged because of doofinder with other apps I no longer use. Also it messed up my theme. I now have an unneccessary gap on my site.

Can you fix it?

www.risaroselux.com

0 Likes
Highlighted
Shopify Partner
173 2 26

Hi @RisaTsuki ,

I would recommend getting in touch with the company of the apps. They should have an official guide on how to uninstall the app in question.
Also, I'd make sure you've uninstalled the apps from the 'app' section of your dashboard, as well as checked the <head> .... ...  ... </head> section of your theme.liquid file (in your theme's files) for any mention of these apps.

Good luck,

Oli

——————————

Founder @ www.preproduct.io

Test and make sales for future products

 

 

 

0 Likes