[go: nahoru, domu]

Skip to content

Commit

Permalink
SUS-3855 | Chat - track room joins and messages sent
Browse files Browse the repository at this point in the history
  • Loading branch information
macbre committed Feb 9, 2018
1 parent 4038a02 commit 1391250
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions extensions/wikia/Chat2/js/controllers/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var NodeChatSocketWrapper = $.createClass(Observable, {
NodeChatSocketWrapper.superclass.constructor.apply(this, arguments);
this.roomId = roomId;
this.wikiId = window.wgCityId;
this.track = window.Wikia.Tracker.track;
},

log: function(msg, group) {
Expand All @@ -27,6 +28,13 @@ var NodeChatSocketWrapper = $.createClass(Observable, {
if (this.socket) {
this.socket.emit('message', $msg);
}

this.track({
action: 'click',
category: 'chat',
label: 'message',
trackingMethod: 'analytics'
});
},

connect: function () {
Expand Down Expand Up @@ -117,6 +125,16 @@ var NodeChatSocketWrapper = $.createClass(Observable, {
case 'initial':
this.firstConnected = true; //we are 100% sure about conenction
break;
// SUS-3855 | Chat's events tracking
case 'join':
// this tracks both public and private channels
this.track({
action: 'impression',
category: 'chat',
label: 'join',
trackingMethod: 'analytics'
});
break;
}
if (this.firstConnected) {
this.fire(message.event, message);
Expand Down Expand Up @@ -611,6 +629,8 @@ var NodeChatController = $.createClass(NodeRoomController, {
.focus($.proxy(this.resetActivityTimer, this));

this.chats.main = this;

this.track = window.Wikia.Tracker.track;
return this;
},

Expand Down Expand Up @@ -742,6 +762,13 @@ var NodeChatController = $.createClass(NodeRoomController, {
this.showRoom(data.get('roomId'));
this.chats.privates[data.get('roomId')].init();
//this.socket.send(data.xport());

this.track({
action: 'impression',
category: 'chat',
label: 'join-private-chat',
trackingMethod: 'analytics'
});
}, this)
});
this.viewUsers.hideMenu();
Expand Down

0 comments on commit 1391250

Please sign in to comment.