GoogleChrome / web-vitals-extension

A Chrome extension to measure essential metrics for a healthy site
https://chrome.google.com/webstore/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma?hl=en
Apache License 2.0
2.35k stars 105 forks source link

Simplest version of console logging each and every interaction #120

Closed mmocny closed 1 year ago

mmocny commented 1 year ago

Fixes #109

mmocny commented 1 year ago

@tunetheweb would appreciate taking a look.

With the recent patches adding most of the work, the cleanest way to implement this change was to supply an alternative implementation onEachInteraction that has the same interface as web-vitals.js onINP.

The PR as is does not expose a configuration option for report-all nor does it mark when the new Interaction is or is not a new worst-case.

I think we could expose a settings option, but I'm partial to just getting the default right. Console logging is already a "debugging" feature.

However, perhaps right now the console.logging is a bit too spammy? Some options:

tunetheweb commented 1 year ago

I think it's confusing to expose an interaction as "INP" when it's not the INP. For example:

image

The second one is less than the first one so is clearly not a new INP, but we've labelled it as INP.

So I think we should continue to log the INP metric, but log this as a separate "interaction" metric. Either always displaying the current INP like this:

[Web Vitals Extension] INP 48: Interaction: 48
[Web Vitals Extension] INP 48: Interaction: 40

Or logging these two types on separate lines like this

[Web Vitals Extension] Interaction: 48
[Web Vitals Extension] INP 48
[Web Vitals Extension] Interaction: 40

Note the second one has duplicated the first one (once as an "Interaction" and once as the "INP" value). Not sure if we can combine these to prevent that duplication:

[Web Vitals Extension] INP Interaction: 48
[Web Vitals Extension] Interaction: 40

WDYT?

I'm in two minds about exposing this as a separate config setting. I like the simplicity of not doing that, but worry about how noisy it gets on a highly interactive site. Will think on it some more...

mmocny commented 1 year ago

I think it's confusing to expose an interaction as "INP" when it's not the INP. For example:

Agreed. I can replace the word INP with the word Interaction. Not sure if we want to also expose the real INP value if it changes? That... does seem like it needs a setting.

So I think we should continue to log the INP metric, but log this as a separate "interaction" metric.

Makes sense. It should be easy to do it in one line by just saving the score, but, then you won't get attribution and you'll have to do mental gymnastics, so I'll try to just do it with separate lines.

Note the second one has duplicated the first one (once as an "Interaction" and once as the "INP" value). Not sure if we can combine these to prevent that duplication: WDYT?

That would be ideal-- let me see how much effort that is

I'm in two minds about exposing this as a separate config setting. I like the simplicity of not doing that, but worry about how noisy it gets on a highly interactive site. Will think on it some more...

Agreed! We could land without the option and then add an option if we get complaints. That way it gets discovered faster?

mmocny commented 1 year ago

Screenshot 2023-04-28 at 4 47 58 PM

One more feature to go: reduce the duplication when you get a new INP.

mmocny commented 1 year ago

Done. Found a surprisingly simple solution.

brendankenny commented 1 year ago
mmocny commented 1 year ago

Thanks Brendan for the patches!

mmocny commented 1 year ago

I accepted the suggestion to remove the INP Interaction comparison, because I won't have the time to make improvements.

tunetheweb commented 1 year ago

Cool. Good to merge from your side @mmocny ?

Will still wait until @brendankenny gives his OK too in case he has any last comments.

mmocny commented 1 year ago

Yep! Thanks!

On Tue, May 2, 2023, 13:59 Barry Pollard @.***> wrote:

Cool. Good to merge from your side @mmocny https://github.com/mmocny ?

Will still wait until @brendankenny https://github.com/brendankenny gives his OK too in case he has any last comments.

— Reply to this email directly, view it on GitHub https://github.com/GoogleChrome/web-vitals-extension/pull/120#issuecomment-1531345540, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADTZKVI5EPE2UZTZTMAIYDXEDZLRANCNFSM6AAAAAAXPQXN3A . You are receiving this because you were mentioned.Message ID: @.***>