Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
react-use-hotjar
Advanced tools
Adds Hotjar capabilities as custom hooks to your project
Statements | Branches | Functions | Lines |
---|---|---|---|
npm install --save react-use-hotjar
import * as React from 'react';
import useHotjar from 'react-use-hotjar';
const myCustomLogger = console.info;
const HotjarReadyApp = () => {
const { initHotjar } = useHotjar();
React.useEffect(() => {
initHotjar(1234567, 6, false, myCustomLogger);
}, [initHotjar]);
return <App />;
};
import * as React from 'react';
import useHotjar from 'react-use-hotjar';
const myCustomLogger = console.log;
const MyCustomComponent = () => {
const { identifyHotjar } = useHotjar();
const handleUserInfo = (userInfo) => {
const { id, ...restUserInfo } = userInfo;
identifyHotjar(id, restUserInfo, myCustomLogger);
};
};
useHotjar()
returns:
key | description | arguments | example |
---|---|---|---|
readyState | States if Hotjar is ready | N/A | N/A |
initHotjar | Initialize method | (hotjarId: number, hotjarVersion: number, hotjarDebug?: boolean, loggerCallback?: console[method]) | (1933331, 6, false, console.info) |
identifyHotjar | User identify API method | (userId: string, userInfo: object, loggerCallback?: console[method]) | ('abcde-12345-12345', {name:"Olli",surname:"Parno",address:"Streets of Tomorrow"}, console.log) |
stateChange | Relative path state change | (relativePath: string, loggerCallback?: console[method]) | ('route/logged-route/user?registered=true') |
tagRecording | Tag a recording | (tags: string[], loggerCallback?: console[method]) | (['tag1', 'tag2']) |
hotjarId
: Your Hotjar application ID ex.: 1933331hotjarVersion
: Hotjar's current version ex.: 6hotjarDebug
: Optional Debug Mode to see hotjar logs in console ex.: truelogCallback
: Optional callback for logging whether Hotjar is ready or notinitHotjar: (
hotjarId: string,
hotjarVersion: string,
hotjarDebug?: boolean,
logCallback?: () => void
) => boolean;
userId
: Unique user's identification as stringuserInfo
: User info of key-value pairs (note this must not be so long and deep according to docs) (Please note: The Identify API is only available to Business plan customers.)logCallback
: Optional callback for logging whether Hotjar identified user or notidentifyHotjar: (userId: string, userInfo: object, logCallback?: () => void) =>
boolean;
relativePath
: A change in a route specially for SPAs usage. stateChange docslogCallback
: Optional callback for logging whether Hotjar stateChange was called or notstateChange: (relativePath: string, logCallback?: () => void) => boolean;
tags
: List of strings to associate with a recording that can be used for filteringlogCallback
: Optional callback for logging whether Hotjar tagRecording was called or nottagRecording: (tags: string[], logCallback?: () => void) => boolean;
Thanks goes to these wonderful people (emoji key):
Olavo Parno 🤔 💻 ⚠️ | Gianpietro Lavado 📖 | Ivan Kleshnin 💻 🤔 | Ajay Varghese 💻 🤔 | honicole 🔧 💻 🤔 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!
react-use-hotjar is MIT licensed.
This hook is created using create-react-hook.
FAQs
Adds Hotjar capabilities as custom hooks
The npm package react-use-hotjar receives a total of 3,503 weekly downloads. As such, react-use-hotjar popularity was classified as popular.
We found that react-use-hotjar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.