Simple package for tracking (gauging) engagement on webpages. Used to track user activity on pages in CourseKata textbooks.
Currently, this package is only available via our private GitHub repository. If you have access, follow these steps to configure npm
to use the GitHub registry in addition to the standard NPM registry:
Authenticate to GitHub Packages. For more information, see Authenticating to GitHub Packages.
In the same directory as your package.json
file, create or edit an .npmrc
file to include a line associating this package's organization scope with the GitHub registry.
@uclatall:registry=https://npm.pkg.github.com
npm install @uclatall/engauge
To start monitoring,
Here is a simple example using console.log()
to print the reports:
import {Engauge} from '@uclatall/engauge';
const report_handler = payload => console.log(payload);
const engauge = new Engauge();
engauge.connect(report_handler);
document.addEventListener('DOMContentLoaded', () => engauge.monitor());
To disconnect from the report cycle, pass the same handler that was initially connected:
...
engauge.disconnect(report_handler);
// handler will not be called after this point
Disconnecting does not stop monitoring. To stop monitoring you can use the unmonitor()
method and new states will no longer be tracked:
engauge.unmonitor();
See the full documentation for more information on configuration and the report payload.
Generated using TypeDoc