# WebVitalsInstrumentationConfig

**Kind**: interface | **Module**: [Insights](https://docs.interop.io/desktop/reference/javascript/insights/index.md)

**Source**: https://docs.interop.io/desktop/reference/javascript/insights/webvitalsinstrumentationconfig/index.html

Configuration for the session-level Web Vitals instrumentation.

Values are reported when the page becomes hidden: a span with the current
values on each hidden transition where they changed, and (for the metrics)
one terminal sample per page at pagehide - so each session contributes a
single sample per histogram.

## Properties

- **`clsMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, the session's cumulative layout shift is published as a
  histogram metric ("io.insights.web_vitals.cls" unless a string names it).
  Unitless score, session-window algorithm (shifts without recent input,
  windowed at 5s max / 1s gap, the worst window wins).
- **`clsMetricBuckets`** (`number[]`, optional) default: `[0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5]`
  Explicit histogram bucket boundaries for clsMetric (unitless score), ascending.
  The default brackets the CLS "good" (0.1) and "poor" (0.25) thresholds.
- **`enabled`** (`boolean`, required)
  Whether the Web Vitals instrumentation is enabled.
- **`inpMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, the session's INP (interaction to next paint) is
  published as a histogram metric ("io.insights.web_vitals.inp" unless a string
  names it) - the worst interaction latency, moving to a high percentile as the
  interaction count grows, per the web-vitals estimation.
- **`inpMetricBuckets`** (`number[]`, optional) default: `[0.04, 0.1, 0.2, 0.3, 0.5, 0.75, 1, 2.5, 5]`
  Explicit histogram bucket boundaries for inpMetric, in seconds, ascending.
  The default brackets the INP "good" (0.2s) and "poor" (0.5s) thresholds.
- **`lcpMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, the final largest contentful paint is published as a
  histogram metric ("io.insights.web_vitals.lcp" unless a string names it), in
  seconds from navigation start.
- **`lcpMetricBuckets`** (`number[]`, optional) default: `[0.5, 1, 1.5, 2, 2.5, 4, 5, 7.5, 10, 15]`
  Explicit histogram bucket boundaries for lcpMetric, in seconds, ascending.
  The default brackets the LCP "good" (2.5s) and "poor" (4s) thresholds.
- **`trace`** (`boolean`, optional) default: `true`
  If `true` (the default), a "interopio.api.instrumentation.webVitals" span
  carrying the current CLS/INP/LCP values and the interaction count is published
  on each transition to hidden where the values changed since the last report.

  If `false`, no webVitals spans are published - metrics-only mode: the
  terminal CLS/INP/LCP samples at pagehide keep reporting.
