ngx-hotjar
ngx-hotjar copied to clipboard
Production - error in conosle: this._hj is not a function
Is there anyway to prevent that?
@Svathna Are you using this package w/ angular universal or something like this? Which version are you using?
Does using this package with angular universal cause issues? I am using it with Scully and get the following error, which is somewhat similar to the issue above:
VM71 hotjar-2029657.js:3 Uncaught ReferenceError: hj is not defined
at window.hjBootstrap (VM71 hotjar-2029657.js:3)
at Object.331 (VM71 hotjar-2029657.js:3)
at n (VM71 hotjar-2029657.js:3)
at VM71 hotjar-2029657.js:3
at VM71 hotjar-2029657.js:3
same issue here. not using universal just a standard angular setup.
hotjar works in general (script is injected and recordings are made) but apparently the service does not get the hj
script.
accessing hj directly in a "dirty" way works:
const hj = (window as any).hj
hj('tagRecording', ['some-tag'])
i have the feeling the script might not be available at the time it is injected into NgxHotjarService
I had issue with Angular version 13.0.3 and I am using SSR.
I fixed that by placing below script at the top of index.html
<script>
window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments)};
</script>
hi, I receive same error and I noticed that it appear on application not connected to hotjar generally speaking I tried in dev env and it fails, but in prod(connected to hotjar) works as expected