Re: How to clear unused code ?

How can I remove unused code after uninstalling apps?

TattooKits
Tourist
11 0 3

I found that after uninstalling the apps, the page will have a lot of unused code, affecting the speed of the page. Is there any apps that can clear all unused code of the website?

Replies 230 (230)
OliUK
Shopify Partner
235 2 56

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

 

 

 

PhilHagspiel
Visitor
1 0 0

Hey @OliUK ,

it seems like you are helping a lot of folks here. Thank you for being there.

I have a problem with my load times as well. Would you mind taking a quick look?

https://shop.philhagspiel.com/ for the general store page and
https://shop.philhagspiel.com/products/sparks for a specific product page.

PageSpeed tells me that I have horrible loading times and that there is a bunch of js I ought to remove.

Would really appreciate your help!

Phil

OliUK
Shopify Partner
235 2 56

Hi @PhilHagspiel ,

No worries at all.

Just had a quick look at your site. There are no apps significantly slowing down your initial page load. It's mostly coming from your theme.

There's some apps that make requests after the main page-loads that are showing up in the Google report, but they're modestly sized.

To be honest, your site loads very fast for me. Product page feels like it loads in about a quarter of a second.
As I understand it, Shopify speed score is just an integrated, branded version of Google Lighthouse.
Google lighthouse bases it's tests as if the user was on a 'slow 4g internet connection' with a mediocre 'android' device (for mobile), so maybe that sheds some light on why your score is lower than we'd expect.

Not that helpful I'm afraid.

Cheers,

Oli

——————————

Founder @ www.preproduct.io

Test and make sales for future products

 

 

slize
Visitor
1 0 0

Hi Oli,

I've noticed that you're helping a lot of people with their Shopify speeds. I'm struggling with my store speed as well - Lighthouse is showing a score of 31 which seems extremely low. Apparently it's due to some unused JS "cdn.shopify.com/vendor...", but I have no idea what to do with it. Any chance you could tell me what to do to optimise it? 🙂

The store address is nutreally.co

Cheers!

OliUK
Shopify Partner
235 2 56

Hi @slize,

Yep sure, so, the 'cdn.shopify' is a request to Shopify's servers. It's probably coming from your theme. Which theme you use makes a big difference to page speed. I can't see any obvious ways to improve your site speed, but I'm really not an expert on site-speed.

I've included a little chart which lists the 'third-party' code from the report by company name:

 

Third-PartyTransfer SizeMain-Thread Blocking Time

Shopify
1,586 KiB
1,482 ms
Facebook
115 KiB
55 ms
Google Tag Manager
76 KiB
11 ms
Google Analytics
37 KiB
5 ms
Google/Doubleclick Ads
18 KiB
0 ms
Other Google APIs/SDKs
2 KiB
0 ms

 

Cheers,

Oli

——————————

Founder @ www.preproduct.io

Test and make sales for future products

 

 

Sweetsensej
Shopify Partner
7 0 3

Hey Oli, 

would love to hear your opinion on my store. I think there is a lot of work on this one: 

https://malujdiamentami.com/

1. I was wondering, how can I start optimizing the liquid files on my back-up theme and then test it against Lighthouse after some time? Can it be only done on the production theme? 
2. Would you know a way to display/render apps, like messenger app/loyalty app only on specific pages, not on all pages? Would that increase the page speed load?  
3. Would you also know if this lazy-loading is fetching the minified image on the initial page load even if the user does not see the image? If yes, then do you know any resources where I could try and load the image only if the user is close to it? 

Any further referral to helpful documentation is much appreciated. 

Dom 

OliUK
Shopify Partner
235 2 56

Hi @Sweetsensej ,

I'm really not an expert on page-speed, but I've included my 2 cents below. Hopefully, it's helpful in some way.

1. As I understand it you should be able to run a new lighthouse test straight after making a change. It seems to create a new test each time, I'm guessing it runs as if there's no cached files either.
Whether this can only be done on the production theme is good question. I'd be interested to hear an answer to this, if you end up testing this way.

2. It really depends on how the app works. If the app is configured through Shopify script tags, then it will have the chance to load on most pages of your theme and I think this is pretty hard to configure as a store owner. We have some logic within our app, which means it only gets a chance to load on product pages, but I don't think all apps will be like this.
If the apps are just being called from the <head> section of your theme.liquid, or from within a specific page template, then that would be pretty easy to tweak. 
This would increase page speed in reality, but I'm not sure if Lighthouse discriminates that way in it's final speed score.

3. My understanding of lazy loading is exactly what you describe. The main image only loads when it's about to come into the view port panel of the user's screen.

Good luck,

Oli

——————————

Founder @ www.preproduct.io

Test and make sales for future products

 

 

henriettaprice
New Member
6 0 0

Hi there Oli, just wondering if you wouldn't mind taking a quick look at my site please? It would be a huge huge help. My site is running really slow, the desktop score is 34 and the mobile is 29. I have ran some tests with the google speed tester and it tells me what I have to do but I have nooooo idea how to do it!! Any insight from you would be greatly appreciated. thank you so much, Henrietta 

OliUK
Shopify Partner
235 2 56

Hey @henriettaprice ,

Yep, no worries at all. If you post your URL, I'll have a quick look.

Cheers,

Oli

 

——————————

Founder @ www.preproduct.io

The smarter way to launch products. 

 

 

henriettaprice
New Member
6 0 0

Hey olí, thanks so much! My website is www.rumalifestyle.com 

 

kind regards, Henrietta 

OliUK
Shopify Partner
235 2 56

Hey @henriettaprice ,

There might be an opportunity here. It looks like you have two very similar requests to Faceboook. Have you got the same pixel in your theme twice by any chance? or being told to fire twice?

The rest of your Google report looks pretty reasonable. No big requests outside of your store theme and it's dependencies.

Cheers,

Oli

 

——————————

Founder @ www.preproduct.io

The smarter way to launch products. 

 

 

henriettaprice
New Member
6 0 0

Hey again Oli, 

oh ok great to know!! I have been setting up a few pixels and ad accounts, im wondering wether it might be the Facebook pixel that comes with Shopify and then the pixel that ive set up through my Facebook ad account. Do you know where I would find it to see if it is firing twice? Thanks so so much for all of your help 

 

Kind regards 

 

Henrietta

OliUK
Shopify Partner
235 2 56

@henriettaprice ,

I don't spend that much time in the Facebook pixel/ad side of Shopify. It will probably be in the head.liquid template in your theme files. I'm just not sure if the pixel you setup through Shopify settings appears there or is dynamically loaded afterwards.

I'd suggest experimenting. If you find one/two pixels in that file, maybe remove one of them(copy and paste it somewhere safe). Then test if you still have a pixel firing. I seem to remember that Facebook ad manager has a screen which shows real-time pixel traffic, so that could be useful here.

Good luck!

Oli

——————————

Founder @ www.preproduct.io

The smarter way to launch products. 

 

 

Chazz01
Visitor
1 0 0

Hi @OliUK,

Could you please help me with my site? 
I am a complete beginner when it comes to code so 99% doesn't make sense to me. My site speed score is very low and I want to fix it but I don't know how. 

I installed an app today to resize the image files but I don't know what else to do. I saw on something I read about clearing the unused code from old apps etc but I don't know how to do that either.

Any help would be greatly appreciated.

Thank you!

www.infinitybeautyanddesigns.com.au

OliUK
Shopify Partner
235 2 56

Hi @Chazz01 ,

There is a really good opportunity to speed your site up. You should add 'lazy loading' to your images. There might be some apps that automatically do this for you, but basically the process is to add 

loading="lazy"

after every instance of <img , so it would be something like <img loading="lazy"> this will mean your images don't add to the initial load time of your pages.

There's also a chat app with a request (not huge), but if you have an unused chat app, it might be an idea to remove it.

Cheers,

Oli

 

——————————

Founder @ www.preproduct.io

The smarter way to launch products. 

 

 

TheSacredBear
Visitor
2 0 0
Click to expand...
Hi Oli,


Having the same issue ourselves. Would be so kind to check our site too please? URL is www.thesacredbear.com

Many thanks

Jason
OliUK
Shopify Partner
235 2 56

Hi @TheSacredBear ,

You've got a much higher Google Lighthouse score than most of the stores I test.

Apparently, a request to Google for your custom fonts can block the main page load by nearly a second. This is solvable, as fonts can be loaded after your main page load. You sometimes see this when visiting sites where the font quickly swaps from default to custom. I'd get in touch with your theme developers and ask their advice on resolving this.

Good luck,

Oli

 

——————————

Founder @ www.preproduct.io

The smarter way to launch products. 

 

 

Menibig
Excursionist
16 0 5

Hey @OliUK,

I just found this long thread and appreciate your help for everyone.

My site score now is really bad with a very quick and surprising decrease in the last couple of weeks.
Is it possible to ask for a quick opinion and tips for my site? How can I make it faster for mobiles mostly? (especially product pages)

Click to expand...

Thanks.

OliUK
Shopify Partner
235 2 56

Hi @Menibig ,

No worries, I've just had a quick look.

Top of Google's recommendations is to add 'lazy load' images. This can be added to any image by including loading="lazy" to the <img  element. It ships with most Shopify themes these days, but it would be a quick job if you need to hire a developer to do it.

There's also a 'Social widget' (app I'm guessing) that blocks your initial page load by 780ms. might be worth getting in touch with the developers and asking if everything can be loaded 'async'.

Good luck!

Oli

 

——————————

Founder @ www.preproduct.io

The smarter way to launch products. 

 

 

 

purplelotus
Excursionist
23 0 8

@OliUK,

I just came across this post and was wondering if you could help me as well?

https://purple-lotus.ca

OliUK
Shopify Partner
235 2 56

Hi @purplelotus ,

If you google 'chrome lighthouse report' you'll be able to see some of the different areas for improvement.

It looks like you don't have your images set to lazy load. There's some instructions in this thread on how to do that.
Also, you score took a small hit as this GIF: https://cdn.shopify.com/s/files/1/0586/5160/7208/files/IMG_5353_1024x.gif?v=1632456077 should either be a jpeg/png/webp if it's a still image.

Cheers,

Oli

 

 

Motee
Tourist
4 0 0

Hi @OliUK,

I'm having the same problem and don't know where to find this unused code, I was wondering if you could help me as well?

https://elanesa.com/

OliUK
Shopify Partner
235 2 56

Hi @Motee ,

Yep sure. Google mentions that you should add lazy loading to your store. So images don't slow the page load down. (there are some instructions throughout this thread on how to do that)

Unused code wise, the biggest offender is your Facebook pixel. That's usually the case to be honest, so I wouldn't worry too much about that.
There's also some unused code from an app by a company called: simtechdev . It might be an idea to reach out to them and ask if they have any ideas on fixing this up.

Cheers,

Oli

 

3azzzeh
Excursionist
18 0 7

Hi @OliUK 

 

May I kindly ask you to have a look on my website: https://azkadenia.myshopify.com/
The performance is only 30% on Google-Speed-Inights

 

Any idea what could go in/out to speed up my web ? 
Many thanks in advance.

 

Best
Yazeed

Marc_Mayr
Shopify Partner
76 1 14

Hi, we faced the same issue that 3rd party apps loaded a lot of Javascript on every page, even tho the apps were sometimes only required on specific pages like cart, cms etc.
We developed an app that helps to manage where to load 3rd party Javascripts and where to block it.
https://apps.shopify.com/pagespeed-javascript

The app is still in an early stage and if you have any suggestions please let me know

 

Marc_M_0-1646899530582.png

 

nishanttbi
Explorer
68 2 8
  • Hi @TattooKits, You can follow these steps to clear your unused code. 

 

1. Scan through your theme.liquid file

2. Check if the file came from an app or not

  • To check if the file is from a Shopify app, just simply type in the Google search Shopify <keyword> app.

3. Check if the app is installed in the store

  • The next step is to check if the app is installed in your store.

    Go to your Shopify store admin page > Apps

    Then, scroll through and look for the app that contains the word sumo. If there’s no app, then that means the file sumo.liquid is unused

4. Remove the code & file

  • Just open your theme.liquid file again and just remove the line: {% include 'sumo' %}

 

5. Check if the changes you made caused an error

  • Once you have saved the file, open your Shopify store, navigate thoroughly around your store and check in the browser console if there is an error.

If there’s no error on each page then that means the file is safe to be deleted. Again, delete at your own risk.

Want to modify or custom changes on store hire me.
Email: info@brihaspatitech.com
If helpful then please Like and Accept the Solution.

ZakMillion
Visitor
1 0 0

@OliUK

Hi Oli, you sound so helpful and sound to know a lot. Complete novic with online stuff. Could you please take a sec and have a look at www.sootandty.com and see how i can get better with page speed? Thank you 

OliUK
Shopify Partner
235 2 56

HI @ZakMillion ,
I didn't see any low hanging fruit, but it's been a while since I've looked at a Google Lighthouse report and they've changed a bit.

Screenshot 2022-05-05 at 18.21.20.png

This is the unused Javascript section of your report and it looks pretty alright. Maybe running that Facebook service through Google Tag manager could help (the pixel stuff is a bit out of my wheelhouse these days though, and that might not be posssible).


Cheers,


Oli

behicozkan
Visitor
1 0 0

Hi @OliUK ,

 

My website's mobile performance looking bad. How can i reduce unused js or css codes.

May I ask you to have a look on my website: https://flamelilys.com/

TWBF
Shopify Partner
15 0 4

Hi Oli.

I'm having issues with PageSpeed, particularly in mobile version. Desktop I'm at 93 Speed, but mobile is like 50s. I don't understand, and I was hoping you could take a quick peek. http://www.thewoodbatfactory.com

Thanks!

moosaes
Tourist
8 0 0

I have two favors to ask, I had bugsnag installed and I uninstalled it but i can see its folder and three files still getting loaded on my webpage. I tried to download the theme and look for "bugsnag" in all files with no success, it also doesnt show on the embeded apps. How can I remove these files or prevent them from getting loaded.

 

My number 2 issue is the slowness of my website, I have tried to decrease the amount of apps but some i do need I also have tried to optimize the images, not sure what else to do. do you see anything significant that im missing?

My website is : https://dannicowoodworks.com/

 

I also thought Shopify gzips resources like images automatically but when i look at the network tab its not gziped , what am i missing?