analytics.js-integrations icon indicating copy to clipboard operation
analytics.js-integrations copied to clipboard

fail to load heap-{id}.js when the website is under http

Open jovezhong opened this issue 4 years ago • 0 comments

Greetings,

The issue is if the website is running under http instead of https (which could be common at development phase), the heap integration will be broken, since it will use the current website schema to load the heap.js from CDN. However while issuing the http://cdn.heapanalytics.com/js/heap-"+e+".js, this will be an error (actually 302 redirect to https://cdn.heapanalytics.com/js/heap-"+e+".js), but the browser (at least for Mac Safari) will fail to load such file. The fix is easy, always load the heap.js from CDN via https

https://github.com/segmentio/analytics.js-integrations/blob/0c0f9eb070e61f1f43c014062d3c5df1ccfd12e4/integrations/heap/lib/index.js#L24

jovezhong avatar Oct 28 '21 04:10 jovezhong