Background
Based on several bug reports, we would like to know more about which click impressions result in a beforeprint event. The hope is this might shed more light on the issue about which browser versions of Chrome are having issues with printing the PDF button (i.e. on which browsers does a user select the button but nothing happens, see T181261: Provide system feedback while the Android opens up the print dialog using download article action).
Currently we log an event action clickPrintableVersion when the "Printable version" link is clicked in desktop. We want to add the mobile equivalent.
Acceptance criteria
Add the following events to the print instrumentation schema for Minerva only:
- When the "download" button is clicked in the Minerva skin a "clickPrintableVersion" event will be sent. No change to schema is needed for this event.
- When the "download" button is visible in the Minerva skin a "shownPrintButton" event will be sent to signal a page impression. A schema change for this new event is needed.
- File a task for the Analytics Engineering team to blacklist this schema from MariaDB/MySQL (like we did for Popups), due to the high event rate expected to be caused by the button impressions event
- Create a task for turning schema off after n weeks of collected data
--> T196159
Notes
Note, per analysis by @pmiazga we cannot reliably detect:
- Print dialog opened
- how long does it take for dialog to appear after button is pressed
Developer notes
It's probably easiest to implement this by augmenting the existing (and already partially vetted) Print schema, e.g. by extending the definition of the clickPrintableVersion action to Minerva, standing for clicks on the PDF button there.
Triggering the shownPrintButton event will be tricky as the schema is managed by WikimediaEvents but added by the Minerva skin. I propose the Minerva skin triggers an event e.g. mw.track and WikimediaEvents makes use of trackSubscribe to forward the event in EventLogging.
Testing criteria
- Bucket yourself by running the following code in your developer console on the BETA CLUSTER:
/*! * Track browser print events * * Each action is only logged once per page view. That is, no matter how many * times the user clicks on 'Printable Version', only one * 'clickPrintableVersion' action is logged for that page until the page is * refreshed. Ditto the `onBeforePrint` action. * * @see https://phabricator.wikimedia.org/T169730 * @see https://meta.wikimedia.org/wiki/Schema:Print */ ( function ( $, track, trackSubscribe, config, user, mwExperiments ) { /** * Whether the user session is sampled * * @param {number} samplingRate - a float between 0 and 1 for which events * in the schema should be logged. * @return {boolean} */ function isInSample( samplingRate ) { var bucket = mwExperiments.getBucket( { name: 'WMEPrint', enabled: true, buckets: { control: 1 - samplingRate, A: samplingRate } }, user.sessionId() ); return bucket === 'A'; } while ( !isInSample( 0.1 ) ) { mw.storage.session.remove('mwuser-sessionId' ) } }( jQuery, mediaWiki.track, mediaWiki.trackSubscribe, mediaWiki.config, mediaWiki.user, mediaWiki.experiments ) );
- Verify that when clicking the download icon an event is fired.