question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade to web-vitals v3

See original GitHub issue

Problem Statement

Web Vitals v3 is currently in beta.

Allows us to start tracking INP, which can replace FID.

https://web.dev/inp/

Writing your own PerformanceObserver to measure INP can be difficult. To measure INP in JavaScript, it’s advised that you use the web-vitals JavaScript library, which exports an onINP function to do this work for you. At the moment, getting INP data is only possible in version 3 of web-vitals, currently in beta, which can be installed with the following command:

npm install web-vitals@next --save

You can then get a page’s INP by passing a function to the onINP method:

import {onINP} from 'web-vitals';
onINP(({value}) => {
 // Log the value to the console, or send it to your analytics provider.
 console.log(value);
});

As with other methods exported by web-vitals, onINP accepts a function as an argument, and will pass metric data to the function you give it. From there, you can send that data to an endpoint for collection and analysis.

Solution Brainstorm

https://www.npmjs.com/package/web-vitals/v/next

https://github.com/GoogleChrome/web-vitals/compare/next

Seems like its around ~2kb larger. Can we address that?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
k-fishcommented, Oct 24, 2022

@AbhiPrasad thanks, I already have a good chunk of the INP code written, but it means we’ll have to re-consider the transaction model to include interactions. I think we can cut a branch at the very least to try it out and then graduate it into a beta branch / mainline it as an experimental option if that proves to work for our app at least.

1reaction
AbhiPrasadcommented, Oct 24, 2022

Note, @timfish’s work in #5987 does not include code for INP. That will have to be vendored separately (cc @k-fish)

Read more comments on GitHub >

github_iconTop Results From Across the Web

web-vitals - npm
Easily measure performance metrics in JavaScript. Latest version: 3.1.0, last published: a month ago. Start using web-vitals in your project ...
Read more >
Web Vitals - web.dev
Web Vitals is an initiative by Google to provide unified guidance for quality signals that are essential to delivering a great user experience ......
Read more >
Core Web Vitals report - Search Console Help - Google Support
The Core Web Vitals report shows URL performance grouped by status (Poor, Need improvement, Good), metric type (CLS, FID, LCP), and URL group...
Read more >
Impact on Web Vitals further reduced by at least 36% - VWO
VWO Core Library Upgrade: Impact on Web Vitals further reduced by at least 36%. Read this post to know more details about this...
Read more >
Core Web Vitals: A Complete Guide - Search Engine Journal
Google FAQ Provides Core Web Vitals Insights. 3. ... Are you ready for Google's Page Experience Update and Core Web Vitals – the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found