diff --git a/modules/ve-mw/ui/tools/ve.ui.MWEducationPopupTool.js b/modules/ve-mw/ui/tools/ve.ui.MWEducationPopupTool.js index c97176dc33..2306000c97 100644 --- a/modules/ve-mw/ui/tools/ve.ui.MWEducationPopupTool.js +++ b/modules/ve-mw/ui/tools/ve.ui.MWEducationPopupTool.js @@ -82,6 +82,8 @@ ve.ui.MWEducationPopupTool = function VeUiMwEducationPopupTool( config ) { tool.$stillDot.hide(); tool.popup.toggle( true ); $shield.remove(); + + ve.track( 'activity.' + tool.constructor.static.name + 'EducationPopup', { action: 'show' } ); } } ); }; diff --git a/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js b/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js index b9048ab6ec..3e002ce309 100644 --- a/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js +++ b/modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js @@ -25,12 +25,28 @@ ve.ui.MWPopupTool = function VeUiMWPopupTool( title, toolGroup, config ) { ve.ui.MWPopupTool.super.call( this, toolGroup, config ); this.$element.addClass( 've-ui-mwPopupTool' ); + + this.$link.on( 'click', this.onToolLinkClick.bind( this ) ); }; /* Inheritance */ OO.inheritClass( ve.ui.MWPopupTool, OO.ui.PopupTool ); +/** + * Handle clicks on the main tool button. + * + * @param {jQuery.Event} e Click event + */ +ve.ui.MWPopupTool.prototype.onToolLinkClick = function () { + if ( this.popup.isVisible() ) { + // Popup will be visible if this just opened, thanks to sequencing. + // Can't just track this with toggle, because the notices popup is auto-opened and we + // want to know about deliberate interactions. + ve.track( 'activity.' + this.constructor.static.name + 'Popup', { action: 'show' } ); + } +}; + /** * MediaWiki UserInterface notices popup tool. *