Seismo Node.js / Express.js client
Installation
seismo-client
available in npm,
$ npm install seismo-client
Development
Clone git repository,
$ git clone https://github.com/seismolabs/seismo-node-client.git
Clone seismo server and make sure all prereqisits installed,
$ git clone https://github.com/seismolabs/seismo.git
Start seismo
server in test mode,
$ NODE_ENV="test" node source/server.js
Run tests,
$ npm test
Create client and post events
This is a small example of seismo-client
usage:
var seismo = ; // create analytics client, by providing app idvar events = ; // call function, with the name of event;
// provide event id (optional, but suitable for fetching data);
// provide additional payload (optional, but usefull for sophisticated analysis);
// or ..events({id: 'app-start', event: 'application started'}, {environment: process.env.NODE_ENV}); // provide callback (optional)events('application started', function (err) { console.log('event posted on server');});
Scenarios for web (express.js) application:
var express = ;var seismo = ;var app = ; // create analytics client, by providing app idvar events = ; var { return { ; }} app; app; app
Querying for results
You can query server for data you application collected.
var seismo = ;var events = ; // query all collected eventsevents;
// query by event nameevents;
// query by event typeevents;
For convenience, you can request data by certain date.
var analytics = ;var events = ; // query all collected events for todayevents;
// query all collected events for particular dayevents;
// query all collected events for particular, for event nameevents;
// query all collected events for particular, for event typeevents;
Reports
In order, to build dashboard application, there are number of ready to use reports.
// report all events by hourevents;
// report all events by dayevents;
// report all events by weekevents;
// report all events by monthevents;
// report all events by periodevents;
Summary object contains totals,
id: 'app-started' event: 'application started' total: 224
License
MIT