Page MenuHomePhabricator

Add Block link to MobileWebUIActionsTracking schema
Closed, ResolvedPublic

Description

In T307341 we are adding a Block link to the Overflow menu. We would also like to add this to the MobileWebUIActionsTracking event logging schema so that we can monitor usage of the link.

The data-event-name could be menu.block to keep in the same style as the other list elements.

Event Timeline

I think the dev working on this will need to request hue access to actually verify this change succeeds. One of the TST engineers had to do this for quicksurveys, so I'll ask him about that process.

I think the dev working on this will need to request hue access to actually verify this change succeeds. One of the TST engineers had to do this for quicksurveys, so I'll ask him about that process.

I have hue access and have retrieved data from this schema, so if it would work for you I can always check :)

I suspect that we might not need to change the schema to track this.

Because of the way the skin is written, the button is already getting generated with the expected data-event-name, eg:

<a class="toggle-list-item__anchor menu__item--page-actions-overflow-block" href="/wiki/Special:Block/<username>" data-event-name="menu.block" data-mw="interface">
  <span class="mw-ui-icon mw-ui-icon-minerva-block"></span>
  <span class="toggle-list-item__label">Block user</span>
</a>

The event logged is click and the name is menu.block. It took me a while to figure out where the event would get generated because I wasn't seeing it in my local eventbus, but then I realized that this was in yet another repository, the WikimediaEvents extension.
https://gerrit.wikimedia.org/g/mediawiki/extensions/WikimediaEvents/+/4069af2ec63f4d5a03138bcac39022d097b1e044/modules/all/ext.wikimediaEvents.mobileWebUIActions.js#53

This current schema already accomodates this
https://gerrit.wikimedia.org/r/plugins/gitiles/schemas/event/secondary/+/913e0b64ba063044389a874b67834cffbdfc83ce/jsonschema/analytics/legacy/mobilewebuiactionstracking/1.1.0.yaml#77

I found it helpful to read through the tracking task for the creation of the schema:
T220016: Create, and deploy working MobileWebUIActionsTracking schema

Oh that's great, thanks for explaining. Because I noted that the Download PDF button didn't have this attribute (T305928#7860647) I assumed it needed to be added manually. I can't actually find that button anymore so I'm not sure why it didn't.

This all sounds good then, I'll check we're getting data once T307341 is deployed.

I verified this is working as expected by setting up the WikimediaEvents extension locally and setting $wgWMEMobileWebUIActionsTracking = 1.
I could then see the events coming across the bus in my docker logs:

2022-05-11T14:59:50.506088544Z     event: {
2022-05-11T14:59:50.506094149Z       "event": {
2022-05-11T14:59:50.506098697Z         "action": "click",
2022-05-11T14:59:50.506103049Z         "name": "menu.block",
2022-05-11T14:59:50.506107558Z         "modes": "stable",
2022-05-11T14:59:50.506111851Z         "token": "a0e3a14c4d52ab9875c9",
2022-05-11T14:59:50.506116271Z         "isAnon": false,
2022-05-11T14:59:50.506120274Z         "editCountBucket": "5-99 edits",
2022-05-11T14:59:50.506124142Z         "destination": "/wiki/Special:Block/Docker1"
2022-05-11T14:59:50.506127714Z       },
2022-05-11T14:59:50.506130978Z       "schema": "MobileWebUIActionsTracking",
2022-05-11T14:59:50.506134752Z       "webHost": "localhost",
2022-05-11T14:59:50.506138710Z       "wiki": "my_wiki",
2022-05-11T14:59:50.506142458Z       "$schema": "/analytics/legacy/mobilewebuiactionstracking/1.1.0",
2022-05-11T14:59:50.506147825Z       "client_dt": "2022-05-11T14:59:50.373Z",
2022-05-11T14:59:50.506151937Z       "meta": {
2022-05-11T14:59:50.506162997Z         "stream": "eventlogging_MobileWebUIActionsTracking",
2022-05-11T14:59:50.506167583Z         "domain": "localhost",
2022-05-11T14:59:50.506171242Z         "id": "b9c9c2d6-c2b1-46fc-b16b-a0cb2534a3f1",
2022-05-11T14:59:50.506174791Z         "dt": "2022-05-11T14:59:50.505Z",
2022-05-11T14:59:50.506178450Z         "request_id": "01cb9e80-d13b-11ec-bbd2-ab8492c11a81"
2022-05-11T14:59:50.506182254Z       },
2022-05-11T14:59:50.506185797Z       "dt": "2022-05-11T14:59:50.505Z",
2022-05-11T14:59:50.506189034Z       "http": {
2022-05-11T14:59:50.506192190Z         "request_headers": {
2022-05-11T14:59:50.506195426Z           "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39"
2022-05-11T14:59:50.506198558Z         }
2022-05-11T14:59:50.506201339Z       }
2022-05-11T14:59:50.506204062Z     }

Note that in real life this is sampled at a rate that's defined on a per-project basis. I just set the rate to 1 (which is 100%) for local testing.

This should be coming in but I'm going to give it until next week to check given that the sampling rate is pretty low.