- This integration is designed for NodeJS and javascript applications
- Please make sure to register an account to get your unique DSN (Data source name)
- Learn more at https://www.help.micro-stat.com
- Install the integration in your app with npm or yarn
yarn add micro-stat
- Configure your connection (You must do this before publishing metrics)
import { Connection } from 'micro-stat';
Connection.connect("YOUR_DSN");
- Publish your first metric
import { Counter } from 'micro-stat';
const myFirstCounter = new Counter('Count Page Hits');
myFirstCounter.increment();
myFirstCounter.publish();
- Alternatively use short hand syntax
import { HitCounter } from 'micro-stat';
new HitCounter('Website Visited').publish();
- Optionally customise your experience by providing options when connecting
import { Connection } from 'micro-stat';
const options = {
captureWebVitals: false,
disablePublication: true
}
Connection.connect("YOUR_DSN", options);
| Option | Default | Description |
|---|---|---|
| captureWebVitals | true | When true - web vitals are automatically collected and published |
| disablePublication | false | When true - metrics are only output to the console, not published to micro-stat |