/courses analytics

This commit is contained in:
Matt Lott 2015-12-04 12:08:08 -08:00
parent 6d6f6138b1
commit 44cd64e00e
3 changed files with 31 additions and 16 deletions

View file

@ -22,7 +22,10 @@ module.exports = class CourseInstance extends CocoModel
}
_.extend options, opts
@fetch(options)
me.get('courseInstances').push(@id) if userID is me.id
if userID is me.id
unless me.get('courseInstances')
me.set('courseInstances', [])
me.get('courseInstances').push(@id)
removeMember: (userID, opts) ->
options = {

View file

@ -22,5 +22,6 @@ module.exports = class ChangeCourseLanguageModal extends ModalView
@onLanguageSettingSaved()
onLanguageSettingSaved: ->
application.tracker?.trackEvent 'Student changed language', category: 'Courses', label: @chosenLanguage
@trigger('set-language')
@hide()

View file

@ -68,17 +68,25 @@ module.exports = class CoursesView extends RootView
else
modal = new ChooseLanguageModal()
@openModalView(modal)
@listenToOnce modal, 'set-language', @startHourOfCodePlay
@listenToOnce modal, 'set-language', =>
@startHourOfCodePlay()
application.tracker?.trackEvent 'Automatic start hour of code play', category: 'Courses', label: 'set language'
application.tracker?.trackEvent 'Start New Game', category: 'Courses'
onClickLogInButton: ->
modal = new StudentLogInModal()
@openModalView(modal)
modal.on 'want-to-create-account', @openSignUpModal, @
application.tracker?.trackEvent 'Started Student Login', category: 'Courses'
openSignUpModal: ->
modal = new StudentSignUpModal({ willPlay: true })
@openModalView(modal)
modal.once 'click-skip-link', @startHourOfCodePlay, @
modal.once 'click-skip-link', (=>
@startHourOfCodePlay()
application.tracker?.trackEvent 'Automatic start hour of code play', category: 'Courses', label: 'skip link'
), @
application.tracker?.trackEvent 'Started Student Signup', category: 'Courses'
startHourOfCodePlay: ->
@$('#main-content').hide()
@ -114,7 +122,7 @@ module.exports = class CoursesView extends RootView
onJoinClassroomError: (classroom, jqxhr, options) ->
@state = null
application.tracker?.trackEvent 'Failed to join classroom with code', status: jqxhr.status
application.tracker?.trackEvent 'Failed to join classroom with code', category: 'Courses', status: jqxhr.status
if jqxhr.status is 422
@errorMessage = 'Please enter a code.'
else if jqxhr.status is 404
@ -125,7 +133,9 @@ module.exports = class CoursesView extends RootView
onJoinClassroomSuccess: (newClassroom, jqxhr, options) ->
application.tracker?.trackEvent 'Joined classroom', {
classroomID: newClassroom.id,
category: 'Courses'
classCode: @classCode
classroomID: newClassroom.id
classroomName: newClassroom.get('name')
ownerID: newClassroom.get('ownerID')
}
@ -153,6 +163,7 @@ module.exports = class CoursesView extends RootView
setTimeout(f, 10)
onClickChangeLanguageLink: ->
application.tracker?.trackEvent 'Student clicked change language', category: 'Courses'
modal = new ChangeCourseLanguageModal()
@openModalView(modal)
modal.once 'hidden', @render, @