diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.html b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.html index 05dfbcf0dd..3f5f64fdde 100644 --- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.html +++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.html @@ -15,6 +15,7 @@ limitations under the License. --> + @@ -96,6 +97,7 @@ limitations under the License. on-scroll-to="_handleScrollTo" data-message-id$="[[message.id]]"> + diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js index 774d1d23f6..543441a737 100644 --- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js +++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js @@ -17,6 +17,11 @@ var MAX_INITIAL_SHOWN_MESSAGES = 20; var MESSAGES_INCREMENT = 5; + var ReportingEvent = { + SHOW_ALL: 'show-all-messages', + SHOW_MORE: 'show-more-messages', + }; + Polymer({ is: 'gr-messages-list', @@ -272,6 +277,7 @@ _handleShowAllTap: function() { this._visibleMessages = this._processedMessages; + this.$.reporting.reportInteraction(ReportingEvent.SHOW_ALL); }, _handleIncrementShownMessages: function() { @@ -281,6 +287,7 @@ var newMessages = this._processedMessages.slice(-(len + delta), -len); // Add newMessages to the beginning of _visibleMessages this.splice.apply(this, ['_visibleMessages', 0, 0].concat(newMessages)); + this.$.reporting.reportInteraction(ReportingEvent.SHOW_MORE); }, _processedMessagesChanged: function(messages) { diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js index 7d9fda49b4..d4cd1e17bc 100644 --- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js +++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js @@ -35,6 +35,8 @@ CATEGORY: 'exception', }; + var INTERACTION_TYPE = 'interaction'; + var CHANGE_VIEW_REGEX = /^\/c\/\d+\/?\d*$/; var DIFF_VIEW_REGEX = /^\/c\/\d+\/\d+\/.+$/; @@ -69,6 +71,8 @@ is: 'gr-reporting', properties: { + category: String, + _baselines: { type: Array, value: function() { return {}; }, @@ -100,7 +104,8 @@ if (type === ERROR.TYPE) { console.error(eventValue.error || eventName); } else { - console.log(eventName + ': ' + eventValue); + console.log(eventName + (eventValue !== undefined ? + (': ' + eventValue) : '')); } }, @@ -186,6 +191,10 @@ this.reporter(TIMING.TYPE, TIMING.CATEGORY, name, time); delete this._baselines[name]; }, + + reportInteraction: function(eventName) { + this.reporter(INTERACTION_TYPE, this.category, eventName); + }, }); window.GrReporting = GrReporting;