mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Log notification impressions and clicks
This logging was taken out by accident during the split notifications rewrite. Bug: T114833 Change-Id: I7672c20bb12e06f3efc63763aacbe81fd0f34ece
This commit is contained in:
parent
f8c68648f8
commit
f9e8c5057c
|
@ -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;
|
||||
|
|
|
@ -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() );
|
||||
|
|
Loading…
Reference in a new issue