Session length will be the StickyHeaders experiment's primary metric, see T409163: Set up measurement plan and instrumentation spec for mobile sticky headers.
There are two available implementations with overlapping logic:
@jwang suggests the following from a past instrumentation effort:
the search recommendation feature had session length tracking enabled before. It fired events every 30 seconds, starting when the search box was focused. In the analysis, we count the maximum number of tick events to determine the session length.
Here is the instrumentation spec of search recommendation. I think we could do similar tracking, but change the trigger to when the user loads the page. (FYI. this tick method starts from page load)
Determine whether one of the implementations can be re-used.
Output of spike: confirmed we want to tweak WikimediaEvents' SessionLengthInstrumentMixin to be xLab-Experiment-friendly as a short-term solution and are happy to help out ́Experiment Platform with a patch from our end, if they can provide code review.
Breaking out the implementation work to T410533, moving the WIP patches over there for further work.