react-use-hotjar
Advanced tools
Comparing version
@@ -5,2 +5,4 @@ # Changelog | ||
### [1.0.6](https://github.com/olavoparno/react-use-hotjar/compare/v1.0.5...v1.0.6) (2020-08-11) | ||
### [1.0.5](https://github.com/olavoparno/react-use-hotjar/compare/v1.0.4...v1.0.5) (2020-08-11) | ||
@@ -7,0 +9,0 @@ |
declare type TUseHotjar = { | ||
initHotjar: (hotjarId: string, hotjarVersion: string, logCallback?: () => void) => boolean; | ||
identityHotjar: (userId: string, userInfo: string, logCallback?: () => void) => boolean; | ||
identifyHotjar: (userId: string, userInfo: string, logCallback?: () => void) => boolean; | ||
}; | ||
export declare function useHotjar(): TUseHotjar; | ||
export {}; |
@@ -30,6 +30,6 @@ import { useCallback, useMemo } from 'react'; | ||
}, [appendHeadScript]); | ||
var identityHotjar = useCallback(function (userId, userInfo, loggerFunction) { | ||
var identifyHotjar = useCallback(function (userId, userInfo, loggerFunction) { | ||
try { | ||
var hotjarIdentityScript = "var userId=\"" + userId + "\" || null;window.hj(\"identify\",userId," + userInfo + ");"; | ||
var isIdentified = appendHeadScript(hotjarIdentityScript, 'identity-script'); | ||
var hotjarIdentifyScript = "var userId=\"" + userId + "\" || null;window.hj(\"identify\",userId," + userInfo + ");"; | ||
var isIdentified = appendHeadScript(hotjarIdentifyScript, 'identify-script'); | ||
if (loggerFunction && typeof loggerFunction === 'function') | ||
@@ -44,5 +44,5 @@ loggerFunction("Hotjar identified: " + isIdentified); | ||
}, [appendHeadScript]); | ||
return useMemo(function () { return ({ initHotjar: initHotjar, identityHotjar: identityHotjar }); }, [ | ||
return useMemo(function () { return ({ initHotjar: initHotjar, identifyHotjar: identifyHotjar }); }, [ | ||
initHotjar, | ||
identityHotjar, | ||
identifyHotjar, | ||
]); | ||
@@ -49,0 +49,0 @@ } |
@@ -34,6 +34,6 @@ 'use strict'; | ||
}, [appendHeadScript]); | ||
var identityHotjar = React.useCallback(function (userId, userInfo, loggerFunction) { | ||
var identifyHotjar = React.useCallback(function (userId, userInfo, loggerFunction) { | ||
try { | ||
var hotjarIdentityScript = "var userId=\"" + userId + "\" || null;window.hj(\"identify\",userId," + userInfo + ");"; | ||
var isIdentified = appendHeadScript(hotjarIdentityScript, 'identity-script'); | ||
var hotjarIdentifyScript = "var userId=\"" + userId + "\" || null;window.hj(\"identify\",userId," + userInfo + ");"; | ||
var isIdentified = appendHeadScript(hotjarIdentifyScript, 'identify-script'); | ||
if (loggerFunction && typeof loggerFunction === 'function') | ||
@@ -48,5 +48,5 @@ loggerFunction("Hotjar identified: " + isIdentified); | ||
}, [appendHeadScript]); | ||
return React.useMemo(function () { return ({ initHotjar: initHotjar, identityHotjar: identityHotjar }); }, [ | ||
return React.useMemo(function () { return ({ initHotjar: initHotjar, identifyHotjar: identifyHotjar }); }, [ | ||
initHotjar, | ||
identityHotjar, | ||
identifyHotjar, | ||
]); | ||
@@ -53,0 +53,0 @@ } |
{ | ||
"name": "react-use-hotjar", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Add Hotjar capabilities as custom hooks", | ||
@@ -5,0 +5,0 @@ "author": "Olavo Parno", |
# react-use-hotjar | ||
> Add [Hotjar](https://www.hotjar.com/) capabilities as custom hooks to your project | ||
> Adds [Hotjar](https://www.hotjar.com/) capabilities as custom hooks to your project | ||
@@ -28,3 +28,3 @@ [](https://www.npmjs.com/package/react-use-hotjar) | ||
- Initializing Hotjar | ||
- Initializing Hotjar (use it at your very `index.jsx`) | ||
@@ -49,3 +49,3 @@ ```tsx | ||
- Identifying Users | ||
- Identifying Users (use it wherever you get access to user's information) | ||
@@ -59,3 +59,3 @@ ```tsx | ||
identityHotjar( | ||
identifyHotjar( | ||
id, | ||
@@ -90,3 +90,3 @@ JSON.stringify({ | ||
- identityHotjar() | ||
- identifyHotjar() | ||
@@ -98,3 +98,3 @@ 1. `userId`: Unique user's identification as string | ||
```tsx | ||
identityHotjar: (userId: string, userInfo: string, logCallback?: () => void) => | ||
identifyHotjar: (userId: string, userInfo: string, logCallback?: () => void) => | ||
boolean; | ||
@@ -101,0 +101,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20079
0.95%