Page MenuHomePhabricator

Instrument how frequently Special:Notifications is visited
Closed, ResolvedPublic

Description

We kind of have proxy numbers for this because we have the number of notification impressions from each source, but they also show different numbers of notifications by default. So let's also instrument the number of times people open each of them.

We already have mw.echo.logger.logInteraction( 'ui-badge-link-click', ... ) for the panel, so we'd just need to add instrumentation code (server-side, ideally) to Special:Notifications.

Event Timeline

Catrope created this task.Dec 19 2015, 12:00 AM
Catrope raised the priority of this task from to Normal.
Catrope updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 19 2015, 12:00 AM

@Milimetric, is there any way to use page view data for this, or is it too much of a pain because of the localized page names (Especial:Notificaciones)? Wondering if this is canonicalized somehow.

@Mattflaschen: You can certainly use the pageview API for it, but I'm not sure why it would be too much of a pain to look up the localized page names. I don't know exactly how to do it, but aren't all the different versions of Special:Notification on translate wiki or something like that? I remember we got all the versions of Special:MainPage once so we could filter them out of a top10 demo we did. So get all of them, and then query the api for each one. So for spanish, October data is:

https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/es.wikipedia/all-access/all-agents/Especial:Notificaciones/daily/2015100100/2015103100

And you can graph it with this demo app we have (which it looks more and more like we'll at some point make into a production thing):

https://analytics.wmflabs.org/demo/pageview-api/#articles=Especial:Notificaciones&startDate=2015-10-01&endDate=2015-10-31&project=eswiki

It would be a little tricky (Echo.alias.php is not yet in JSON form, and the namespace part (Especial) is separate from the other part (Notificationes). I was wondering if you already had reusable code for this part.

It sounds like no. It's completely doable, but a straight EventLogging::logEvent would probably be a lot easier.

Main Page is a similar concept, but different (it's not a special page), so the code is probably not reusable.

Right, we have no existing code, I agree a simple logEvent would be easier. I'm kicking myself because I feel like we should've had a dev summit session on handling localization better in Analytics.

Change 303079 had a related patch set uploaded (by Mooeypoo):
Log Special:Notifications page visits

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

Change 303079 merged by jenkins-bot:
Log Special:Notifications page visits

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

@Mooeypoo A question: should 'action' => 'special-page-visit' be present in

mysql:research@s1-analytics-slave [log]> select distinct(event_action) from EchoInteraction_15823738; 
+-------------------------------------+
| event_action                        |
+-------------------------------------+
| notification-link-click             |
| notification-bundle-expand          |
| mark-all-read-click                 |
| ui-badge-link-click                 |
| mark-entire-xwiki-bundle-read-click |
+-------------------------------------+
5 rows in set (0.04 sec)

mark-entire-xwiki-bundle-read-click ( from T127955: Measure how often the "mark all as read" action is used in the Notification Panel) is there. And 'context' => 'archive' is present as event_context='archive'

@Mooeypoo A question: should 'action' => 'special-page-visit' be present in

mysql:research@s1-analytics-slave [log]> select distinct(event_action) from EchoInteraction_15823738; 
+-------------------------------------+
| event_action                        |
+-------------------------------------+
| notification-link-click             |
| notification-bundle-expand          |
| mark-all-read-click                 |
| ui-badge-link-click                 |
| mark-entire-xwiki-bundle-read-click |
+-------------------------------------+
5 rows in set (0.04 sec)

mark-entire-xwiki-bundle-read-click ( from T127955: Measure how often the "mark all as read" action is used in the Notification Panel) is there. And 'context' => 'archive' is present as event_context='archive'

This is off. The xwiki-bundle doesn't appear in 'archive' (which is what we call the special page) so its context should be the 'flyout' and special page visit is defined as 'action' => 'special-page-visit' in the code, so it should appear as such.

Double checking the code, for xwiki bundle, it appears as:

		mw.echo.logger.logInteraction(
			mw.echo.Logger.static.actions.markXWikiReadClick,
			mw.echo.Logger.static.context.popup,
			null, // Event ID is omitted
			this.controller.getTypeString() // The type of the list in general
		);

And for the special page (in PHP) it is written as

		// Log visit
		MWEchoEventLogging::logEchoInteraction( $user, $out->getSkin()->getSkinName() );

Which is defined as

		self::actuallyLogTheEvent(
			'EchoInteraction',
			array(
				'context' => 'archive',
				'action' => 'special-page-visit',
				'userId' => (int)$user->getId(),
				'editCount' => (int)$user->getEditCount(),
				'notifWiki' => wfWikiID(),
				// Hack: Figure out if we are in the mobile skin
				'mobile' => $skinName === 'minerva',
			)
		);

I'm super confused here. Pinging @Catrope for assistance.

(By the way, logInteraction sounds like it should be general enough to not just include the special page - on the other hand, I imagine it's like this because in the PHP side that's the only thing we can log (the popup, both in mobile and desktop, is only logged through JS))

This is off. The xwiki-bundle doesn't appear in 'archive' (which is what we call the special page) so its context should be the 'flyout' and special page visit is defined as 'action' => 'special-page-visit' in the code, so it should appear as such.

Re xwiki-bundle, it is:

mysql:research@s1-analytics-slave [log]> SELECT DISTINCT event_context FROM EchoInteraction_15823738 WHERE event_action = 'mark-entire-xwiki-bundle-read-click';
+---------------+
| event_context |
+---------------+
| flyout        |
+---------------+
1 row in set (0.18 sec)

The only one with 'archive' is 'mark-all-read-click':

mysql:research@s1-analytics-slave [log]> SELECT DISTINCT event_action FROM EchoInteraction_15823738 WHERE event_context = 'archive';
+---------------------+
| event_action        |
+---------------------+
| mark-all-read-click |
+---------------------+
1 row in set (0.10 sec)

Looking at the missing 'special-page-visit' now.

Change 306053 had a related patch set uploaded (by Mattflaschen):
Fix special page visit logging

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

'special-page-visit' wasn't being logged because it was missing 'version'.

Fixed (including the name) and tested all the server-side schemas.

Change 306053 merged by jenkins-bot:
Fix special page visit logging

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

Etonkovidova added a comment.EditedAug 24 2016, 12:43 AM

Thx @Mattflaschen-WMF!
s1-analytics-slave [log] has now records for all new events (Note: 'mark-all-read-click' event is recorded from 'flyout' and 'archive' clicks):

mysql:research@s1-analytics-slave [log]> select event_action, event_context, count(*) as event_count from EchoInteraction_15823738 group by event_action, event_context;
+-------------------------------------+---------------+-------------+
| event_action                        | event_context | event_count |
+-------------------------------------+---------------+-------------+
| mark-all-read-click                 | archive       |         104 |
| mark-all-read-click                 | flyout        |        6142 |
| mark-entire-xwiki-bundle-read-click | flyout        |        1424 |
| notification-bundle-expand          | flyout        |       22953 |
| notification-link-click             | flyout        |       69202 |
| special-page-visit                  | archive       |           9 |
| ui-badge-link-click                 | NULL          |      139588 |
+-------------------------------------+---------------+-------------+
7 rows in set (1.43 sec)
jmatazzoni closed this task as Resolved.Sep 12 2016, 8:49 PM