== Background
Based on {T287709} 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}
== Acceptance criteria
[x] Should log the user session ID
[x] Should log the page id where the event happens
[x] Should log whether user is anonymous
[x] Should be sampled and configurable, by default 0 to allow us to roll out as needed.
[x] Should only run on the Vector skin
[x] An init event should be logged that a user is eligible for "scroll to top events"
[x] An event should be logged when the user scrolls to the top (See definition)
[x] 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:
1) The sticky header displays
2) At least 5 seconds pass
3) The sticky header disappears (because the user scrolls to to the top)
[x] The code should live in WikimediaEvents.Use mw.track in Vector if you need to trigger events relating to codepoints in Vector.
== Developer notes
[[ https://docs.google.com/spreadsheets/d/1xIYNfXMGghVdnCNTjz7ujLm0BHCv6kfMqc9SRGm_MOU/edit#gid=1871341179 | 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`:
```
"WMEWebUIScrollTrackingIsEnabled": {
"value": true
},
"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).
{F34722676}