mediawiki-skins-MinervaNeue/resources/skins.minerva.options/trackShare.js
Piotr Miazga 6c2450a5f2 Track share button usage
Use MobileWebShareButton schema to track interactions with

Additional changes: Fix how button is injected into page actions
bar as last AMC changes broke it.

Bug: T207280
Change-Id: Ie7d7ab6bc66df5ab30aaec77e2ee8583c69b8f48
2019-03-18 09:03:42 -07:00

19 lines
560 B
JavaScript

( function ( M, track, user, config ) {
/**
* Helper function to track share button usage
*
* @param {string} action - one of "shownShareButton", "clickShareButton", "SharedToApp"
*/
function trackShare( action ) {
track( 'event.MobileWebShareButton', {
pageTitle: config.get( 'wgTitle' ),
namespaceId: config.get( 'wgNamespaceNumber' ),
isAnon: user.isAnon(),
action: action,
pageToken: user.getPageviewToken()
} );
}
M.define( 'skins.minerva.share/track', trackShare );
}( mw.mobileFrontend, mw.track, mw.user, mw.config ) );