If you already have an account with micro stat we recommend you use the tutorial in the dashboard, as we provide customised code for you.
yarn add micro-stat
import { Connection } from 'micro-stat';
Connection.connect("<YOUR_DSN>");
// Import the Metric types you want to record
import { HitCounter, Counter } from 'micro-stat';
// Create a Hit Counter and immediately publish it
new HitCounter('Project Loaded').publish();
// Create a Counter and interact with it
const basketItemCount = new Counter('Number of Basket Items');
basketItemCount.value = 5;
basketItemCount.publish();
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 |