As part of the Table of Contents AB test, we want to measure clicks to the new table of contents vs. the old table of contents.
In order to do this we'll have to modify HTML for both the old & new table of contents and add data-event-{name} attributes to the link elements. The DesktopWebUIActionsTracking schema will then automatically track clicks to these elements.
Tech notes
The new table of contents in Vector is generated via mustache templates, so adding the HTML attribute would be trivial.
The old table of contents however, is generated via the wikitext parser, and adding the HTML attribute in that environment may be risky.
Instead of modifying the server-side rendering of these ToC's, we can instead inject this attribute in the DOM client-side via javascript, which would avoid caching implications as well.
Acceptance criteria
- Both the old and new table of contents have a data-event attribute on each section link.
- Clicks on section links are logged via the DesktopWebUIActionsTracking schema with all the data listed here
https://phabricator.wikimedia.org/T302934#7830157
https://phabricator.wikimedia.org/T302934#7830194
QA Results - Beta
AC | Status | Details |
---|---|---|
1 | ✅ | T302934#7830157 |
2 | ✅ | T302934#7830157 |
QA Results - Prod
AC | Status | Details |
---|---|---|
1 | ✅ | T302934#7830194 |
2 | ✅ | T302934#7830194 |