Background
Based on T287709: [SPIKE] Explore instrumentation for sticky header work and subsequent discussion, we will be creating a schema that tracks whether the user is visiting the top of the page. This schema will be used to answer the research questions outlines in T287709: [SPIKE] Explore instrumentation for sticky header work
Acceptance criteria
- Should log the user session ID
- Should log the page id where the event happens
- Should log whether user is anonymous
- Should be sampled and configurable, by default 0 to allow us to roll out as needed.
- Should only run on the Vector skin
- An init event should be logged that a user is eligible for "scroll to top events"
- An event should be logged when the user scrolls to the top (See definition)
- An event should be logged when a user is believed to have scrolled to the top. For now, this is defined as when the following sequence of events occurs:
- The sticky header displays
- At least 5 seconds pass
- The sticky header disappears (because the user scrolls to to the top)
- The code should live in WikimediaEvents.Use mw.track in Vector if you need to trigger events relating to codepoints in Vector.
Developer notes
sticky header instrumentation spec
QA steps
- For testing event logging locally, the following config will be needed in local settings:
$wgVectorWebABTestEnrollment = [ 'name' => 'sticky_header_2021_11', 'enabled' => true, 'buckets' => [ 'unsampled' => [ 'samplingRate' => 0.1, ], 'control' => [ 'samplingRate' => 0.3, ], 'stickyHeaderDisabled' => [ 'samplingRate' => 0.3, ], 'stickyHeaderEnabled' => [ 'samplingRate' => 0.3, ] ] ];
- The following config should also be updated locally for testing purposes only in ../extensions/WikimediaEvents/extension.json:
"WMEWebUIScrollTrackingSamplingRate": { "value": 1 }, "WMEWebUIScrollTrackingTimeToWaitBeforeScrollUp": { "value": 5000 },
- Create some new test users to make sure you have one in each group: control, stickyHeaderDisabled, stickyHeaderEnabled (eventlogging will indicate which bucket the user is in by the group key if testing T292587 alongside this ticket -- or inject debugger code in L524 of stickyHeader.js to view which group the user is assigned).
debugger injected into javascript if using:
// eslint-disable-next-line no-debugger debugger;
- For all groups, the scroll-to-top event should be logged every time after one has scrolled down, pauses for 5 seconds, and then scrolls back up to the top of the page (i.e. above the page title).
QA Results - Beta
AC | Status | Details |
---|---|---|
1 | ✅ | T292586#7556542 |
QA Results - Prod
AC | Status | Details |
---|---|---|
1 | ✅ | T292586#7573091 |