Merge branch 'feature/jam_track_analytics' into develop
This commit is contained in:
commit
005dfdaa91
|
|
@ -7,7 +7,7 @@ module JamRuby
|
|||
|
||||
self.table_name = 'active_music_sessions'
|
||||
|
||||
attr_accessor :legal_terms, :max_score, :opening_jam_track, :opening_recording, :opening_backing_track, :opening_metronome
|
||||
attr_accessor :legal_terms, :max_score, :opening_jam_track, :opening_recording, :opening_backing_track, :opening_metronome, :jam_track_id
|
||||
|
||||
belongs_to :claimed_recording, :class_name => "JamRuby::ClaimedRecording", :foreign_key => "claimed_recording_id", :inverse_of => :playing_sessions
|
||||
belongs_to :claimed_recording_initiator, :class_name => "JamRuby::User", :inverse_of => :playing_claimed_recordings, :foreign_key => "claimed_recording_initiator_id"
|
||||
|
|
|
|||
|
|
@ -161,6 +161,9 @@ module JamRuby
|
|||
query = query.where("original_artist=?", options[:artist])
|
||||
end
|
||||
|
||||
if options[:id].present?
|
||||
query = query.where("jam_tracks.id=?", options[:id])
|
||||
end
|
||||
|
||||
if options[:group_artist]
|
||||
query = query.select("original_artist, array_agg(jam_tracks.id) AS id, MIN(name) AS name, MIN(description) AS description, MIN(recording_type) AS recording_type, MIN(original_artist) AS original_artist, MIN(songwriter) AS songwriter, MIN(publisher) AS publisher, MIN(sales_region) AS sales_region, MIN(price) AS price, MIN(version) AS version, MIN(genre_id) AS genre_id")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ module JamRuby
|
|||
|
||||
@@log = Logging.logger[Recording]
|
||||
|
||||
attr_accessible :owner, :owner_id, :band, :band_id, :recorded_tracks_attributes, :mixes_attributes, :claimed_recordings_attributes, :name, :description, :genre, :is_public, :duration, as: :admin
|
||||
attr_accessible :owner, :owner_id, :band, :band_id, :recorded_tracks_attributes, :mixes_attributes, :claimed_recordings_attributes, :name, :description, :genre, :is_public, :duration, :jam_track_id, as: :admin
|
||||
|
||||
has_many :users, :through => :recorded_tracks, :class_name => "JamRuby::User"
|
||||
has_many :claimed_recordings, :class_name => "JamRuby::ClaimedRecording", :inverse_of => :recording, :foreign_key => 'recording_id', :dependent => :destroy
|
||||
|
|
@ -21,6 +21,7 @@ module JamRuby
|
|||
belongs_to :owner, :class_name => "JamRuby::User", :inverse_of => :owned_recordings, :foreign_key => 'owner_id'
|
||||
belongs_to :band, :class_name => "JamRuby::Band", :inverse_of => :recordings
|
||||
belongs_to :music_session, :class_name => "JamRuby::ActiveMusicSession", :inverse_of => :recordings, foreign_key: :music_session_id
|
||||
belongs_to :non_active_music_session, :class_name => "JamRuby::MusicSession", foreign_key: :music_session_id
|
||||
belongs_to :jam_track, :class_name => "JamRuby::JamTrack", :inverse_of => :recordings, :foreign_key => 'jam_track_id'
|
||||
belongs_to :jam_track_initiator, :class_name => "JamRuby::User", :inverse_of => :initiated_jam_track_recordings, :foreign_key => 'jam_track_initiator_id'
|
||||
|
||||
|
|
@ -196,7 +197,7 @@ module JamRuby
|
|||
|
||||
|
||||
def has_access?(user)
|
||||
users.exists?(user)
|
||||
users.exists?(user) || plays.where("player_id=?", user).count != 0
|
||||
end
|
||||
|
||||
# Start recording a session.
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ context.JK.AccountPaymentHistoryScreen = class AccountPaymentHistoryScreen
|
|||
|
||||
# Turn in to HTML rows and append:
|
||||
#@tbody.html("")
|
||||
console.log("response.next", response)
|
||||
@next = response.next_page
|
||||
@renderPayments(response)
|
||||
if response.next_page == null
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@
|
|||
function getBackingTracks(page) {
|
||||
|
||||
var result = context.jamClient.getBackingTrackList();
|
||||
console.log("result", result)
|
||||
var backingTracks = result.backing_tracks;
|
||||
|
||||
if (!backingTracks || backingTracks.length == 0) {
|
||||
|
|
@ -89,8 +88,7 @@
|
|||
rest.openBackingTrack({id: context.JK.CurrentSessionModel.id(), backing_track_path: backingTrack.name})
|
||||
.done(function(response) {
|
||||
var result = context.jamClient.SessionOpenBackingTrackFile(backingTrack.name, false);
|
||||
console.log("BackingTrackPlay response: %o", result);
|
||||
|
||||
|
||||
// TODO: Possibly actually check the result. Investigate
|
||||
// what real client returns:
|
||||
// // if(result) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
"use strict";
|
||||
|
||||
context.JK = context.JK || {};
|
||||
var rest = context.JK.Rest();
|
||||
var logger = context.JK.logger;
|
||||
|
||||
// types
|
||||
|
|
@ -130,6 +131,20 @@
|
|||
jkComment : 'jkComment'
|
||||
};
|
||||
|
||||
// JamTrack categories and actions:
|
||||
var jamTrackAvailabilityTypes = {
|
||||
worldwide: 'JamTrackGlobal',
|
||||
usa: 'JamTrackUSA'
|
||||
}
|
||||
var jamTrackActions = {
|
||||
isPublic: 'PublicPerformance',
|
||||
isPrivate: 'PrivateUse'
|
||||
}
|
||||
var jamTrackSessionLabels = {
|
||||
nonSession: 'NonSession',
|
||||
inSession: 'InSession'
|
||||
}
|
||||
|
||||
function translatePlatformForGA(platform) {
|
||||
assertOneOf(platform, context.JK.OS);
|
||||
|
||||
|
|
@ -239,6 +254,36 @@
|
|||
context.ga('send', 'event', categories.findSession, sessionCountRollup, numSessionsFound);
|
||||
}
|
||||
|
||||
function trackJamTrackPlaySession(sessionId, inSession) {
|
||||
rest.getSession(sessionId).done(function(session) {
|
||||
if (session && session.jam_track ) {
|
||||
rest.getJamTracks({id:session.jam_track.id}).done(function(response) {
|
||||
if (response.jamtracks && response.jamtracks.length!=0) {
|
||||
var jamtrack = response.jamtracks[0]
|
||||
trackJamTrackPlay(
|
||||
jamtrack.sales_region!=context.JK.AVAILABILITY_US,
|
||||
session.participants.length > 1,
|
||||
inSession);
|
||||
}// if
|
||||
})// rest.getJamTracks
|
||||
}// if
|
||||
})// rest.getSession
|
||||
}
|
||||
|
||||
function trackJamTrackPlay(isGlobal, isPublic, inSession) {
|
||||
assertBoolean(isGlobal)
|
||||
assertBoolean(isPublic)
|
||||
assertBoolean(inSession)
|
||||
context.ga(
|
||||
'send',
|
||||
'event',
|
||||
(isGlobal) ? jamTrackAvailabilityTypes.worldwide : jamTrackAvailabilityTypes.usa,
|
||||
(isPublic) ? jamTrackActions.isPublic : jamTrackActions.isPrivate,
|
||||
(inSession) ? jamTrackSessionLabels.inSession : jamTrackSessionLabels.nonSession
|
||||
)
|
||||
logger.debug("Tracked Jam Track Play")
|
||||
}
|
||||
|
||||
// if you want to pass in no title, either omit it from the arg list when u invoke virtualPageView, or pass in undefined, NOT null
|
||||
function virtualPageView(page, title) {
|
||||
|
||||
|
|
@ -271,7 +316,8 @@
|
|||
}
|
||||
|
||||
// when someone plays a recording
|
||||
function trackRecordingPlay(recordingAction) {
|
||||
function trackRecordingPlay(recording, recordingAction) {
|
||||
|
||||
if (!recordingAction) {
|
||||
recordingAction = _defaultPlayAction();
|
||||
}
|
||||
|
|
@ -279,10 +325,20 @@
|
|||
var label = JK.currentUserId ? userLabels.registeredUser : userLabels.visitor;
|
||||
|
||||
context.ga('send', 'event', categories.recordingPlay, recordingAction, label);
|
||||
|
||||
if (recording.jam_track) {
|
||||
rest.getJamTracks({id:recording.jam_track_id}).done(function(response) {
|
||||
if (response.jamtracks && response.jamtracks.length==1) {
|
||||
var jamtrack = response.jamtracks[0]
|
||||
trackJamTrackPlay(jamtrack.sales_region!=context.JK.AVAILABILITY_US, recording.fan_access, false);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// when someone plays a live session broadcast
|
||||
function trackSessionPlay(recordingAction) {
|
||||
function trackSessionPlay(session, recordingAction) {
|
||||
logger.debug("Tracking session play: ", session)
|
||||
if (!recordingAction) {
|
||||
recordingAction = _defaultPlayAction();
|
||||
}
|
||||
|
|
@ -379,7 +435,8 @@
|
|||
GA.trackSessionQuality = trackSessionQuality;
|
||||
GA.trackServiceInvitations = trackServiceInvitations;
|
||||
GA.trackFindSessions = trackFindSessions;
|
||||
GA.virtualPageView = virtualPageView;
|
||||
GA.trackJamTrackPlay = trackJamTrackPlay;
|
||||
GA.trackJamTrackPlaySession = trackJamTrackPlaySession;
|
||||
GA.trackFriendConnect = trackFriendConnect;
|
||||
GA.trackMakeRecording = trackMakeRecording;
|
||||
GA.trackShareRecording = trackShareRecording;
|
||||
|
|
@ -387,8 +444,8 @@
|
|||
GA.trackSessionPlay = trackSessionPlay;
|
||||
GA.trackBand = trackBand;
|
||||
GA.trackJKSocial = trackJKSocial;
|
||||
|
||||
|
||||
GA.virtualPageView = virtualPageView;
|
||||
|
||||
context.JK.GA = GA;
|
||||
|
||||
})(window,jQuery);
|
||||
|
|
@ -287,11 +287,6 @@
|
|||
}
|
||||
|
||||
function addPlayablePlay(playableId, playableType, claimedRecordingId, userId) {
|
||||
if (playableType == 'JamRuby::Recording') {
|
||||
context.JK.GA.trackRecordingPlay();
|
||||
} else if (playableType == 'JamRuby::MusicSession') {
|
||||
context.JK.GA.trackSessionPlay();
|
||||
}
|
||||
return $.ajax({
|
||||
url: '/api/users/' + playableId + "/plays",
|
||||
type: "POST",
|
||||
|
|
@ -1452,7 +1447,8 @@
|
|||
});
|
||||
}
|
||||
|
||||
function getJamtracks(options) {
|
||||
function getJamTracks(options) {
|
||||
logger.debug("GETTING JAMTRACKS")
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
url: '/api/jamtracks?' + $.param(options),
|
||||
|
|
@ -1781,7 +1777,7 @@
|
|||
this.updateAudioLatency = updateAudioLatency;
|
||||
this.getJamTrack = getJamTrack;
|
||||
this.getJamTrackWithArtistInfo = getJamTrackWithArtistInfo;
|
||||
this.getJamtracks = getJamtracks;
|
||||
this.getJamTracks = getJamTracks;
|
||||
this.getPurchasedJamTracks = getPurchasedJamTracks;
|
||||
this.getPaymentHistory = getPaymentHistory;
|
||||
this.getSalesHistory = getSalesHistory;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ context.JK.JamTrackScreen=class JamTrackScreen
|
|||
refresh:() =>
|
||||
@currentQuery = this.buildQuery()
|
||||
that = this
|
||||
rest.getJamtracks(@currentQuery).done((response) =>
|
||||
rest.getJamTracks(@currentQuery).done((response) =>
|
||||
that.clearResults()
|
||||
that.handleJamtrackResponse(response)
|
||||
).fail (jqXHR) =>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ context.JK.JamTrackLanding = class JamTrackLanding
|
|||
|
||||
beforeShow:() =>
|
||||
# Get artist names and build links
|
||||
@rest.getJamtracks({group_artist: true})
|
||||
@rest.getJamTracks({group_artist: true})
|
||||
.done(this.buildArtistLinks)
|
||||
.fail(this.handleFailure)
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@
|
|||
audioDomElement.play();
|
||||
isPlaying = true;
|
||||
rest.addPlayablePlay(recordingId, 'JamRuby::Recording', claimedRecordingId, context.JK.currentUserId);
|
||||
rest.getRecording({id: recordingId})
|
||||
.done(function(recording) {
|
||||
context.JK.GA.trackRecordingPlay(recording);
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,8 @@
|
|||
waitForBufferingTimeout = setTimeout(noBuffer, WAIT_FOR_BUFFER_TIMEOUT);
|
||||
logger.debug("setting buffering timeout");
|
||||
rest.addPlayablePlay(musicSessionId, 'JamRuby::MusicSession', null, context.JK.currentUserId);
|
||||
|
||||
context.JK.GA.trackJamTrackPlaySession(musicSessionId, false)
|
||||
|
||||
if(needsCanPlayGuard()) {
|
||||
$audio.bind('canplay', function() {
|
||||
audioDomElement.play();
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@
|
|||
update(0, playbackDurationMs, playbackPlaying);
|
||||
}
|
||||
$self.triggerHandler('play', {playbackMode: playbackMode, playbackMonitorMode: playbackMonitorMode});
|
||||
|
||||
|
||||
if(playbackMonitorMode == PLAYBACK_MONITOR_MODE.JAMTRACK) {
|
||||
var sessionModel = context.JK.CurrentSessionModel || null;
|
||||
context.JK.GA.trackJamTrackPlaySession(sessionModel.id(), true)
|
||||
}
|
||||
}
|
||||
|
||||
function stopPlay(endReached) {
|
||||
|
|
@ -182,8 +188,7 @@
|
|||
var positionMs = context.jamClient.SessionCurrrentJamTrackPlayPosMs();
|
||||
var duration = context.jamClient.SessionGetJamTracksPlayDurationMs();
|
||||
var durationMs = duration.media_len;
|
||||
var start = duration.start; // needed to understand start offset, and prevent slider from moving in tapins
|
||||
//console.log("JamTrack start: " + start)
|
||||
var start = duration.start; // needed to understand start offset, and prevent slider from moving in tapins
|
||||
}
|
||||
else {
|
||||
var positionMs = context.jamClient.SessionCurrrentPlayPosMs();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
var modUtils = context.JK.ModUtils;
|
||||
var logger = context.JK.logger;
|
||||
var self = this;
|
||||
|
||||
|
||||
var defaultParticipant = {
|
||||
tracks: [{
|
||||
instrument_id: "unknown"
|
||||
|
|
@ -2696,7 +2696,7 @@
|
|||
text: "Unable to open your JamTrack. Please contact support@jamkazam.com"
|
||||
}, null, true);
|
||||
} else {
|
||||
rest.playJamTrack(jamTrack.id);
|
||||
playJamTrack(jamTrack.id);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -2715,6 +2715,17 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function playJamTrack(jamTrackId) {
|
||||
var participantCnt=sessionModel.participants().length
|
||||
rest.playJamTrack(jamTrackId)
|
||||
context.stats.write('web.jamtrack.open', {
|
||||
value: 1,
|
||||
session_size: participantCnt,
|
||||
user_id: context.JK.currentUserId,
|
||||
user_name: context.JK.currentUserName
|
||||
})
|
||||
}// function
|
||||
|
||||
function openBackingTrackFile(e) {
|
||||
|
||||
// just ignore the click if they are currently recording for now
|
||||
|
|
@ -2727,6 +2738,12 @@
|
|||
return false;
|
||||
} else {
|
||||
context.jamClient.openBackingTrackFile(sessionModel.backing_track)
|
||||
context.stats.write('web.backingtrack.open', {
|
||||
value: 1,
|
||||
session_size: participantCnt,
|
||||
user_id: context.JK.currentUserId,
|
||||
user_name: context.JK.currentUserName
|
||||
})
|
||||
//context.JK.CurrentSessionModel.refreshCurrentSession(true);
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ if !current_user
|
|||
}
|
||||
else
|
||||
|
||||
attributes :id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :band_id, :user_id, :claimed_recording_initiator_id, :track_changes_counter, :max_score, :backing_track_path, :metronome_active, :jam_track_initiator_id
|
||||
attributes :id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :band_id, :user_id, :claimed_recording_initiator_id, :track_changes_counter, :max_score, :backing_track_path, :metronome_active, :jam_track_initiator_id, :jam_track_id
|
||||
|
||||
node :can_join do |session|
|
||||
session.can_join?(current_user, true)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
object @recording
|
||||
|
||||
attributes :id, :band, :created_at, :duration, :comment_count, :like_count, :play_count, :when_will_be_discarded?, :jam_track_id, :jam_track_initiator_id
|
||||
attributes :id, :band, :created_at, :duration, :comment_count, :like_count, :play_count, :when_will_be_discarded?, :jam_track_id, :jam_track_initiator_id, :music_session_id, :music_session
|
||||
|
||||
node :fan_access do |recording|
|
||||
recording.non_active_music_session.fan_access
|
||||
end
|
||||
|
||||
node :mix do |recording|
|
||||
if recording.mix
|
||||
|
|
|
|||
Loading…
Reference in New Issue