As a system I would like to gather the following when a user clicks a link to toggle from mobile to desktop:
- Wikimedia project
- Page title
- Page namespace
- User edit count (can be bucketed; can be local or global)
- User groups
- User anonymous or logged-in
This data will be gathered using the approach noted in https://phabricator.wikimedia.org/T310045
Developer Local Setup
- Register the metrics_platform_client producer configuration stream: See yaml file
LocalSettings.php
$wgEventStreams = [ [ 'stream' => 'desktop_mobile_link_clicks', 'schema_title' => '/analytics/mediawiki/client/metrics_event', 'destination_event_service' => 'eventgate-analytics-external', // TODO: Determine whether this stream should be sampled // 'sample' => [ // 'unit' => 'pageview', // 'rate' => ..., // ], 'producers' => [ 'metrics_platform_client' => [ 'events' => [ 'mediawiki.desktop_link.click', ], 'provide_values' => [ 'page_title', 'page_namespace', 'performer_edit_count_bucket', 'performer_groups', 'performer_is_logged_in', ], ], ], ], ];
- Add the stream to the list of streams that the EventLogging extension knows about:
LocalSettings.php
$wgEventLoggingStreamNames[] = 'desktop_mobile_link_clicks';
- Checkout MinervaNueu patch having the new click event
https://gerrit.wikimedia.org/r/c/mediawiki/skins/MinervaNeue/+/812009
- Enter mobile browser mode and click on the Desktop footer link
- Observe the event triggered an event log message under event_logging in Docker console:
The registered event stream is called desktop_mobile_link_clicks
QA Testing Steps
- in one browser tab navigate to https://en.wikipedia.beta.wmflabs.org/.
- Using dev tools switch to a mobile emulator, causing the Mobile web layout to be displayed.
- Click on the Desktop link in the footer. Repeat 4-5 times. Toggling between mobile and vector skins using the "Mobile View" link in the vector skin.
- Navigate to https://stream-beta.wmflabs.org/v2/ui/#/
- Search the event streams for the desktop_mobile_link_clicks stream
- Observe the desktop_mobile_link_clicks stream events in the https://stream-beta.wmflabs.org/v2/ui/#/ UI.