Git Product home page Git Product logo

Comments (6)

Zizzamia avatar Zizzamia commented on August 19, 2024 2

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.

philipwalton avatar philipwalton commented on August 19, 2024 1

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.

Zizzamia avatar Zizzamia commented on August 19, 2024

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.

philipwalton avatar philipwalton commented on August 19, 2024

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.

philipwalton avatar philipwalton commented on August 19, 2024

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.

philipwalton avatar philipwalton commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.