Merge "DesktopArticleTarget.init: Pass platform to ve.track directly"

This commit is contained in:
jenkins-bot 2018-09-12 14:20:43 +00:00 committed by Gerrit Code Review
commit df253967e1
2 changed files with 14 additions and 1 deletions

View file

@ -282,6 +282,10 @@
function trackActivateStart( initData ) {
ve.track( 'trace.activate.enter', { mode: initData.mode } );
// ve.track normally tries to guess the current platform based on
// ve.init.target. We're in a pre-target-loaded state, so have it
// hardcode desktop here.
initData.platform = 'desktop';
ve.track( 'mwedit.init', initData );
mw.libs.ve.activationStart = ve.now();
}

View file

@ -95,11 +95,20 @@
delete data.mode;
}
if ( !data.platform ) {
if ( ve.init && ve.init.target && ve.init.target.constructor.static.platformType ) {
data.platform = ve.init.target.constructor.static.platformType;
} else {
data.platform = 'other';
// TODO: outright abort in this case, once we think we've caught everything
mw.log.warn( 've.init.mw.trackSubscriber: no target available and no platform specified', action );
}
}
event = $.extend( {
version: 1,
action: action,
editor: 'visualeditor',
platform: ve.init && ve.init.target && ve.init.target.constructor.static.platformType || 'other',
integration: ve.init && ve.init.target && ve.init.target.constructor.static.integrationType || 'page',
'page.id': mw.config.get( 'wgArticleId' ),
'page.title': mw.config.get( 'wgPageName' ),