Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Our site used to have an app called Beeketing, then, apparently, it was improperly uninstalled, and the following code still gets injected in content_for_header:
(function (doc, scriptPath) {
var sc, node, today=new Date(),dd=today.getDate(),mm=today.getMonth()+1,yyyy=today.getFullYear();if(dd<10)dd='0'+dd;if(mm<10)mm='0'+mm;today=yyyy+mm+dd;
// Load base script tag
sc = doc.createElement("script");
sc.type = "text/javascript";
sc.async = !0;
sc.src=scriptPath + '?' + today;
node = doc.getElementsByTagName("script")[0];
node.parentNode.insertBefore(sc, node);
})(document, 'https://sdk.beeketing.com/js/beeketing.js');
};
How do I get rid of it? Support directed me to ask here.
Hi, Jacob!
I want to help find a way to solve your problem. Can you tell me if the sdk beeketing script is in the script_tags list, which can be seen at this URL ${YOUR_STORE}.myshopify.com/admin/api/2020-01/script_tags.json?
Thanks for reaching out. The script is not present in the list.
So are you sure that this script is in the content_for_header? Could i take a look inside your theme code? You can write me a personal message for further discussion of the problem.
That script is not inside the content_for_header object. I think you can find it in the bk-tracking.liquid snippet.
We don't have "bk-tracking" snippet, or any other snippet, containing this code.
Here's part of our theme.liquid:
<!-- content_for_header start -->
{{ content_for_header }}
<!-- content_for_header end -->
and that's how resulting html code looks like:
<!-- content_for_header start -->
...
(function (doc, scriptPath) {
var sc, node, today=new Date(),dd=today.getDate(),mm=today.getMonth()+1,yyyy=today.getFullYear();if(dd<10)dd='0'+dd;if(mm<10)mm='0'+mm;today=yyyy+mm+dd;
// Load base script tag
sc = doc.createElement("script");
sc.type = "text/javascript";
sc.async = !0;
sc.src=scriptPath + '?' + today;
node = doc.getElementsByTagName("script")[0];
node.parentNode.insertBefore(sc, node);
})(document, 'https://sdk.beeketing.com/js/beeketing.js');
};
...
<!-- content_for_header end -->
In this case, I have a hack solution for you using a replace/remove filters for a content_for_header object to remove an unnecessary script.
https://shopify.dev/docs/themes/liquid/reference/filters/string-filters#remove
https://shopify.dev/docs/themes/liquid/reference/filters/string-filters#replace
You can find use cases in this discussion -> https://community.shopify.com/c/Shopify-Discussion/Benefits-of-content-for-header/m-p/686606/highlig...
But be careful if you use this method.
Thanks, I'm aware of this method. Was hoping to find a more civilized approach 🙂 Looks like I'll have to use this manipulation since support isn't helpful.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024