Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using performance.eventCounts instead of performance.interactionCount #491

Closed
ekremney opened this issue Jun 6, 2024 · 2 comments
Closed

Comments

@ekremney
Copy link

ekremney commented Jun 6, 2024

I couldn't find any reference to performance.interactionCount on web (except one W3 document). Also, both Google Chrome and Firefox don't seem to have it -> both returns undefined.

Suggesting to use the performance.eventCounts property instead of interactionCount to getInteractionCount.

@mmocny
Copy link
Member

mmocny commented Jun 6, 2024

The one w3 document I assume is the Event Timing spec?

Chrome has implemented this feature, but it is still behind a feature flag in Stable (or via experimental web platform features). We expect to ship it in stable.

eventCounts is not possible to use as a way to estimate interactionCount (and its the reason Event Timing added interactionCount). (You can also find lots of discussion in the Web Perf WG for this feature).


The single biggest flaw of eventCount is that it does not differentiate when e.g. pointer events actually become a scroll, or how keyboard events might trigger clicks, or how accessibility or IME interfaces might dispatch events in different orders...

You could try to approximate interactionCount but using something like the count of clicks - count of pointerCancel, and an earlier version of web-vitals.js actually tried that (especially since this is supported on Firefox). Unfortunately it was off and unreliable on all browsers.

@ekremney
Copy link
Author

ekremney commented Jun 6, 2024

that's a very clear explanation, thanks @mmocny!

@ekremney ekremney closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants