GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.49k stars 410 forks source link

INP attribution eventTarget is empty #352

Closed VishalGulati closed 1 year ago

VishalGulati commented 1 year ago

I recently started exploring onINP and on integration in my React app code, I found it only randomly reports the eventTarget. Most of the times I got eventTarget as "". What could be the reason. Does INP need some attribute/HTML semantics to be in some particular way to work? Below is my code:

import {onINP} from 'web-vitals/attribution';

const sendVitals = (metricData = {}) => {
  console.log('INP --- ', JSON.stringify(metricData))
};

onINP(sendVitals, { reportAllChanges: true });

Here is what I get generally:

{
  "name": "INP",
  "value": 336,
  "rating": "needs-improvement",
  "delta": 336,
  "entries": [...],
  "id": "v3-993993993999-00901993993",
  "navigationType": "reload",
  "attribution": {
    "eventTarget": "",
    "eventType": "click",
    "eventTime": 38352.89999999851,
    "eventEntry": {
      "name": "click",
      "entryType": "event",
      "startTime": 38352.89999999851,
      "duration": 336,
      "processingStart": 38370,
      "processingEnd": 38631.60000000149,
      "cancelable": true
    },
    "loadState": "complete"
  }
}

How do I get the eventTarget to further work on this field data?

tunetheweb commented 1 year ago

This is being tracked here: https://bugs.chromium.org/p/chromium/issues/detail?id=1428899

Though #344 could be another reason.

tunetheweb commented 1 year ago

Duplicate of #335