Collect and send data to an API endpoint, uses the SendBeacon method if available in the browser, otherwise classic POST request.
This package is built using webpack 4.
Via npm
$ npm install @cuppilekkia/event-tracker --save
import { Tracker } from '@cuppilekkia/event-tracker';
const Tracker = require('@cuppilekkia/event-tracker');
window.trackerClient = new Tracker({
api: '[API PATH i.e. "/data" ]',
host: '[API HOST i.e. "https://mydatacollector.com"]',
});
Link tracker.js
in your HTML :
<script src="tracker.js"></script>
<script>
var trackerClient = new tracker.Tracker({
api: '[API PATH i.e. "/data" ]',
host: '[API HOST i.e. "https://mydatacollector.com"]'
});
</script>
Send any kind of object as payload, containing all the data you want to send.
var payload = {
key1: value,
key2: {...},
...
}
trackerClient.push(payload);
[add here development notes]
this package uses semantic release
so please follow the sintax like:
Commit message | Release type |
---|---|
fix(pencil): stop graphite breaking when too much pressure applied |
Patch Release |
feat(pencil): add 'graphiteWidth' option |
|
perf(pencil): remove graphiteWidth option BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reasons. |
- build a demo page with additionally a test node server
- find a way to test cookie creation
- fix coverage building and job to move into public