react-hotjar
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -18,2 +18,18 @@ export module hotjar { | ||
): void; | ||
/** | ||
* Add an event to the current session | ||
* @param event Event to add to the session | ||
*/ | ||
export function event( | ||
event: string | ||
): void; | ||
/** | ||
* Update the state of the SPA | ||
* @param relativePath Current page URL (such as `product/red-trainer`) | ||
*/ | ||
export function stateChange( | ||
relativePath: string, | ||
): void; | ||
} |
16
index.js
var hotjar = require('./src/react-hotjar'); | ||
function hj(...params) { | ||
if (!window.hj) { | ||
throw new Error('Hotjar is not initialized'); | ||
} | ||
window.hj(...params); | ||
} | ||
module.exports = { | ||
@@ -9,5 +17,11 @@ hotjar: { | ||
identify: function identify(userId, properties) { | ||
hotjar('identify', userId, properties); | ||
hj('identify', userId, properties); | ||
}, | ||
event: function event(event) { | ||
hj('event', event); | ||
}, | ||
stateChange: function stateChange(relativePath) { | ||
hj('stateChange', relativePath); | ||
} | ||
} | ||
}; |
{ | ||
"name": "react-hotjar", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "Small component to implement Hotjar into your react application", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,4 +14,11 @@ # react-hotjar | ||
hotjar.initialize(hjid, hjsv); | ||
<!-- Optional identify call --> | ||
// Identify the user | ||
hotjar.identify('USER_ID', { userProperty: 'value' }); | ||
// Add an event | ||
hotjar.event('button-click'); | ||
// Update SPA state | ||
hotjar.stateChange('/my/page'); | ||
``` | ||
@@ -18,0 +25,0 @@ - hjid: Stands for 'Hotjar ID' - Your site's ID. This is the ID which tells Hotjar which site settings it should load and where it should save the data collected. |
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
4825
74
29