How to remove leftover Beeketing app code from my website?

How to remove leftover Beeketing app code from my website?

Jacob_D
Shopify Partner
10 0 0

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.

Replies 7 (7)

AlexHodzitsky
Shopify Partner
73 19 27

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?

I didn't choose the Shopify, the Shopify chose me.
Linkedin: alex-hodzitsky
Jacob_D
Shopify Partner
10 0 0

Thanks for reaching out. The script is not present in the list.

AlexHodzitsky
Shopify Partner
73 19 27

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.

I didn't choose the Shopify, the Shopify chose me.
Linkedin: alex-hodzitsky
AlexHodzitsky
Shopify Partner
73 19 27

That script is not inside the content_for_header object. I think you can find it in the bk-tracking.liquid snippet.

I didn't choose the Shopify, the Shopify chose me.
Linkedin: alex-hodzitsky
Jacob_D
Shopify Partner
10 0 0

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 -->

 

 

AlexHodzitsky
Shopify Partner
73 19 27

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.

I didn't choose the Shopify, the Shopify chose me.
Linkedin: alex-hodzitsky
Jacob_D
Shopify Partner
10 0 0

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.