@hotjar/browser
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -5,2 +5,4 @@ # Changelog | ||
### 1.0.7 (2023-02-15) | ||
### 1.0.6 (2022-05-30) | ||
@@ -7,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
const r=()=>"undefined"!=typeof window,t=()=>!(!r()||!window.hj),e=(t,...e)=>{if(r()&&window.hj)return window.hj(t,...e);throw Error("Hotjar is not available, make sure init has been called.")},n=(r,e,n)=>{if(!((r,t)=>{try{const e=document.getElementById(t)||document.createElement("script");return e.id=t,e.innerText=r,e.crossOrigin="anonymous",document.head.appendChild(e),!0}catch(r){return!1}})(`(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:${r},hjsv:${e},hjdebug:${(null==n?void 0:n.debug)||!1}};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');`,"hotjar-init-script")||!t())throw Error("Failed to initialize Hotjar tracking script.")},o={init:(r,t,e)=>{try{return n(r,t,e),!0}catch(r){return console.error("Error:",r),!1}},event:r=>{try{return e("event",r),!0}catch(r){return console.error("Error:",r),!1}},identify:(r,t)=>{try{return e("identify",r,t),!0}catch(r){return console.error("Error:",r),!1}},stateChange:r=>{try{return e("stateChange",r),!0}catch(r){return console.error("Error:",r),!1}},isReady:t};export default o; | ||
const r=()=>"undefined"!=typeof window,t=()=>!(!r()||!window.hj),e=(t,...e)=>{if(r()&&window.hj)return window.hj(t,...e);throw Error("Hotjar is not available, make sure init has been called.")},n=(r,e,n)=>{if(!((r,t,e)=>{try{const n=document.getElementById(t)||document.createElement("script");return n.id=t,n.nonce=e,n.innerText=r,n.crossOrigin="anonymous",document.head.appendChild(n),!0}catch(r){return!1}})(`(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:${r},hjsv:${e},hjdebug:${(null==n?void 0:n.debug)||!1}};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');`,"hotjar-init-script",null==n?void 0:n.nonce)||!t())throw Error("Failed to initialize Hotjar tracking script.")},o={init:(r,t,e)=>{try{return n(r,t,e),!0}catch(r){return console.error("Error:",r),!1}},event:r=>{try{return e("event",r),!0}catch(r){return console.error("Error:",r),!1}},identify:(r,t)=>{try{return e("identify",r,t),!0}catch(r){return console.error("Error:",r),!1}},stateChange:r=>{try{return e("stateChange",r),!0}catch(r){return console.error("Error:",r),!1}},isReady:t};export default o; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const r=()=>"undefined"!=typeof window,t=()=>!(!r()||!window.hj),e=(t,...e)=>{if(r()&&window.hj)return window.hj(t,...e);throw Error("Hotjar is not available, make sure init has been called.")},n=(r,e,n)=>{if(!((r,t)=>{try{const e=document.getElementById(t)||document.createElement("script");return e.id=t,e.innerText=r,e.crossOrigin="anonymous",document.head.appendChild(e),!0}catch(r){return!1}})(`(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:${r},hjsv:${e},hjdebug:${(null==n?void 0:n.debug)||!1}};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');`,"hotjar-init-script")||!t())throw Error("Failed to initialize Hotjar tracking script.")},o={init:(r,t,e)=>{try{return n(r,t,e),!0}catch(r){return console.error("Error:",r),!1}},event:r=>{try{return e("event",r),!0}catch(r){return console.error("Error:",r),!1}},identify:(r,t)=>{try{return e("identify",r,t),!0}catch(r){return console.error("Error:",r),!1}},stateChange:r=>{try{return e("stateChange",r),!0}catch(r){return console.error("Error:",r),!1}},isReady:t};exports.default=o; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const r=()=>"undefined"!=typeof window,e=()=>!(!r()||!window.hj),t=(e,...t)=>{if(r()&&window.hj)return window.hj(e,...t);throw Error("Hotjar is not available, make sure init has been called.")},n=(r,t,n)=>{if(!((r,e,t)=>{try{const n=document.getElementById(e)||document.createElement("script");return n.id=e,n.nonce=t,n.innerText=r,n.crossOrigin="anonymous",document.head.appendChild(n),!0}catch(r){return!1}})(`(function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:${r},hjsv:${t},hjdebug:${(null==n?void 0:n.debug)||!1}};a=o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');`,"hotjar-init-script",null==n?void 0:n.nonce)||!e())throw Error("Failed to initialize Hotjar tracking script.")},o={init:(r,e,t)=>{try{return n(r,e,t),!0}catch(r){return console.error("Error:",r),!1}},event:r=>{try{return t("event",r),!0}catch(r){return console.error("Error:",r),!1}},identify:(r,e)=>{try{return t("identify",r,e),!0}catch(r){return console.error("Error:",r),!1}},stateChange:r=>{try{return t("stateChange",r),!0}catch(r){return console.error("Error:",r),!1}},isReady:e};exports.default=o; | ||
//# sourceMappingURL=index.js.map |
declare type HotjarCommand = 'event' | 'identify' | 'stateChange'; | ||
export declare type InitOpts = { | ||
debug?: boolean; | ||
nonce?: string; | ||
}; | ||
@@ -5,0 +6,0 @@ export interface WindowWithHotjar extends Window { |
{ | ||
"name": "@hotjar/browser", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Bring Hotjar directly to your application", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -68,4 +68,21 @@ # @hotjar/browser | ||
## CSP | ||
If the project uses [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), you can add a special string to your server response headers so that the HotJar script loads without problems | ||
``` | ||
// Initializing with `nonce` option: | ||
Hotjar.init(siteId, hotjarVersion, { | ||
nonce: 'rAnDoM' | ||
}); | ||
``` | ||
``` | ||
Content-Security-Policy: | ||
script-src *.hotjar.com 'nonce-rAnDoM'; | ||
frame-src *.hotjar.com; | ||
``` | ||
## Example | ||
You can find a working example on [GitHub Pages](https://hotjar.github.io/hotjar-js/). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12877
35
88