How can I reduce unused Javascript to improve mobile speed?

Hi,

I am looking to improve my mobile speed score, I currently have 88 on desktop but 39 on mobile.

The page I am working on: https://pawcopets.co.uk/products/calming-dog-bed

I am working on the ‘properly size images’ side, but I cannot understand the ‘Reduce unused JavaScript’

Is it possible to remove any of the following scripts if they are not essential?

Specifically I was wondering about this one from Facebook: https://connect.facebook.net/signals/config/287647222909118?v=2.9.92&r=stable

I have the facebook channel, is it linked to this?

Also the shopify ones

https://cdn.shopify.com/s/files/1/0568/1512/4688/t/32/assets/nt_vendor2.min.js?v=42422918620433123951653649897

https://cdn.shopify.com/shopifycloud/payment-sheet/assets/latest/b34f93ed7f63945a1055.dcc-442.en.js

There is also a line from afterpay, i do not even have/use this app. How and where can I remove this please?

Any help is much appreciated

Thomas

Hello @thomasmrgn99 I have checked the page in google page speed https://pagespeed.web.dev/report?url=https%3A%2F%2Fpawcopets.co.uk%2Fproducts%2Fcalming-dog-bed&form_factor=mobile

Mobile scores: 37

You can try to optimize following issues

Properly size images ( resize and convert them as webp)

Reduce unused JavaScript ( Try inline them if available in theme files)

Eliminate render-blocking resources (Inline css/js files)

Reduce unused CSS (inline css files)

Serve images in next-gen formats (convert the images to webp and reupload)

Defer offscreen images (Add lazyload)

If you are unable to optimize them you can pick any shopify developer.

Hi @kazi_1 , I also did the speed test on google so I also read everything that you copy/pasted off google. Which is why I asked in my message if anyone could help specifically with the japascript.

1 Like

Hello @thomasmrgn99 you can hire any shopify developer you can find them here and there also in shopify expert https://experts.shopify.com/

@thomasmrgn99

It is a third-party app for the Facebook app. It is the 3rd party js file, as you can not remove it. If you remove then the app may not work.

Also, the other two js file cannot be removed. Are you using any app for payment sheets? or Shopify cloud. If yes then you cant remove it.

Work on these points :

  • Theme Upgrade if there is a scope and upgraded theme available
  • Reduce JS Payload.
  • Use Critical CSS.
  • Replace GIFs With Static Images
  • Reduce Large Image Sizes
  • Migrate Tracking Codes To Google Tag Manager
  • Compress Images
  • Limit Third-Party JavaScript & Shopify Apps
  • Preload Web Fonts.
  • I suggest limiting it to one and using a standard web font.

https://www.oscprofessionals.com/blog/shopify-speed-optimization-guide/

If anything needs to be included or clarified then feel free to ask. We will surely help you.

Have a nice day!