Page MenuHomePhabricator

Maps: figure out usage of layer data in Wikivoyage maps
Closed, ResolvedPublic2 Estimated Story Points

Description

Due to lack of exact eventlogging on the usage of the relief data or mapnik layer used in Wikivoyage (and elsewhere), let's get some set up.

See this link for a map on Wikivoyage and click on the layer icon on the top right to see it in action: https://en.wikivoyage.org/wiki/Wikivoyage:Travellers%27_pub#.22API_Key_Required.22

Event Timeline

mpopov set the point value for this task to 2.
mpopov moved this task from Backlog to In progress on the Discovery-Analysis (Current work) board.

Found where layer selection events are implemented: https://github.com/wikimedia/mediawiki-extensions-Kartographer/blob/master/modules/wikivoyage/WVMapLayers.js

Shouldn't be too hard to add layer name into the extra field.

Change 366183 had a related patch set uploaded (by Bearloga; owner: Bearloga):
[mediawiki/extensions/Kartographer@master] Augment event logging for switching layers

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

Change 366184 had a related patch set uploaded (by Bearloga; owner: Bearloga):
[mediawiki/extensions/WikimediaEvents@master] Augment event logging when switching layers

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

I am not familiar enough with the event object in the context of Maps and had to make a lot of assumptions based on the surrounding code, so I'm not 100% sure that I'm correct in trying to get the name of the layer via event.layer in https://gerrit.wikimedia.org/r/#/c/366183/2/modules/wikivoyage/WVMapLayers.js. I'm hoping @MaxSem can confirm that I did it correctly or provide some advice for how to do it properly.

Change 366183 merged by jenkins-bot:
[mediawiki/extensions/Kartographer@master] Augment event logging for switching layers

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

Change 366184 merged by jenkins-bot:
[mediawiki/extensions/WikimediaEvents@master] Augment event logging when switching layers

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

It worked! We're now tracking external layer names. Doesn't look like they are widely used, though:

SELECT
  wiki, event_action AS action,
  REPLACE(SUBSTR(REGEXP_SUBSTR(event_extra, '"layer":"(.*)"'), 9, 100), '"', '') AS layer,
  COUNT(DISTINCT(event_userToken)) AS sessions,
  COUNT(*) AS events
FROM Kartographer_16132745
WHERE
  LEFT(timestamp, 8) >= '20170817'
  AND event_action RLIKE 'exlayer$'
  AND event_extra RLIKE '"layer"'
GROUP BY wiki, action, layer;
wikiactionlayersessionsevents
dewikivoyagewv-hide-exlayerGrenzen11
dewikivoyagewv-hide-exlayerSchummerung11
dewikivoyagewv-hide-exlayerVerkehrsliniennetz11
dewikivoyagewv-hide-exlayerWanderwege23
dewikivoyagewv-select-exlayerMapnik44
dewikivoyagewv-select-exlayerReliefkarte22
dewikivoyagewv-show-exlayerGrenzen11
dewikivoyagewv-show-exlayerSchummerung11
dewikivoyagewv-show-exlayerVerkehrsliniennetz34
dewikivoyagewv-show-exlayerWanderwege24
enwikivoyagewv-select-exlayerMapnik59
enwikivoyagewv-select-exlayerRelief map23
enwikivoyagewv-show-exlayerCycling11
enwikivoyagewv-show-exlayerHiking11
frwikivoyagewv-hide-exlayerBoundaries11
frwikivoyagewv-select-exlayerMapnik23
frwikivoyagewv-show-exlayerBoundaries11
itwikivoyagewv-select-exlayerMapnik22

Cool! Was the data noted above for only one day ( 20170817)?

We'll need to look at adding this new data point into the maps dashboard and/or in grafana.

Cool! Was the data noted above for only one day ( 20170817)?

No, from 4 Aug to 21 Aug. On a daily basis it's like 1-2 counts per layer.

We'll need to look at adding this new data point into the maps dashboard and/or in grafana.

Yeah, once things are resolved with the metric calculations I'd like to add this and other metrics to the Maps dashboard.

debt awarded a token.

Gotcha! :)