Send custom measurements

Faro Web SDK exposes some performance measurements, but there are cases where you might need to send application-specific data. For example, you might want to report some internals of the JavaScript framework you are using, or the time that it was elapsed before a user completed a form. The SDK comes with a simple API to do so.

Before you begin


Faro instance is an object that can be accessed, after initialization, by either importing it from the @grafana/faro-web-sdk or by referencing it from the window global object.

// Import the global faro instance
import { faro } from '@grafana/faro-web-sdk';

The faro.api object is a wrapper of the Faro API and provides a pushMeasurementmethod with which you can send any number of number values.

// Send custom measurements with Faro SDK.
// This example reports some hypothetical measurements from the JavaScript
// framework the application is using.

  type: 'internal_framework_measurements',
  values: {
    root_render_ms: 142.3,
    memory_used: 286,