Uncaught Reference Error in Theme Editor, when checking for "ShopifyAnalytics" to be undefined

5 0 1


so I built an app for Shopify which adds a visible element to the storefront. I want to give the merchant the opportunity to preview the element in the theme editor before activating it for the whole store. However, in Theme Editor my element won't be loaded and I get this error in my console: 



Uncaught ReferenceError: ShopifyAnalytics is not defined



This error occurs on this line, which actually should check for ShopifyAnalytics to be undefined:



if ($.type(ShopifyAnalytics) === 'undefined' || !ShopifyAnalytics.meta || !ShopifyAnalytics.meta.product)



I also tried using vanilla javascript typeof but it had the same outcome

I also tried $.type(ShopifyAnalytics) in the chrome console but there I get the error  "VM2253:1 Uncaught TypeError: Cannot read property 'type' of undefined"


In the normal Storefront everything is fine.

Why am I getting this Uncaught Reference in Theme Editor if I'm actually checking for it to be undefined?

It's my development store and I'm using the default theme Debut, if that helps.


Any help is appreciated