GoogleChrome / GoogleChrome/web-vitals
Include TTFB attribution data in the LCP attribution object
- Dominant language
- JavaScript
- Stars
- 8.6k
- Forks
- 531
- Avg merge
- 3h 4m
- Merged PRs (30d)
- 3
Description
The answer to "why was my LCP slow" can sometimes be found in the sub-TTFB diagnostics, so it'd be useful for that data to be available in the LCP attribution object. This would ensure that the data can be included in the same analytics payload as the rest of the LCP info, avoiding the need to join the records on the backend if TTFB and LCP were sent separately. While the raw navigation entry is already made available, and the [attribution logic](https://github.com/GoogleChrome/web-vitals/blob/main/src/attribution/onTTFB.ts#L25) is pretty straightforward, it still seems redundant for the client to do that work in the LCP handler.
There could be a new `timeToFirstByteAttribution` property added to LCP's attribution object, whose value could be the five duration properties provided by TTFB attribution, i.e. everything except for `navigationEntry`.
Contributor guide
Research direction
Start by reading the attribution logic in src/attribution/onTTFB.ts and then locate the LCP handler and its attribution object. Confirm which five TTFB duration properties are exposed, excluding navigationEntry. Done means LCP attribution includes them under a new timeToFirstByteAttribution property without requiring a separate client-side join.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100