I want a browser API to measure the time a user actively interacts with a site
Submitted by Raphael Louis Andress
Permalink https://webwewant.fyi/wants/6d005105-5c39-4a18-af6b-f43337b927a9/
This idea is currently being discussed.
I want a browser API that lets me accurately measure the time a user actively interacts with a website, not just how long the page has been open.
Today, the closest native tool is the Page Visibility API, which tells me whether a tab is in the foreground or background. However, it cannot distinguish between a user who is actively reading, typing, or clicking and one who has simply left the tab open in the background while doing something else. Idle-detection workarounds based on mousemove or keydown events are unreliable: they miss touch input patterns, produce false positives, and vary wildly across implementations.
A dedicated user.interact API would expose the cumulative duration of genuine user engagement with the page. It would go beyond visibility by tracking whether the user is actually providing input -- clicking, scrolling, typing, or using touch -- and pausing the clock during idle periods.
This would allow developers to:
- Build fairer analytics dashboards that report real engagement rather than raw session length.
- Implement time-based features (session timeouts, content recommendations, paywalls) with a reliable signal instead of heuristic timers.
- Offer users a transparent account of how long they have been actively using an application.
The proposal includes a reference implementation and has been discussed in the WICG forum. Standardizing this capability in the browser would eliminate the need for fragile, hand-rolled engagement trackers and provide a consistent, privacy-respecting measurement baseline across all browsers.
- Votes
- 0
What are votes for and how are they tallied?