Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify what happens for interactions less than 40ms #571

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ function onINP(callback: (metric: INPMetric) => void, opts?: ReportOpts): void;

Calculates the [INP](https://web.dev/articles/inp) value for the current page and calls the `callback` function once the value is ready, along with the `event` performance entries reported for that interaction. The reported value is a [`DOMHighResTimeStamp`](https://developer.mozilla.org/docs/Web/API/DOMHighResTimeStamp).

A custom `durationThreshold` [configuration option](#reportopts) can optionally be passed to control what `event-timing` entries are considered for INP reporting. The default threshold is `40`, which means INP scores of less than 40 are reported as 0. Note that this will not affect your 75th percentile INP value unless that value is also less than 40 (well below the recommended [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
A custom `durationThreshold` [configuration option](#reportopts) can optionally be passed to control what `event-timing` entries are considered for INP reporting. The default threshold is `40`, which means INP scores of less than 40 will not be reported. To avoid reporting no interactions in these cases, the library will fall back to the input delay of the first interaction. Note that this will not affect your 75th percentile INP value unless that value is also less than 40 (well below the recommended [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
tunetheweb marked this conversation as resolved.
Show resolved Hide resolved

If the `reportAllChanges` [configuration option](#reportopts) is set to `true`, the `callback` function will be called as soon as the value is initially determined as well as any time the value changes throughout the page lifespan (Note [not necessarily for every interaction](#report-the-value-on-every-change)).

Expand Down
12 changes: 7 additions & 5 deletions src/attribution/onINP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,13 @@ const attributeINP = (metric: INPMetric): INPMetricWithAttribution => {
* the `event` performance entries reported for that interaction. The reported
* value is a `DOMHighResTimeStamp`.
*
* A custom `durationThreshold` configuration option can optionally be passed to
* control what `event-timing` entries are considered for INP reporting. The
* default threshold is `40`, which means INP scores of less than 40 are
* reported as 0. Note that this will not affect your 75th percentile INP value
* unless that value is also less than 40 (well below the recommended
* A custom `durationThreshold` configuration option can optionally be passed
* to control what `event-timing` entries are considered for INP reporting. The
* default threshold is `40`, which means INP scores of less than 40 will not
* be reported. To avoid reporting no interactions in these cases, the library
* will fall back to the input delay of the first interaction. Note that this
* will not affect your 75th percentile INP value unless that value is also
* less than 40 (well below the recommended
* [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
*
* If the `reportAllChanges` configuration option is set to `true`, the
Expand Down
12 changes: 7 additions & 5 deletions src/onINP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ export const INPThresholds: MetricRatingThresholds = [200, 500];
* the `event` performance entries reported for that interaction. The reported
* value is a `DOMHighResTimeStamp`.
*
* A custom `durationThreshold` configuration option can optionally be passed to
* control what `event-timing` entries are considered for INP reporting. The
* default threshold is `40`, which means INP scores of less than 40 are
* reported as 0. Note that this will not affect your 75th percentile INP value
* unless that value is also less than 40 (well below the recommended
* A custom `durationThreshold` configuration option can optionally be passed
* to control what `event-timing` entries are considered for INP reporting. The
* default threshold is `40`, which means INP scores of less than 40 will not
* be reported. To avoid reporting no interactions in these cases, the library
* will fall back to the input delay of the first interaction. Note that this
* will not affect your 75th percentile INP value unless that value is also
* less than 40 (well below the recommended
* [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
*
* If the `reportAllChanges` configuration option is set to `true`, the
Expand Down