Page MenuHomePhabricator

Prepare mediawiki_web_ui_scroll schema for table of contents AB test
Closed, ResolvedPublic3 Estimated Story Points

Description

Based on our instrumentation need for the ToC AB test, as outlined in this Google doc
https://docs.google.com/spreadsheets/d/1CAXGqV2JR_bE0ulo9EU3I74Jm0Ln9z1u2CjC6zvra7I/edit#gid=0

We want to measure how often people scroll past the table of contents to read an article, then scroll back to the table of contents to click on a heading and navigate the article that way.

In order to measure this, we need to

  1. update the mediawiki_web_ui_scroll schema to accept a new "action" value, scroll-to-toc.
  2. Update the webUIScroll.js instrumentation to fire a new event when the table of contents is scrolled past and scrolled to (based on whether its entering the viewport from the top or the bottom).

QA steps

NOTE: local event logging setup is helpful to test new scroll-to-toc tracking event for TOC
$wgWMEWebUIScrollTrackingSamplingRate = 1;
$wgWMEWebUIScrollTrackingSamplingRateAnons = 1;
  • Navigate to a page in modern Vector with the legacy TOC in the main content (page can be populated by content provider).
  • Navigate to a page in modern Vector without the legacy TOC in the main content - i.e. append ?tableofcontent=1 querystring to local url (note that in a local dev environment, testing on page populated by content provider will not generate the new sticky TOC with the query param -- you need to have a locally created page with sections and headings - T299065 ticket description has sample html to render the sticky sidebar TOC).
  • The new scroll-to-toc event gets triggered by the following actions:
    • scroll down past either the rendered legacy TOC in the main content or the legacy TOC placeholder tag (present in the markup with TOC query param) in the main content
    • wait 5 seconds
    • then scroll back up past the bottom of the rendered legacy TOC or the legacy TOC placeholder.
    • note in your local eventlogging stream that a new scroll-to-toc action is submitted against the /analytics/mediawiki/web_ui_scroll/1.0.1 schema

Screen Shot 2022-03-29 at 2.06.55 PM.png (1×4 px, 1 MB)

Screen Shot 2022-03-29 at 2.14.11 PM.png (2×4 px, 1 MB)

QA Results - Prod

ACStatusDetails
1T303297#7981809
2T303297#7981809
3T303297#7981809

Event Timeline

Jdrewniak renamed this task from Prepare mediawiki_web_ui_scroll schema for ToC AB test to Prepare mediawiki_web_ui_scroll schema for table of contents AB test.Mar 8 2022, 5:16 PM

@ovasileva looking over this requirement once more, I have one question. It's clear how this metric should be instrumented for the old table of contents. In the new treatment, where the ToC is pinned, I don't think the scroll-back metric will be attainable (since the new ToC is pinned and therefore not scrollable, unless it overflows the viewport). Do we want to measure this only for the old ToC? Or measure it differently for the new one?

@ovasileva looking over this requirement once more, I have one question. It's clear how this metric should be instrumented for the old table of contents. In the new treatment, where the ToC is pinned, I don't think the scroll-back metric will be attainable (since the new ToC is pinned and therefore not scrollable, unless it overflows the viewport). Do we want to measure this only for the old ToC? Or measure it differently for the new one?

That's a good point! I think our goal is to look at how often people scroll to the place where the ToC used to be (similar to the sticky header where we looked at the very top of the page). So perhaps replacing a scroll to the ToC directly to a scroll to the bottom of the intro section would work?

Change 771700 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[schemas/event/secondary@master] Add new enum value to webuiscroll schema

https://gerrit.wikimedia.org/r/771700

hi @ovasileva, @Jdlrobson, @jwang

The current webUIScroll instrument (which tracks scroll-to-top events i.e. scrolling to page title) only logs events for logged in users at the following sampling rates:

default => 0.1
enwiki => 0.01

For scroll-to-toc events (scrolling to the legacy TOC in the main content - either to the placeholder tag or to the actual rendered legacy TOC), presumably we can keep the same sampling rates for logged-in users? Is this instrument also going to log events for anonymous users? If so, what should those sampling rates be?

We get around 10 events per second at peak.
For comparison, VirtualPageViews is 1.5K a second, so we could definitely increase sampling rate here.

Logged in users are around 1% of our traffic, so I'd suggest first extending this to anons before tweaking sampling rates.

Given 10 a second for logged in, we could expect 1K a second with anons, so we probably want to start with different sampling rates for anons (suggest 0.001 to start with as a precaution)
https://grafana.wikimedia.org/d/000000566/overview?orgId=1&viewPanel=29

Change 773628 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[mediawiki/extensions/WikimediaEvents@master] Update webUIScroll js to process new hook.

https://gerrit.wikimedia.org/r/773628

Change 773632 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[mediawiki/skins/Vector@master] Update scroll instrument for TOC

https://gerrit.wikimedia.org/r/773632

Logged in users are around 1% of our traffic, so I'd suggest first extending this to anons before tweaking sampling rates.
Given 10 a second for logged in, we could expect 1K a second with anons, so we probably want to start with different sampling rates for anons (suggest 0.001 to start with as a precaution)

thanks @Jdlrobson so does that mean the scroll-to-top events should be captured for anons as well?
Or should only the scroll-to-toc events be tracked for anons (plus logged-in)?

Moving this to code review because it is working but I've been wrestling with TS errors and need some fresh eyes to advise how to resolve.

Still to do:

  • Fix TS errors in Vector patch for using the fireScrollHook() method for both scroll-to-top and scroll-to-toc events - so that we can remove @ts-ignore before calling the .fire() method on mw.hook:
Property 'fire' does not exist on type 'mwHookInstance'.
  • Adjust webUIScroll.js in WME patch to account for anonymous users and corresponding sampling rates
cjming subscribed.

Change 771700 merged by jenkins-bot:

[schemas/event/secondary@master] Add new enum value to webuiscroll schema

https://gerrit.wikimedia.org/r/771700

Change 773890 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[mediawiki/skins/Vector@master] Update @wikimedia/types-wikimedia to latest version

https://gerrit.wikimedia.org/r/773890

Change 773890 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Update @wikimedia/types-wikimedia to latest version

https://gerrit.wikimedia.org/r/773890

Change 773632 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Update scroll instrument for TOC

https://gerrit.wikimedia.org/r/773632

Change 773628 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] Update webUIScroll js to process new hook.

https://gerrit.wikimedia.org/r/773628

Change 784690 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[operations/mediawiki-config@master] Add wgWMEWebUIScrollTrackingSamplingRate config to beta

https://gerrit.wikimedia.org/r/784690

@Jdlrobson I've taken a stab at getting the ACs from the QA steps. Below is what I have so far. I am unable to get any events while Anon. I have tried a few usernames and articles.

QA Steps: scroll down past either the rendered legacy TOC in the main content or the legacy TOC placeholder tag (present in the markup with TOC query param) in the main content
wait 5 seconds
then scroll back up past the bottom of the rendered legacy TOC or the legacy TOC placeholder.

AC1: note in your local eventlogging stream that a new scroll-to-toc action is submitted against the /analytics/mediawiki/web_ui_scroll/1.0.1 schema

Logged In
New TOCLegacy TOC
Screen Shot 2022-06-02 at 9.28.41 AM.png (256×689 px, 46 KB)
Screen Shot 2022-06-02 at 9.28.26 AM.png (260×713 px, 46 KB)
Screen Shot 2022-06-02 at 9.31.46 AM.png (230×680 px, 42 KB)
Screen Shot 2022-06-02 at 9.31.55 AM.png (232×682 px, 42 KB)
Anon
New TOCLegacy TOC

hi @Edtadros - did you test on a locally created page with TOC sections? In my experience, content provider pages don't work (can't remember why) for testing.

Edtadros subscribed.

Test Result - Prod

Status: ✅ PASS
Environment: euwiki
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

✅ AC1: Navigate to a page in modern Vector with the legacy TOC in the main content
as a logged-in user i.e. https://eu.wikipedia.org/wiki/Belgika

Screen Shot 2022-06-05 at 6.50.16 PM.png (1×1 px, 333 KB)

as anon i.e. https://eu.wikipedia.org/wiki/Belgika?useskin=vector-2022

Screen Shot 2022-06-05 at 6.50.22 PM.png (1×1 px, 317 KB)

✅ AC2: Navigate to a page in modern Vector without the legacy TOC in the main content - i.e. append ?tableofcontent=1 querystring
as a logged-in user i.e. https://eu.wikipedia.org/wiki/Belgika?tableofcontents=1

Screen Shot 2022-06-05 at 6.56.45 PM.png (1×1 px, 512 KB)

as anon i.e. https://eu.wikipedia.org/wiki/Belgika?useskin=vector-2022&tableofcontents=1
Screen Shot 2022-06-05 at 6.56.49 PM.png (1×1 px, 478 KB)

✅ AC3: The new scroll-to-toc event gets triggered by the following actions:
scroll down past either the rendered legacy TOC in the main content or the legacy TOC placeholder tag (present in the markup with TOC query param) in the main content
wait 5 seconds
then scroll back up past the bottom of the rendered legacy TOC or the legacy TOC placeholder.
note in your local eventlogging stream that a new scroll-to-toc action is submitted against the /analytics/mediawiki/web_ui_scroll/1.0.1 schema

as a logged-in user i.e. https://eu.wikipedia.org/wiki/Belgika?tableofcontents=1

Screen Shot 2022-06-05 at 6.58.12 PM.png (1×1 px, 460 KB)

Screen Shot 2022-06-05 at 6.58.19 PM.png (1×1 px, 453 KB)

Screen Shot 2022-06-05 at 7.04.59 PM.png (1×1 px, 482 KB)

Screen Shot 2022-06-05 at 7.04.55 PM.png (1×1 px, 482 KB)

as anon i.e. https://eu.wikipedia.org/wiki/Belgika?useskin=vector-2022&tableofcontents=1

Screen Shot 2022-06-05 at 7.03.50 PM.png (1×1 px, 452 KB)

Screen Shot 2022-06-05 at 7.03.56 PM.png (1×1 px, 453 KB)

Screen Shot 2022-06-05 at 7.05.19 PM.png (1×1 px, 513 KB)

Screen Shot 2022-06-05 at 7.05.23 PM.png (1×1 px, 514 KB)

Looks good, resolving. Further checks will be done as part of the analysis

Change 784690 abandoned by Jdrewniak:

[operations/mediawiki-config@master] Add wgWMEWebUIScrollTrackingSamplingRate config to beta

Reason:

https://gerrit.wikimedia.org/r/784690