Shopify/slate

bugsnag broke script on product page

kochnevalex opened this issue ยท 8 comments

I use theme slate v1.

<script type="module" defer="" src="https://cdn.shopify.com/shopifycloud/media-analytics/v0.1/analytics.js"></script> this script plugs bugsnag //d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js after this script includes. All scripts don't work on shop

//d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js this script broke theme's script if it is loaded before theme scripts.

i found out that when bugsnag is loaded before theme's script, all theme's scripts on product page don't work

https://prnt.sc/sdeger

it's not my script, i found an article that's shopify's script

https://www.bugsnag.com/customers/shopify

Please help how to remove bugsnag
Is it shopify's script on in theme?

it happens when on product page exist video tag

@kochnevalex did you ever figure out a workaround for this? I noticed the same thing (for me it's hijacking the click events so my sliders will sometimes not work)

@clin407 i did not find issue. Now i just remove from product page. Shopify support can't give me answer how to remove bugsnag from store

I was able to resolve this by preventing bugnsag from loading with https://github.com/snipsco/yett
In of layout.liquid before {{content_for_header}}

{% if product %}
  {% comment %}blocks bugsnag from loading on product pages so we can load media objects and keep our scripts at the end of the page {% endcomment %}
  <script>
      window.YETT_BLACKLIST = [
        /bugsnag\.min\.js/,
      ]
    </script>

  <script src="https://unpkg.com/yett"></script>
  {% endif %}

Hard to believe that this would be a Slate theme issue โ€“ this script is going to be loaded regardless. Really odd that Shopify hasn't done anything about this. Regardless, @calebcurtis8 your solution saved me. Thank you!

If anyone's have this issue, I managed to pinpoint the issue to a "beta" flag inside an array in the "content_for_header". My guess is that shopify added this with the addition of videos and 3d object in products media for monitoring this new feature. For me bugsnag was randomly overwriting setTimout which was breaking some features and affecting performance.

My solution was to remove the flag in liquid like that:

{% capture shopify_content_for_header %}
    {{ content_for_header }}
{% endcapture %}
{{ shopify_content_for_header | replace: ',"rich-media-storefront-analytics"', '' | replace: '"rich-media-storefront-analytics"', '' }}

Not using Slate, and spent the entire day trying to understand why I was running into issues with bugsnag on my site. @calebcurtis8 solution also did the trick for me. Thank you! What a pain.

We have removed bugsnag from the media-analytics script. It should be on the cdn within the next hour.