Skip to content

lib/webVitals/webVitalsSummary

function processWebVitalsSummary(data: WebVitalsResponseItem[]): WebVitalsSummary

Defined in: studiocms/packages/studiocms/src/lib/webVitals/webVitalsSummary.ts:21

Processes an array of web vitals response items and generates a summary.

WebVitalsResponseItem[]

An array of WebVitalsResponseItem objects to be processed.

WebVitalsSummary

A WebVitalsSummary object containing the processed summary.

The function performs the following steps:

  1. Groups the input data by the name property.
  2. Processes each metric group separately.
  3. Sorts the metrics within each group by rating and value.
  4. Assigns quartiles to each metric.
  5. Identifies the end of each rating group.
  6. Computes the sample size for each metric group.
  7. Computes histogram densities for each rating.
  8. Computes the 75th percentile (P75) for each metric group.
  9. Filters the final results based on specific conditions.