klaviyo / magento2-klaviyo

37 stars 51 forks source link

ReferenceError: Can't find variable: _learnq #47

Closed clivewalkden closed 5 years ago

clivewalkden commented 5 years ago

Hi,

I'm getting this on latest 1.1.2 version and Magento 2.3.2 Reporting about 700 errors on a newly launched site (via Sentry.io) in approximately 48 hours. Happening across multiple browsers and devices.

Same issue reported in reports #16 and #42 I'm not sure what percentage of users are getting this issue.

remstone7 commented 5 years ago

I'm not able to reproduce this on my testing - have tried with M2.1.1 and just did with 2.3.2 - should have been fixed with #43. Do you have any repro steps? I will continue to look into this...

remstone7 commented 5 years ago

addressed again in #46

clivewalkden commented 4 years ago

@remstone7 sorry to take so long to get back, this is caused by uBlock Origin blocking the https://static.klaviyo.com/onsite/js/klaviyo.js file being loaded. Can there be some check on the _learnq variable to stop this error appearing in the console and causing knock on issues on the page due to the JS error?

remstone7 commented 4 years ago

yea so we should be doing something like:

var _learnq = _learnq || []; which would remove this from happening.. https://github.com/klaviyo/magento2-klaviyo/blob/3a1ddde65896304f2c087f1f69d6fba194434648/view/frontend/templates/product/viewed.phtml#L7 https://github.com/klaviyo/magento2-klaviyo/blob/3a1ddde65896304f2c087f1f69d6fba194434648/view/frontend/web/js/customer.js#L8 https://github.com/klaviyo/magento2-klaviyo/blob/71a485a0b658bb4f54f2489fbde86901fd111b7c/view/frontend/web/js/view/checkout/email.js#L33

this should cover it.. this is resolved based on the above, are you on the updated versions?

clivewalkden commented 4 years ago

@remstone7 I'll get the latest version installed and confirm

Thanks!