I was recently asked to change a script that is on this shopify website but I am unable to find it in either the backend settings or the actual code for the template. Could someone please point me in the right direction on how to change the code for this script? The pixel values are wrong here and it’s causing SEO issues:
<script>
//<![CDATA[
(function() {
function asyncLoad() {
var urls = ["//productreviews.shopifycdn.com/assets/v4/spr.js?shop=myshop.myshopify.com","//www.beetailer.com/javascripts/beecart.js?shop=myshop.myshopify.com","https://media.conversio.com/scripts/shopify.js?shop=myshop.myshopify.com","https://s3.amazonaws.com/lastsecondcoupon/js/freeshippingbar.js?shop=myshop.myshopify.com","//facebook.shopifycdn.com/tracking_pixels/123.js?shop=myshop.myshopify.com","//facebook.shopifycdn.com/conversion_pixels/123.js?shop=myshop.myshopify.com","//notifyapp.io/js/1463319629/loader.js?shop=myshop.myshopify.com","https://embed.tawk.to/widget-script/58065fec304e8e75855e4cce/default.js?shop=myshop.myshopify.com","https://www.affiliatly.com/shopify/shopify.js?affiliatly_code=AF-10200u0026shop=myshop.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);
}
}
window.attachEvent ? window.attachEvent('onload', asyncLoad) : window.addEventListener('load', asyncLoad, false);
})();
//]]>
</script>
3
Answers
It looks like the function above is loading the java script (
.js
files) dynamically in the code and adding the script to the domain:You would need to download the
.js
files (url are listed in the code), modify them, and change the path so that the above function can load them from a local path.Following array is URL to all the JS scripts… Each of the item in this array is loaded after page loads.
This code is included by Shopify as a part of the
{{ content_for_header }}
Liquid variable in the layout files (e.g. theme.liquid.)The JavaScript files would be ScriptTag scripts that have been added to the store by Shopify apps that you have installed. For example https://productreviews.shopifycdn.com/assets/v4/spr.js belongs to the Product Reviews app.
These scripts are hosted by the app developers so you won’t be able to edit them directly. You can remove a ScriptTag script by uninstalling the Shopify app that placed it there.