How to prevent loading of unused JavaScript file

New Member
1 0 5

Hey everyone! I have a Shopify site that has quite a bit optimization potential that I'd like to squeeze out. 

This is Google's PageSpeed test for one of the pages:



As you can see, there's quite a bit of unused JavaScript that I'd like to get rid of.

Specifically I want to start by removing the top file:

I now searched through the source files in my Shopify project (using this Chrome extension) for a reference to that file, but couldn't find anything! Does anyone know a way how I can find out from where this JS file loaded into my site and how I can remove it?

We have this same exact question.  We've removed our FB Pixel, yet per google page speed report the unused fb pixel javascript is slowing down our site, but we can't figure out how to remove it.




Note we did already remove the Shopify Install of the FB Pixel 


As a test, we even tried adding a '123' to it subsequently and found that just added 2 fb pixel ids.


Any help greatly appreciated!




I wonder that too and to be honest, although I'd like to be wrong, I don't think it's possible since those files are coming from external sources.

The only solution I found was to reduce third party apps/scripts the most I can. 

I have thought about a few things like:

1. Identifying and removing scripts before loading the page (adding them right above </head>)


2. Also I have seen solutions in the past by companies doing speed optimizations with Shopify that is something like this:

    setTimeout(function() {
      function asyncLoad() {
        var urls = ["\/\/\/apps\/coin\/coin.js?","https:\/\/\/RememberMyCart\/Manage\/CartJS?\","https:\/\/\/quantity_breaks.php?","https:\/\/\/widget\/N1ZIsn19fS\/loox.js?"];
        for (var i = 0; i <urls.length; i++) {
          var s = document.createElement('script');
          s.type = 'text/javascript';
          s.async = true;
          var x = document.getElementsByTagName('script')[0];
          x.parentNode.insertBefore(s, x);
      if(window.attachEvent) {
        window.attachEvent('onload', asyncLoad);
      } else {
        window.addEventListener('load', asyncLoad, false);

the urls variable is added manually. In every Shopify store you can find a list of all the Javascript being injected by the apps, so basically their intent was to load the apps later (?) I'm not entirely sure, but I'm leaving it here if anyone wants to play around with it.

Anyhow, please do let me know if you find a solution!

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Using a free theme? Improve it with copy/paste code snippets clicking here.
◦ Looking to hire an experienced developer? Same day response:
17 0 4

Does anyone know a way how I can find out from where this JS file loaded into my site and how I can remove it?


I have been going crazy with this for the past 5 days.  In addition to removing the FB pixel (in shopify) - have also uninstalled the FB shopping app - and tried to remove the connection to our site (and the pixel) from within the Facebook Business Manager.  Absolutely nothing seems to make a difference?  


Even when I view the Source Code of our pages - nothing related to this FB file is found anywhere - So - where is it coming from?

6 0 1

Under your settings_data.json,


Change your 

"share_facebook": true, 




"share_facebook": false,


Like if this helped you.

New Member
1 0 0

This did not help me. Has anyone figured out a solution?