- use
npm start
to start local server (it opens demo page where you can test logger) - use
npm run build
to build library
- Add script to your page
<script type="text/javascript" src="logger.min.js"></script>
- Initialyze logger
<script>
(function() {
'use strict';
var commonData = {
// workerId: *required
//
// Put here common data which should be sent within log information
// Example:
// taskId: parseInt(document.getElementById("assignment-job-id").innerHTML),
}
window.addEventListener('load', function() {
var config = {
api: {
url: 'https://example.com',
method: 'post'
},
requestInterval: 5000,
eventTypes: [
'start',
'focus',
'click',
'submit'
'keyup',
'copy',
'cut',
'paste',
'mousemove',
'scroll'
],
debounceInterval: 200,
commonData: commonData
};
window.userActivityLogger.init(config);
});
})();
</script>
- Destroy logger when you need it
window.userActivityLogge.destroy();
At the moment following eventTypes are supported: focus, click, keyup, copy, cut, paste, mousemove, scroll
We use debounce wrapper for mousemove
and scroll
events.