WebVitals for TanStack Start React

Configure browser Web Vitals collection, including INP, LCP, and CLS.

Import name: Sentry.webVitalsIntegration

The WebVitals integration captures LCP, CLS, and INP for the Web Vitals dashboard.

BrowserTracing

adds this integration automatically. In SDK version 11 and later, configure it through BrowserTracing's webVitals option:

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

To configure it in SDK versions before 11, add Sentry.webVitalsIntegration({ ... }) directly to integrations:

Copied
Sentry.init({
  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.webVitalsIntegration({ ignore: ["inp"] }),
  ],
});

You can also use this approach in SDK version 11 and later. An explicitly added WebVitals integration takes precedence over BrowserTracing's Web Vitals settings.

ignore

TypeArray<'cls' | 'inp' | 'lcp'>
Default[]

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

softNavigations

Typeboolean
Defaulttrue

Collect LCP, CLS, and INP for each soft navigation detected by the browser's Soft Navigations API. Requires stream mode and a browser that supports this API. Set to false to collect one set of vitals for the page lifetime.

bfcacheNavigations

Typeboolean
Defaulttrue

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.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").