NEW AC
- The existing Popups schema is used to log:
- The total amount of time the user spent looking at a page (determined by the work already done by @bmansurov)
- The total amount of time the page was open.
- One Popups event is logged before the page is unloaded by the UA.
- No events are logged if the UA doesn't support the beacon API.
- This work is done in the Page Previews codebase.
Add reading depth to popups schema based on discussion in T145388: [Spike 1hr] Investigate alternate ways of defining reading depth, such that an event is logged at set intervals while a reader explores a page.
From: https://phabricator.wikimedia.org/T145388#2661200
See https://meta.wikimedia.org/wiki/Schema:TestSearchSatisfaction2
Add a new action type of event and field to Schema:Popups to track time on page, with analogous values to the checkin field on Schema:TestSearchSatisfaction2
checkin
type "integer"
required false
description "A numeric value representing the number of seconds a user has spent on a page. As with Schema:TestSearchSatisfaction2, the pings are at 10s, 20s, ..., 50s, 60s, 90s, 120s (2min), 150s, 180s (3min), 210s, 240s (4min), 300s (5min), 360s (6min), 420s (7min)."
And also add a variable for the visibility of the page (https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API#document.visibilityState_Read_only): visible or hidden for supported browsers, null or undefined for not supported ones.
Use the existing sampling rate for Hovercards.
Change timer based on visibility value. If visibility is "hidden" or "unknown" pause time. Visibility values may not have to be logged.
Note: browsers which do not support visibility will be paused throughout - these will be filtered out in analysis.