diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index c646c69028..854cc539b8 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -424,6 +424,7 @@ ve.init.mw.ViewPageTarget.prototype.onLoadError = function ( jqXHR, status ) { * @method */ ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () { + var surfaceReadyTime = ve.now(); if ( !this.activating ) { // Activation was aborted before we got here. Do nothing // TODO are there things we need to clean up? @@ -439,6 +440,11 @@ ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () { this.getSurface().mwTocWidget = new ve.ui.MWTocWidget( this.getSurface() ); } + // Track how long it takes for the first transaction to happen + this.surface.getModel().getDocument().once( 'transact', function () { + ve.track( 'mwtiming.behavior.firstTransaction', { duration: ve.now() - surfaceReadyTime } ); + } ); + // Update UI this.transformPageTitle(); this.changeDocumentTitle();