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, 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;
const informationStringified = JSON.stringify(restUserInfo);
identifyHotjar(id, informationStringified);
};
};
useHotjar()
returns:
key | description | arguments | example |
---|---|---|---|
initHotjar | Initialize method | (hotjarId: number, hotjarVersion: number, loggerCallback?: console[method]) | (1933331, 6, console.info) |
identifyHotjar | User identify API method | (userId: string, userInfo: json object, loggerCallback?: console[method]) | ('abcde-12345-12345', JSON.stringify({name:"Olli",surname:"Parno",address:"Streets of Tomorrow"}), console.log) |
hotjarId
: Your Hotjar application ID ex.: 1933331hotjarVersion
: Hotjar's current version ex.: 6logCallback
: Optional callback for logging wether Hotjar is ready or notinitHotjar: (
hotjarId: string,
hotjarVersion: string,
logCallback?: () => void
) => boolean;
userId
: Unique user's identification as stringuserInfo
: Stringfied 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 wether Hotjar identified user or notidentifyHotjar: (userId: string, userInfo: string, logCallback?: () => void) =>
boolean;
Thanks goes to these wonderful people (emoji key):
Olavo Parno 🤔 💻 ⚠️ | Gianpietro Lavado 📖 |
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.