Skip to content

Webbrother/user-activity-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

user-activity-logger

npm commands

  • use npm start to start local server (it opens demo page where you can test logger)
  • use npm run build to build library

How to use

  1. Add script to your page
<script type="text/javascript" src="logger.min.js"></script>
  1. 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>
  1. Destroy logger when you need it
window.userActivityLogge.destroy();

Config

At the moment following eventTypes are supported: focus, click, keyup, copy, cut, paste, mousemove, scroll

We use debounce wrapper for mousemove and scroll events.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published