JS From Facebook is causing our site to slow. Is there a fix for this?

16 0 4

I'm looking at Page Speed Insights and GT Metrix. The top thing that's causing our site to run slow is JS from Facebook. Is there any way to improve this JS from FB without messing stuff up? 

Replies 3 (3)

Shopify Expert
115 7 8

Hi @GoBlue , 
If you are talking about a share button or feed, then you should remove them. or you can simply replace share buttons with non-js buttons.
I would think you talking about JS tracking code that fb pixel uses.
Ideally you can remove this code but that will mean you will not get data insights on facebook.

so there is not such solution as off now for this.

You can make other improvement to your store for speed optimization.
You can use https://websitespeedy.com to implement lazy loading and fix render blcoking issues which will improve the speed and gtmatrix score for you.


Shopify Expert Since 2012
Sr. Web Solution Manager at MakkPress Technologies
Website Speedy (SAAS tool for Shopify Speed Optimization - Trusted by over 300 Shopify store owners)
Contact Us or Hire Us Or Email Us

Shopify Partner
2405 223 535

Hello @GoBlue,


I am Gina from flareAI app helping Shopify merchants get $6Million+ in sales from Google Search, on autopilot. I am here to support you.

There are a few things you can do to improve the performance of JS from Facebook on your Shopify store.

1. Minimize the use of Facebook JavaScript
If you're using Facebook JavaScript for multiple features like social media buttons, tracking codes, and chatbots, try to limit the use of JS from Facebook to only essential features.

2. Use Facebook JavaScript asynchronously
Asynchronous loading of JS from Facebook ensures that it doesn't block other elements from loading. This will reduce the load time of your website. You can use the "async" attribute in your code to load Facebook JS asynchronously.

3. If Facebook Pixel is taking time to load, delay the snippet’s execution until after the page has loaded by wrapping our script with the following code
/* Facebook Pixel Code */
}, 3000);
4. Remove unnecessary Facebook scripts
If you have multiple Facebook scripts running on your website, consider removing the ones that are not essential. This will reduce the number of requests made to Facebook servers, thereby improving your website's load time.

By applying these steps, you can enhance the speed and functionality of your Shopify store while maintaining the necessary features of JS from Facebook.

Let me know if you have any further questions.


flareAI : Get Sales from Google Search, on Autopilot
$10+ billion in eCommerce on Google Search, every day. Find out how much you are missing

Shopify Partner
15843 2371 3073

Hello @GoBlue 

You need to focus on the following things:


Double Loaded Scripts, Due to App

We can check if the app scripts are loading and whether the scripts are double-loaded.
As an example, We have the Social Media App – Facebook, which shows two scripts loaded through the app.
In this case, the scripts were probably added twice to theme.liquid, product.liquid, collection.liquid and index.liquid, so we will check the liquid files to confirm and remove one of the scripts.
In the other case, if there is a further Facebook pixel on your site that you didn’t add, it was probably added through an app on your site. so we have no control over these types of scripts because Facebook is a third-party app and this app doesn’t allow you to change or modify their script. Here you need to identify the app responsible for the pixel code and uninstall that app.
  • To remove an app, go to the admin dashboard and check if it’s been uninstalled.
  • Look at GSI: Reducing the impact of third-party code for third-party apps.
  • In liquid files, remove the code of the apps and remove any additional files added by the apps.
  • Check the View source for duplicate pixels, and either modify Liquid or uninstall the app that caused this JS inline insert.

Apps when installed may inject a few files into your Shopify theme. When removing unnecessary apps, you should also remove Shopify app files from your theme that were added. third-party code can Significantly impact load performance.

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Custom Pricing Wholesale App : Free | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing