Mooeypoo has uploaded a new change for review.
https://gerrit.wikimedia.org/r/244057
Change subject: Log notification impressions and clicks
......................................................................
Log notification impressions and clicks
This logging was taken out by accident during the split notifications
rewrite.
Change-Id: I7672c20bb12e06f3efc63763aacbe81fd0f34ece
---
M modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
M modules/ooui/mw.echo.ui.NotificationOptionWidget.js
2 files changed, 23 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/57/244057/1
diff --git a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
index 4bad331..3505859 100644
--- a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
+++ b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
@@ -321,6 +321,9 @@
// the case where the promise is already underway.
this.populateNotifications()
.then( function () {
+ var i,
+ items =
widget.notificationsWidget.getItems();
+
if ( widget.popup.isVisible() ) {
// Update seen time
widget.notificationsModel.updateSeenTime();
@@ -328,6 +331,16 @@
if ( widget.markReadWhenSeen ) {
widget.notificationsModel.markAllRead();
}
+
+ // Log impressions
+ for ( i = 0; i < items.length; i++ ) {
+ mw.echo.logger.logInteraction(
+
mw.echo.Logger.static.actions.notificationImpression,
+ 'flyout',
+
widget.getModel().getId(),
+ items[ i
].getModel().getCategory()
+ );
+ }
}
} );
this.hasRunFirstTime = true;
diff --git a/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
b/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
index bd63bee..ac5c743 100644
--- a/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
+++ b/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
@@ -10,6 +10,7 @@
* @cfg {boolean} [markReadWhenSeen=false] This option is marked as
read when it is viewed
*/
mw.echo.ui.NotificationOptionWidget = function
MwEchoUiNotificationOptionWidget( model, config ) {
+ var widget = this;
config = config || {};
this.model = model;
@@ -53,6 +54,15 @@
this.markAsReadButton.$element,
this.$label
)
+ .on( 'click', function () {
+ // Log notification click
+ mw.echo.logger.logInteraction(
+
mw.echo.Logger.static.actions.notificationClick,
+ 'flyout',
+
widget.getModel().getId(),
+
widget.getModel().getCategory()
+ );
+ } )
);
this.$element.toggleClass(
'mw-echo-ui-notificationOptionWidget-initiallyUnseen', !this.model.isSeen() );
--
To view, visit https://gerrit.wikimedia.org/r/244057
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7672c20bb12e06f3efc63763aacbe81fd0f34ece
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits