Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyleamathews/engagement
Track when a user is engaging with a page
https://github.com/kyleamathews/engagement
Last synced: about 1 month ago
JSON representation
Track when a user is engaging with a page
- Host: GitHub
- URL: https://github.com/kyleamathews/engagement
- Owner: KyleAMathews
- License: mit
- Created: 2015-05-04T22:29:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-26T23:07:40.000Z (over 9 years ago)
- Last Synced: 2024-08-08T20:37:01.691Z (3 months ago)
- Language: CoffeeScript
- Homepage: http://kyleamathews.github.io/engagement/
- Size: 371 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Engagement
Track when a user is engaging with a pageNew school media startups like Buzzfeed measure your attention not
clicks. [Chartbeat's CEO says the average reader spends ~15 seconds](http://time.com/12933/what-you-think-you-know-about-the-web-is-wrong/) on an
article. Don't just record clicks, record engagement.This module tracks when a user is active on your web site by tracking
mouse movements, scrolling, keyboard presses, and mouse clicks. It's easy to integrate
with your own code to measure custom activity such as watching video.The module emits a new 'active' signal at most every five seconds. This
is because research has shown that a user on average pays attention to
the page for five seconds after the last scroll/mouse movement/click.## Install
`npm install engagement`## How to use
```javascript
var engagement = require('engagement');engagement.listen = function() {
// Record engagement event to internal/3rd party analytics system.
};
```## How to track custom types of engagement e.g. watching video
```javascript
var engagement = require('engagement');VideoPlayer.on('start', function() {
interval = setInterval(function(){engagement.active()}, 500);
}
VideoPlayer.on('stop', function() {
clearInterval(interval);
}
```