Include UserAle.js in your project
To include UserAle.js in your project with default configuration, simply include the script tag below:
To configure UserAle.js for your application, see Configuration below. Or use the Configuration Builder on our Github page.
To modify and build your own version of UserAle.js, first clone the repo, install dependencies, and make any desired changes. Then build and minify into the
git clone https://github.com/draperlaboratory/useralejs.git
npm run build
To run tests and linting:
npm run test:watch
package.json for full script options.
UserAle.js is configured with HTML5 Data Parameters included in the script tag. For example, to set the URL to send logs to:
The full list of options is below:
|http://localhost:8000||The URL to which logs will be sent|
|true||Should UserAle.js start automatically on page load|
|5000||The minimum time interval in ms between batch transmission of logs|
|5||The minimum number of logs to be sent in a batch|
|null||Identifier for the particular user of the application|
|null||The application version|
|false||Should detailed logs (key strokes, input/change values) be recorded|
|500||Delay in ms between instances of high frequency logs like mouseovers, scrolls, etc.|
Should the user field (as in
Install and Configure Distill
Follow the installation guide here. If you have an existing ElasticSearch instance, the setup will be slightly more involved, but should be as simply as modifying a few existing files.
- Follow the instructions for downloading Distill as you would normally.
Modify the docker-compose.yml file at the top-level of the repository. Remove (or comment out using "#") the "elasticsearch" and "kibana" sections. Furthermore, remove the "depends_on" and "links" section in each container that references the "elasticsearch" container. An example of this might be: docker-compose-no-elastic.yaml
- Next, modify the "hosts" line in docker/logstash/logstash.conf and specify as either a string or array the address(es) to your Elastic instance(s).
- Finally, modify the "ES_HOST" and "ES_PORT" values in distill/config.cfg to whatever your target instance of Elastic is running on.
Enable Cross-Origin Resource Sharing
The logs generated by UserAle is sent to a logging url which is configured in the script tag. Your client may send out failure logs because of a CORS (cross-origin resource sharing) issue. You will need to configure your backend server to enable CORS.
For more information and examples on how to enable CORS on your server, please visit: