Page MenuHomePhabricator

Pinned and unpinned menus should be instrumented in click tracking with different IDs
Closed, ResolvedPublic5 Estimated Story Points

Description

Right now if I click a link in the page tools when its pinned, the event is identical to the event when it is not pinned. We want these events to be unique.

Instrumentation

  • Make sure all menu items have unique event-data-name attributes suffixed with ".unpinned". For example clicking the main menu link currently triggers an event n-mainpage-description.pinned, however when clicked inside the dropdown we want that to be n-mainpage-description.unpinned. Use your best judgement on whether to add this in JavaScript or PHP.
  • Once done, mark the appropriate field for that event in the instrumentation spec: https://docs.google.com/spreadsheets/d/18FstayDXt-PKfy7qxL2AQ_dMjn59YdF9d2wHaS1vjTg/edit#gid=0

QA Results - Beta

ACStatusDetails
1T324878#8515579
2T324878#8515579

QA Results - Prod

ACStatusDetails
1T324878#8529807
2T324878#8529807

Event Timeline

Jdlrobson set the point value for this task to 1.Dec 10 2022, 12:29 AM

Change 866661 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Instrument pinned and unpinned links differently

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

This is what I recommend doing here:

  • Updating the pinning functionality to operate on PinnedContainer component.
  • Using JS to set the correct. I've used "-pinned" and "-unpinned" in the example so we can distinguish our new events from cached HTML.

Note: I didn't check if events run twice. Presumably they won't since the same event handler runs on both and data-event-name is usually preferred.

Feel free to take over my patch in my absence :)

Change 866661 abandoned by Jdlrobson:

[mediawiki/skins/Vector@master] Instrument pinned and unpinned links differently

Reason:

Just demonstrating how this could work. Feel free to fork this to a new patch with yourself as the author if you want to work off of my code :)

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

LGoto renamed this task from Pinned and unpinned menus should be instrumented in click tracking with different IDs to [M] Pinned and unpinned menus should be instrumented in click tracking with different IDs.Dec 12 2022, 6:23 PM

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

[mediawiki/extensions/WikimediaEvents@master] Distinguish between pinned/unpinned elements in desktopWebUIActions

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

@Jdlrobson I've considered the suggestion above and taken a slightly different approach.

Modifying all DOM elements during pinning/unpinning event seemed a little risky, given that gadgets can insert elements in the menu, and performance wise, it also seemed like a lot of DOM operations for functionality that's only meant for WMF analytics. For these reasons, I placed this logic in the Wikimedia Events repo instead.

The approach is basically: on click, find the parent pinnable header, and if it exists, use that to modify the event data. The pinnable header contains the pinned/unpinned state as well as a "feature-name" attribute. I think it would be useful to include that feature-name attribute in the event data as well.

So for example, instead of ca-protect the event data would now be ca-protect.vector-page-tools.pinned

Just want to confirm that this would be useful?

@Jdrewniak yes this seems like a lot better approach than mine. I have a few questions on the Gerrit patch.

Change 875997 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Vector@master] Log events for pinnable header button

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

Change 869266 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] Distinguish between pinned/unpinned elements in desktopWebUIActions

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

Change 875997 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Log events for pinnable header button

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

Edtadros subscribed.

@Jdlrobson, please see the ❓ items below.

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

Main Menu link click events should indicate whether the menu was pinned or unpinned.

AC1: Unpinned

Main Page:

Screenshot 2023-01-10 at 8.35.23 PM.png (354×837 px, 76 KB)

Current Events:
Screenshot 2023-01-10 at 8.39.33 PM.png (348×771 px, 68 KB)

Contents:
Screenshot 2023-01-10 at 8.40.24 PM.png (346×854 px, 70 KB)

Random Page:
Screenshot 2023-01-10 at 8.41.10 PM.png (348×786 px, 68 KB)

About:
Screenshot 2023-01-10 at 8.42.32 PM.png (355×766 px, 68 KB)

Contact page:
Screenshot 2023-01-10 at 8.43.33 PM.png (353×825 px, 71 KB)

✅ (pass per T324878#8517548) Donate to Wikipedia:
event says sitesupport, I'm assuming this is because it's beta
Screenshot 2023-01-10 at 8.44.34 PM.png (349×807 px, 70 KB)

⬜ (not testable T324878#8517548) Switch to Old Version:
no event is triggered
Help:
Screenshot 2023-01-10 at 8.45.55 PM.png (349×842 px, 69 KB)

Community Portal:
Screenshot 2023-01-10 at 8.49.15 PM.png (349×803 px, 68 KB)

Recent Changes:
Screenshot 2023-01-10 at 8.36.57 PM.png (356×791 px, 73 KB)

Upload:
Screenshot 2023-01-10 at 8.37.59 PM.png (354×824 px, 69 KB)

AC2: Pinned to Sidebar

Main Page:

Screenshot 2023-01-10 at 8.52.13 PM.png (350×794 px, 69 KB)

Current Events:
Screenshot 2023-01-10 at 8.55.13 PM.png (351×781 px, 69 KB)

Contents:
Screenshot 2023-01-10 at 8.55.39 PM.png (350×760 px, 68 KB)

Random Page:
Screenshot 2023-01-10 at 8.56.10 PM.png (351×768 px, 71 KB)

About:
Screenshot 2023-01-10 at 8.56.35 PM.png (351×772 px, 68 KB)

Contact page:
Screenshot 2023-01-10 at 8.57.07 PM.png (348×760 px, 72 KB)

❓ Donate to Wikipedia:
event says sitesupport, I'm assuming this is because it's beta
Screenshot 2023-01-10 at 8.57.34 PM.png (347×756 px, 71 KB)

❓ Switch to Old Version:
no event is triggered
Help:
Screenshot 2023-01-10 at 8.58.07 PM.png (350×757 px, 68 KB)

Community Portal:
Screenshot 2023-01-10 at 8.58.34 PM.png (347×775 px, 73 KB)

Recent Changes:
Screenshot 2023-01-10 at 8.59.01 PM.png (345×776 px, 73 KB)

Upload:
Screenshot 2023-01-10 at 8.59.28 PM.png (346×771 px, 68 KB)

LGTM.

"❓ Switch to Old Version" > we track that by looking at preferences changes (since some people may follow the link but not act on it)

event says sitesupport, I'm assuming this is because it's beta

That's fine. IT will be the same in production. It's unintuitive but as long as it's unique that's good.

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

Main Menu link click events should indicate whether the menu was pinned or unpinned.

AC1: Unpinned

Main Page:

Screenshot 2023-01-16 at 5.03.40 PM.png (346×810 px, 68 KB)

Current Events:
Screenshot 2023-01-16 at 5.04.11 PM.png (357×829 px, 68 KB)

Contents:
Screenshot 2023-01-16 at 5.03.56 PM.png (354×842 px, 68 KB)

Random Page:
Screenshot 2023-01-16 at 5.06.12 PM.png (354×780 px, 67 KB)

About:
Screenshot 2023-01-16 at 5.06.44 PM.png (351×815 px, 68 KB)

Contact page:
Screenshot 2023-01-16 at 5.07.23 PM.png (354×796 px, 68 KB)

✅ (pass per T324878#8517548) Donate to Wikipedia:
Screenshot 2023-01-16 at 5.19.42 PM.png (351×838 px, 68 KB)

⬜ (not testable T324878#8517548) Switch to Old Version:
no event is triggered
Help:
Screenshot 2023-01-16 at 5.19.59 PM.png (352×820 px, 67 KB)

Learn to edit:
Screenshot 2023-01-16 at 5.13.39 PM.png (350×784 px, 67 KB)

Community Portal:
Screenshot 2023-01-16 at 5.13.58 PM.png (351×802 px, 72 KB)

Recent Changes:
Screenshot 2023-01-16 at 5.14.17 PM.png (347×772 px, 67 KB)

Upload:
Screenshot 2023-01-16 at 5.14.33 PM.png (354×802 px, 70 KB)

AC2: Pinned to Sidebar

Main Page:

Screenshot 2023-01-16 at 5.25.00 PM.png (359×989 px, 71 KB)

Current Events:
Screenshot 2023-01-16 at 5.25.09 PM.png (359×989 px, 70 KB)

Contents:
Screenshot 2023-01-16 at 5.25.19 PM.png (359×989 px, 69 KB)

Random Page:
Screenshot 2023-01-16 at 5.25.27 PM.png (359×989 px, 70 KB)

About:
Screenshot 2023-01-16 at 5.25.36 PM.png (359×989 px, 70 KB)

Contact page:
Screenshot 2023-01-16 at 5.25.44 PM.png (359×989 px, 70 KB)

✅ (pass per T324878#8517548) Donate to Wikipedia:
Screenshot 2023-01-16 at 5.26.41 PM.png (359×989 px, 70 KB)

⬜ (not testable T324878#8517548) Switch to Old Version:
no event is triggered
Help:
Screenshot 2023-01-16 at 5.26.47 PM.png (359×989 px, 70 KB)

Learn to edit:
Screenshot 2023-01-16 at 5.26.53 PM.png (359×989 px, 70 KB)

Community Portal:
Screenshot 2023-01-16 at 5.26.59 PM.png (359×989 px, 70 KB)

Recent Changes:
Screenshot 2023-01-16 at 5.27.04 PM.png (359×989 px, 70 KB)

Upload:
Screenshot 2023-01-16 at 5.27.12 PM.png (359×989 px, 72 KB)

Jdlrobson renamed this task from [M] Pinned and unpinned menus should be instrumented in click tracking with different IDs to Pinned and unpinned menus should be instrumented in click tracking with different IDs.Jan 17 2023, 5:53 PM
Jdlrobson changed the point value for this task from 1 to 5.