From 803f476528b7b79326947efe27146e5c244032c6 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Wed, 24 Oct 2018 12:18:21 -0500 Subject: [PATCH] Analytics: track more things for Growth Bug: T207802 Change-Id: I77652325ce7b9dda9c4f4a86c1d34421451cf025 --- .../ve-mw/ui/tools/ve.ui.MWEducationPopupTool.js | 2 ++ modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) 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. *