jenkins-bot has submitted this change and it was merged.

Change subject: Log notification impressions and clicks
......................................................................


Log notification impressions and clicks

This logging was taken out by accident during the split notifications
rewrite.

Bug: T114833
Change-Id: I7672c20bb12e06f3efc63763aacbe81fd0f34ece
(cherry picked from commit f9e8c5057cc6e13d8ab530919e840109e1a8fb74)
---
M modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
M modules/ooui/mw.echo.ui.NotificationOptionWidget.js
2 files changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



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/244079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7672c20bb12e06f3efc63763aacbe81fd0f34ece
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: wmf/1.27.0-wmf.2
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to