# Web Vitals Concepts

This view is only available on Team and Business plans. Team plans can access the last 7 days of data, while Business plans can access the last 90 days. To enable extended data access, upgrade to the [Business or Enterprise plan](https://sentry.io/pricing.md).

[Web Vitals](https://web.dev/vitals.md) are a set of metrics defined by Google to measure render time, response time, and layout shift. Each data point provides insights about the overall [performance](https://docs.sentry.io/product/insights/overview.md) of your application.

The in-browser Sentry SDKs collect web vitals information (where supported) and adds that information to frontend [transactions](https://docs.sentry.io/product/insights/overview/transaction-summary.md). These web vitals are then summarized in the [**Performance > Web Vitals** page](https://docs.sentry.io/product/insights/web-vitals.md) to give you a quick overview of how each page is performing for your users.

[![Visualization of Web Vitals](https://docs.sentry.io/_next/image/?url=%2Fmdx-images%2Fdiagram-transaction-vitals-INA2GUBA.png%232940x1296\&w=3840\&q=75)](https://docs.sentry.io/mdx-images/diagram-transaction-vitals-INA2GUBA.png)

## [Core Web Vitals](https://docs.sentry.io/.md#core-web-vitals)

Google considers Core Web Vitals to be the most important metrics for measuring the user experience on web pages. According to a May 2021 [Google blog post](https://developers.google.com/search/blog/2020/11/timing-for-page-experience.md), these metrics also impact your search ranking.

### [Largest Contentful Paint (LCP)](https://docs.sentry.io/.md#largest-contentful-paint-lcp)

[Largest Contentful Paint (LCP)](https://web.dev/lcp.md) measures how long it takes for the content that covers the largest pixel area in the viewport to render - in other words, how long before a user sees the main content on a page. This content may take any form from the document object model (DOM), such as an image, SVG, or text block.

### [Interaction to Next Paint (INP)](https://docs.sentry.io/.md#interaction-to-next-paint-inp)

On March 12, 2024, Interaction to Next Paint (INP) replaced First Input Delay (FID) as a Core Web Vital. Prior to this, INP was an experimental metric that Sentry did not collect. To begin collecting INP measurements, make sure your JavaScript SDK version is [7.104.0](https://github.com/getsentry/sentry-javascript/releases/tag/7.104.0) or higher and that the option [`enableInp`](https://docs.sentry.io/platforms/javascript/tracing/instrumentation/automatic-instrumentation.md#enableinp) is on (starting with version `8.0.0`, `enableInp` is enabled by default).

[Interaction to Next Paint (INP)](https://web.dev/articles/inp.md) measures the time from when a user interacts with a page (through a click, tap, or keyboard input) to when the next paint (rendering of content on the screen) occurs. INP aims to assess how quickly users see a response from the website after taking an action, which is crucial for providing a smooth and responsive user experience.

### [Cumulative Layout Shift (CLS)](https://docs.sentry.io/.md#cumulative-layout-shift-cls)

[Cumulative Layout Shift (CLS)](https://web.dev/cls.md) is the sum of individual layout shift scores for every unexpected element shift that happens during the rendering process. An example of this would be trying to click a link on a page that hasn't finished loading and having that link shift down before you've had a chance to click on it due to image rendering issues. The CLS web vital score isn't based on duration. It represents the extent of the disruptive and visually unstable shifts.

[![Example of Cumulative Layout Shift](https://docs.sentry.io/_next/image/?url=%2Fmdx-images%2Fdiagram-transaction-cls-FORFOZRM.png%232186x937\&w=3840\&q=75)](https://docs.sentry.io/mdx-images/diagram-transaction-cls-FORFOZRM.png)

Each layout shift score is calculated using an impact and distance fraction. The impact fraction is the total visible area that the element affects between the two rendered frames. The distance fraction measures the distance it has moved relative to the viewport.

```bash
Layout Shift Score = Impact Fraction * Distance Fraction
```

Let’s take a look at the example above which has one unstable element - the body text. The impact fraction is roughly 50% of the page and moves the body text down by 20%. The layout shift score is 0.1, the product of 0.5\*0.2. Thus, CLS is 0.1.

## [Other Web Vitals](https://docs.sentry.io/.md#other-web-vitals)

These Web Vitals are generally less user-visible, but are useful for troubleshooting issues with the Core Web Vitals.

### [First Paint (FP)](https://docs.sentry.io/.md#first-paint-fp)

First Paint (FP) measures the amount of time the first pixel takes to appear in the viewport, rendering any visual change from what was previously displayed. This may be in any form from the document object model (DOM), such as background color, canvas, or image. FP helps developers understand if anything unexpected is happening to render the page.

### [First Contentful Paint (FCP)](https://docs.sentry.io/.md#first-contentful-paint-fcp)

[First Contentful Paint (FCP)](https://web.dev/fcp.md) measures the time for the first content to render in the viewport. This may be in any form from the document object model (DOM), such as images, SVGs, or text blocks. FCP frequently overlaps with First Paint (FP). FCP helps developers understand how long it takes before the user sees any content change on the page.

### [Time To First Byte (TTFB)](https://docs.sentry.io/.md#time-to-first-byte-ttfb)

[Time To First Byte (TTFB)](https://web.dev/articles/ttfb.md) measures the time that it takes for a user's browser to receive the first byte of page content. TTFB helps developers understand whether their slowness is caused by the initial response or instead due to render-blocking content.

### [First Input Delay (FID)](https://docs.sentry.io/.md#first-input-delay-fid)

As of March 12, 2024, First Input Delay (FID) was replaced as a Core Web Vital by INP. While Sentry no longer includes FID in our performance score calculations nor on the **Web Vitals** performance page, we continue to collect FID metrics. You can query FID measurements in [Discover](https://docs.sentry.io/product/explore/discover-queries.md).

[First Input Delay (FID)](https://web.dev/fid.md) measures response time when a user tries to interact with the viewport by clicking a button, link, or any other custom JavaScript controller. FID data is critical for understanding whether interactions on an application page are successful or not.

## [Thresholds](https://docs.sentry.io/.md#thresholds)

Google's "Good", "Needs Improvement", and "Poor" thresholds are used to classify data points into green, yellow, and red for the corresponding Web Vitals. "Needs improvement" is referred to as "Meh" in Sentry.

| Web Vital                                                                                   | Good     | Meh      | Poor    |
| ------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
| [Largest Contentful Paint](https://docs.sentry.io/.md#largest-contentful-paint-lcp) (LCP)   | <= 2.5s  | <= 4s    | > 4s    |
| [Interaction to Next Paint](https://docs.sentry.io/.md#interaction-to-next-paint-inp) (INP) | <= 200ms | <= 500ms | > 500ms |
| [Cumulative Layout Shift](https://docs.sentry.io/.md#cumulative-layout-shift-cls) (CLS)     | <= 0.1   | <= 0.25  | > 0.25  |
| [First Paint](https://docs.sentry.io/.md#first-paint-fp) (FP)                               | <= 1s    | <= 3s    | > 3s    |
| [First Contentful Paint](https://docs.sentry.io/.md#first-contentful-paint-fcp) (FCP)       | <= 1s    | <= 3s    | > 3s    |
| [Time To First Byte](https://docs.sentry.io/.md#time-to-first-byte-ttfb) (TTFB)             | <= 100ms | <= 200ms | > 600ms |
| [First Input Delay](https://docs.sentry.io/.md#first-input-delay-fid) (FID)                 | <= 100ms | <= 300ms | > 300ms |

Some Web Vitals such as FP, FCP, LCP, and TTFB are measured relative to the start of the transaction. Values may differ when compared to values generated with other tools such as [Lighthouse](https://github.com/GoogleChrome/lighthouse.md).

## [Browser Support](https://docs.sentry.io/.md#browser-support)

Not all browsers fully support all web vitals. Sentry uses available web vitals to calculate [Performance Score](https://docs.sentry.io/product/insights/web-vitals.md#performance-score).

| Web Vital                                                                                   | Chrome | Edge | Opera | Firefox | Safari |
| ------------------------------------------------------------------------------------------- | ------ | ---- | ----- | ------- | ------ |
| [Largest Contentful Paint](https://docs.sentry.io/.md#largest-contentful-paint-lcp) (LCP)   | ✓      | ✓    | ✓     | ✓       |        |
| [Interaction to Next Paint](https://docs.sentry.io/.md#interaction-to-next-paint-inp) (INP) | ✓      | ✓    | ✓     |         |        |
| [Cumulative Layout Shift](https://docs.sentry.io/.md#cumulative-layout-shift-cls) (CLS)     | ✓      | ✓    | ✓     |         |        |
| [First Paint](https://docs.sentry.io/.md#first-paint-fp) (FP)                               | ✓      | ✓    | ✓     |         |        |
| [Time To First Byte](https://docs.sentry.io/.md#time-to-first-byte-ttfb) (TTFB)             | ✓      | ✓    | ✓     | ✓       | ✓      |
| [First Contentful Paint](https://docs.sentry.io/.md#first-contentful-paint-fcp) (FCP)       | ✓      | ✓    | ✓     | ✓       | ✓      |
| [First Input Delay](https://docs.sentry.io/.md#first-input-delay-fid) (FID)                 | ✓      | ✓    | ✓     | ✓       |        |
