Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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?
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.
Thanks,
Ishan
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
setTimeout(function(){
/* 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.
Gina
Hello @GoBlue
You need to focus on the following things:
Double Loaded Scripts, Due to App
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.
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025