VRFS-709 added calls to GA record/session tracking
This commit is contained in:
parent
e271feeb70
commit
5abc877a38
|
|
@ -228,8 +228,15 @@
|
|||
context.ga('send', 'event', categories.recording, recordingActions.share, shareType);
|
||||
}
|
||||
|
||||
function _defaultPlayAction() {
|
||||
return !window.jamClient || ((typeof(FakeJamClient)!='undefined') && window.jamClient === FakeJamClient) ? 'Website' : 'Client';
|
||||
}
|
||||
|
||||
// when someone plays a recording
|
||||
function trackRecordingPlay(recordingAction) {
|
||||
if (!recordingAction) {
|
||||
recordingAction = _defaultPlayAction();
|
||||
}
|
||||
assertOneOf(recordingAction, recordingPlayActions);
|
||||
var label = JK.currentUserId ? userLabels.registeredUser : userLabels.visitor;
|
||||
|
||||
|
|
@ -238,6 +245,9 @@
|
|||
|
||||
// when someone plays a live session broadcast
|
||||
function trackSessionPlay(recordingAction) {
|
||||
if (!recordingAction) {
|
||||
recordingAction = _defaultPlayAction();
|
||||
}
|
||||
assertOneOf(recordingAction, sessionPlayActions);
|
||||
var label = JK.currentUserId ? userLabels.registeredUser : userLabels.visitor;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,11 @@
|
|||
}
|
||||
|
||||
function addPlayablePlay(playableId, playableType, claimedRecordingId, userId) {
|
||||
if (playableType == 'JamRuby::Recording') {
|
||||
context.JK.GA.trackRecordingPlay();
|
||||
} else if (playableType == 'JamRuby::MusicSessionHistory') {
|
||||
context.JK.GA.trackSessionPlay();
|
||||
}
|
||||
return $.ajax({
|
||||
url: '/api/users/' + playableId + "/plays",
|
||||
type: "POST",
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@
|
|||
}
|
||||
|
||||
function play() {
|
||||
rest.addPlayablePlay(recordingId, claimedRecordingId, JK.currentUserId)
|
||||
.done(function(response) {
|
||||
$("#spnPlayCount", $scope).html(parseInt($("#spnPlayCount").text()) + 1);
|
||||
});
|
||||
// rest.addPlayablePlay(recordingId, claimedRecordingId, JK.currentUserId)
|
||||
// .done(function(response) {
|
||||
// $("#spnPlayCount", $scope).html(parseInt($("#spnPlayCount").text()) + 1);
|
||||
// });
|
||||
}
|
||||
|
||||
function addComment() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue