Comments (6)
How about a threshold set as an optional value for each metric? In the README, you can recommend the developer the optimal value to benchmark, and it still gives the developer the opportunity to change it when they prefer.
We could see this as a budget for those metrics, where the developer can customize the value where they are pushing for.
from web-vitals.
This is an interesting idea! If it's possible to add this without increasing the file size too much, I agree it'd be a nice addition. (It may take a slight refactor since so much of the reporting code is shared by all metrics).
from web-vitals.
What would happen if a result pass or not the threshold? Is it more like to flag good vs bad results? Like, this quarter we went from 10% to 35% increase in good results kind of OKR?
It is def interesting to help the developer have a quick idea if the result is good enough 😄
from web-vitals.
Thinking about this a bit more, one downside of reporting a pass/fail value on the metric is that, if Google decides to change the metric thresholds, that may require a breaking change in this library (may, not 100% sure).
We also don't yet have hard, consistent, thresholds for all of the metrics (e.g. the non-core Web Vitals like FCP and TTFB), and I'm not sure I'd want the API to differ between core and non-core vitals.
from web-vitals.
I've gone back and forth on whether we should support this, but ultimately I haven't been able to come up with an API that works well. Since the thresholds are well-documented publicly, I think it makes sense for developers who want to track threshold compliance to do so in their own code.
Some of the reasons for my thinking:
- Thresholds might change over time, and a user might not necessarily want to update their version of this library just to get new thresholds
- Not all of the metrics have published thresholds, nor do we plan on publishing thresholds for all metrics, so adding that would make the interface for the
Metric
object inconsistent (e.g. TTFB is unlikely to have a published threshold) - Including the thresholds adds extra weight to the library (albeit small) for many users who may not need it
from web-vitals.
Coming back to this issue after a few years, I think most of the reasons I decided not to implement this no longer apply, so now I think it's worth reconsidering:
- Thresholds might change over time, and a user might not necessarily want to update their version of this library just to get new thresholds
In the past two years none of the published thresholds for any metrics have changed, and I don't anticipate them changing much (if at all) in the future. So this no longer seems like a reason not to have this feature.
- Not all of the metrics have published thresholds, nor do we plan on publishing thresholds for all metrics, so adding that would make the interface for the
Metric
object inconsistent (e.g. TTFB is unlikely to have a published threshold)
Since I wrote this, we now do have published thresholds for all of the metrics in this library, so there would be no inconsistency between metrics interfaces.
- Including the thresholds adds extra weight to the library (albeit small) for many users who may not need it
After experimenting with a basic implementation, the size different is very small (~100 bytes), so I think it's probably nothing to worry about.
from web-vitals.
Related Issues (20)
- can't find ReportCallback or ReportHandler type HOT 3
- Are there any updates for soft-navs? HOT 2
- LoAF missed for some INP events HOT 9
- Facing issue while exporting `web-vitals/attribution` using `browserify` HOT 2
- LoAF Performance entry script sourceFunctionName and sourceURL logged values HOT 4
- Using `performance.eventCounts` instead of `performance.interactionCount` HOT 2
- Heads Up on Changes to INP Measurement When Interfered with JS Modal Dialogs HOT 3
- TypeError: Cannot read properties of undefined (reading 'processingEnd') HOT 13
- TypeScript 5.5 compatibility
- Speculation rules can impact on increase values for INP ?
- Missing Cumulative Layout Shift (CLS) metric when batching multiple reports together in a single network request HOT 5
- Add clarification regarding event listener in event batching section
- LCP and CLS fired on interaction HOT 5
- Tgt
- Update LCP attribution to handle the first frames of animated content HOT 3
- INP attribution helper latestProcessingEnd never initialized HOT 1
- Missing LoAF attributions for INP due to violating internal invariants
- Any way to simulate clicks for INP testing? HOT 3
- Identical abstract selectors can be returned as distinct strings HOT 6
- onINP trigger always when browser tab change ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-vitals.