Cannot find where this script is being injected from

I have some scripts I’m trying to get running on my site but I suspect they are not working because of a syntax error of another piece of javascript in the code

(function() {
  function asyncLoad() {
    var urls = ["https:\/\/chimpstatic.com\/mcjs-connected\/js\/users\/xxxxxxxxxxx\/xxxxxxxxx.js?shop=xxx.myshopify.com","https:\/\/xxxxxxx.co\/js\/shopify_referral_serve.js?shop=xxx.myshopify.com","\/\/app.xxxxxxxx.org\/widget\/xxxxxxxxxxx.js?v=5\u0026shop=xxx.myshopify.com"];
    for (var i = 0; i < urls.length; i++) {
      var s = document.createElement('script');
      s.type = 'text/javascript';
      s.async = true;
      s.src = urls[i];
      var x = document.getElementsByTagName('script')[0];
      x.parentNode.insertBefore(s, x);
    }
  };
  if(window.attachEvent) {
    window.attachEvent('onload', asyncLoad);
  } else {
    window.addEventListener('load', asyncLoad, false);
  }
})();

If you see right before if(window.attachEvent), there is a syntax error because of the closing semi colon.

Anyone know how I can get to this script? I suspect it has to do with apps but I’m not sure.

Same here can’t find anything on this.

Some application that you installed is using remote script to work
https://help.shopify.com/en/api/reference/online-store/scripttag

@Tanner_Chung

Do you mean a script tag injecting a file with “Chimpstatic” in it? If so, this is coming from the MailChimp app.

Their latest version look like this:


So how do we locate and remove this?

See this thread:

https://community.shopify.com/c/technical-q-a/what-drives-this-script/td-p/659748

Solution at the end.