Actively
Actively track user engagement and know when they move away from your page.
Install
npm install --save actively
Example - basic
;const active = timeIntervalEllapsedCallbacks: absoluteTimeEllapsedCallbacks: browserTabInactiveCallbacks: browserTabActiveCallbacks: idleTimeoutMs: 3000 checkCallbacksIntervalMs: 250 windowwindow
Example - Advanced
;const active = timeIntervalEllapsedCallbacks: absoluteTimeEllapsedCallbacks: browserTabInactiveCallbacks: browserTabActiveCallbacks: idleTimeoutMs: 3000 checkCallbacksIntervalMs: 250 windowwindow const cb = time + 60 * 5 * 1000 // Every 5 minutes timeInMilliseconds: 0 { console }active const callback = console;active var ActiveTimeIntervals = activetimes; // array of time periods with user activity
API
Public methods
running Bool
Shows is user is active on current webpage and the timer is running.
times Array
Array of timeDurations when the user was active.
Each time duration is
Object start: Date stop: Date
idle Bool
True when the user is inactive on current webpage and the timer is stopped.
currentIdleTimeMs Integer
Time elapsed(in miliseconds) since the user was last active.
idleTimeoutMs Integer
The idle time for a user after which timer stops and user is marked as inactive.
Public Demo
Demo coming soon!
License
MIT © Gaurav Koley, 2020