---
title: "WebVitals"
description: "Configure browser Web Vitals collection, including INP, LCP, and CLS."
url: https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals/
---

# WebVitals for Effect

This integration only works inside a browser environment. Requires JavaScript SDK version 10.57.0 or later.

*Import name: `Sentry.webVitalsIntegration`*

The WebVitals integration captures LCP, CLS, and INP for the [Web Vitals dashboard](https://docs.sentry.io/product/dashboards/sentry-dashboards/frontend/web-vitals.md).

The [BrowserTracing](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/browsertracing.md) integration adds it automatically, so you only need to configure it if you want to change its defaults. Configure it through BrowserTracing's `webVitals` option:

```javascript
Sentry.init({
  integrations: [
    Sentry.browserTracingIntegration({
      webVitals: {
        ignore: ["inp"],
      },
    }),
  ],
});
```

## [Configuration Options](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#configuration-options)

### [ignore](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#ignore)

| Type    | `Array<'cls' \| 'inp' \| 'lcp'>` |
| ------- | -------------------------------- |
| Default | `[]`                             |

Web Vitals to skip. By default, all supported Web Vitals are collected.

### [softNavigations](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#softNavigations)

| Available since | `11.0.0`  |
| --------------- | --------- |
| Type            | `boolean` |
| Default         | `true`    |

Collect LCP, CLS, and INP for each soft navigation detected by the browser's Soft Navigations API. Requires [stream mode](https://docs.sentry.io/platforms/javascript/guides/effect/tracing/instrumentation/automatic-instrumentation.md) and Chromium 151 or later. Set to `false` to disable Web Vitals collection for soft navigations. See [Soft Navigations](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#soft-navigations) for details.

### [bfcacheNavigations](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#bfcacheNavigations)

| Available since | `11.0.0`  |
| --------------- | --------- |
| Type            | `boolean` |
| Default         | `true`    |

Collect LCP, CLS, and INP when a page is restored from the back/forward cache. Requires stream mode and BrowserTracing with `instrumentBfcacheRestore` enabled. Set to `false` to disable Web Vitals collection for restores. See [Back/Forward Cache Restores](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#backforward-cache-restores) for details.

## [Soft Navigations](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#soft-navigations)

Available since: `v11.0.0`

A soft navigation is a route change in a single-page application that updates the URL and the page content without loading a new document. The SDK reports a separate LCP, CLS, and INP for each soft navigation and attaches them to that route's `navigation` span. You don't need to configure anything beyond BrowserTracing.

Which route changes count as soft navigations?

Chromium detects soft navigations, so not every route change your router makes counts as one. It reports a soft navigation when a user interaction (a click or key press) changes the URL and leads to a visible paint. Route changes that don't meet these criteria still get a `navigation` span, but no Web Vitals. This includes programmatic navigations, navigations that never paint, and browser back or forward button presses.

Soft navigation vitals differ from page load vitals in a few ways:

* LCP is measured from the interaction that triggered the navigation until the new route's largest content paints.
* CLS and INP cover only the time spent on that route. They are sent when the next soft navigation starts or when the page is hidden.
* The page load's own LCP, CLS, and INP are finalized at the first soft navigation instead of accumulating over the page lifetime.
* TTFB, FP, and FCP are only reported for page loads.

Every Web Vital span carries a `browser.navigation.type` attribute that tells you what it was measured on:

| Value                                           | Measured On                          |
| ----------------------------------------------- | ------------------------------------ |
| `navigate`, `reload`, `back-forward`, `restore` | Page loads                           |
| `soft-navigation`                               | Soft navigations                     |
| `back-forward-cache`                            | Restores from the back/forward cache |
| `prerender`                                     | Prerendered page loads               |

Soft navigation Web Vital spans and their `navigation` span also carry `browser.navigation.id`, the ID the browser assigned to that soft navigation.

Soft navigation values aren't comparable to page load values, so filter by `browser.navigation.type` in your own queries, dashboards, and alerts. The [Web Vitals dashboard](https://docs.sentry.io/product/dashboards/sentry-dashboards/frontend/web-vitals.md#measured-on-filter) has a built-in filter for this.

To stop collecting Web Vitals for soft navigations, disable the option:

```javascript
Sentry.init({
  integrations: [
    Sentry.browserTracingIntegration({
      webVitals: {
        softNavigations: false,
      },
    }),
  ],
});
```

## [Back/Forward Cache Restores](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/webvitals.md#backforward-cache-restores)

Available since: `v11.0.0`

When a user navigates back or forward, the browser can restore the page instantly from its [back/forward cache (bfcache)](https://web.dev/articles/bfcache) instead of loading it again. No document loads, so a restore would otherwise report no Web Vitals. The SDK reports a separate LCP, CLS, and INP for each restore and attaches them to the `navigation` span that BrowserTracing starts for it.

Restore vitals differ from page load vitals in a few ways:

* LCP is measured from the restore until the page paints again, so it's close to zero.
* CLS and INP start over at the restore and cover the time until the page is hidden again.
* TTFB, FP, and FCP are only reported for page loads.

Restore Web Vital spans carry `browser.navigation.type: back-forward-cache`. Restores are near-instant, so they lower your p75 values when combined with page loads. Filter by this attribute in your own queries, dashboards, and alerts, or use the [**Measured on** filter](https://docs.sentry.io/product/dashboards/sentry-dashboards/frontend/web-vitals.md#measured-on-filter) in the Web Vitals dashboard.

To stop collecting Web Vitals for restores, disable the option:

```javascript
Sentry.init({
  integrations: [
    Sentry.browserTracingIntegration({
      webVitals: {
        bfcacheNavigations: false,
      },
    }),
  ],
});
```

Restores still get a `navigation` span unless you also set `instrumentBfcacheRestore: false` on BrowserTracing. To track how often your pages are restored from the bfcache and why they aren't, see [BFCache Metrics](https://docs.sentry.io/platforms/javascript/guides/effect/configuration/integrations/bfcache.md).

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
