Trim mixpanel event logging

This commit is contained in:
Matt Lott 2016-09-21 06:17:35 -07:00
parent a16deb9059
commit f1b1cdbdcc
5 changed files with 8 additions and 9 deletions

View file

@ -63,7 +63,6 @@ module.exports = class CoursesView extends RootView
@supermodel.loadModel(@hero, 'hero') @supermodel.loadModel(@hero, 'hero')
@listenTo @hero, 'all', -> @listenTo @hero, 'all', ->
@render() @render()
window.tracker?.trackEvent 'Students Loaded', category: 'Students', ['Mixpanel']
afterInsert: -> afterInsert: ->
super() super()

View file

@ -5,4 +5,4 @@ module.exports = class RestrictedToStudentsView extends RootView
template: require 'templates/courses/restricted-to-students-view' template: require 'templates/courses/restricted-to-students-view'
initialize: -> initialize: ->
window.tracker?.trackEvent 'Restricted To Students Loaded', category: 'Students', ['Mixpanel'] window.tracker?.trackEvent 'Restricted To Students Loaded', category: 'Students', []

View file

@ -58,14 +58,14 @@ module.exports = class HintsView extends CocoView
@state.set({ hintsTitle, hint: @hintsState.getHint(index) }) @state.set({ hintsTitle, hint: @hintsState.getHint(index) })
onClickNextButton: -> onClickNextButton: ->
window.tracker?.trackEvent 'Hints Next Clicked', category: 'Students', levelSlug: @level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, hintCurrent: @state.get('hintIndex'), ['Mixpanel'] window.tracker?.trackEvent 'Hints Next Clicked', category: 'Students', levelSlug: @level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, hintCurrent: @state.get('hintIndex'), []
max = @hintsState.get('total') - 1 max = @hintsState.get('total') - 1
@state.set('hintIndex', Math.min(@state.get('hintIndex') + 1, max)) @state.set('hintIndex', Math.min(@state.get('hintIndex') + 1, max))
@playSound 'menu-button-click' @playSound 'menu-button-click'
@updateHintTimer() @updateHintTimer()
onClickPreviousButton: -> onClickPreviousButton: ->
window.tracker?.trackEvent 'Hints Previous Clicked', category: 'Students', levelSlug: @level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, hintCurrent: @state.get('hintIndex'), ['Mixpanel'] window.tracker?.trackEvent 'Hints Previous Clicked', category: 'Students', levelSlug: @level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, hintCurrent: @state.get('hintIndex'), []
@state.set('hintIndex', Math.max(@state.get('hintIndex') - 1, 0)) @state.set('hintIndex', Math.max(@state.get('hintIndex') - 1, 0))
@playSound 'menu-button-click' @playSound 'menu-button-click'
@updateHintTimer() @updateHintTimer()
@ -89,7 +89,7 @@ module.exports = class HintsView extends CocoView
hintsViewTime[hintIndex]++ hintsViewTime[hintIndex]++
hintsUsed = @state.get('hintsUsed') hintsUsed = @state.get('hintsUsed')
if hintsViewTime[hintIndex] > @hintUsedThresholdSeconds and not hintsUsed[hintIndex] if hintsViewTime[hintIndex] > @hintUsedThresholdSeconds and not hintsUsed[hintIndex]
window.tracker?.trackEvent 'Hint Used', category: 'Students', levelSlug: @level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, hintCurrent: hintIndex, ['Mixpanel'] window.tracker?.trackEvent 'Hint Used', category: 'Students', levelSlug: @level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, hintCurrent: hintIndex, []
hintsUsed[hintIndex] = true hintsUsed[hintIndex] = true
@state.set('hintsUsed', hintsUsed) @state.set('hintsUsed', hintsUsed)
clearInterval(@timerIntervalID) clearInterval(@timerIntervalID)

View file

@ -49,7 +49,7 @@ module.exports = class CourseVictoryModal extends ModalView
@course = new Course() @course = new Course()
@supermodel.trackRequest @course.fetchForCourseInstance(@courseInstanceID) @supermodel.trackRequest @course.fetchForCourseInstance(@courseInstanceID)
window.tracker?.trackEvent 'Play Level Victory Modal Loaded', category: 'Students', levelSlug: @level.get('slug'), ['Mixpanel'] window.tracker?.trackEvent 'Play Level Victory Modal Loaded', category: 'Students', levelSlug: @level.get('slug'), []
onResourceLoadFailed: (e) -> onResourceLoadFailed: (e) ->
if e.resource.jqxhr is @nextLevelRequest if e.resource.jqxhr is @nextLevelRequest
@ -98,7 +98,7 @@ module.exports = class CourseVictoryModal extends ModalView
@showView(@views[index+1]) @showView(@views[index+1])
onNextLevel: -> onNextLevel: ->
window.tracker?.trackEvent 'Play Level Victory Modal Next Level', category: 'Students', levelSlug: @level.get('slug'), nextLevelSlug: @nextLevel.get('slug'), ['Mixpanel'] window.tracker?.trackEvent 'Play Level Victory Modal Next Level', category: 'Students', levelSlug: @level.get('slug'), nextLevelSlug: @nextLevel.get('slug'), []
if me.isSessionless() if me.isSessionless()
link = "/play/level/#{@nextLevel.get('slug')}?course=#{@courseID}&codeLanguage=#{utils.getQueryVariable('codeLanguage', 'python')}" link = "/play/level/#{@nextLevel.get('slug')}?course=#{@courseID}&codeLanguage=#{utils.getQueryVariable('codeLanguage', 'python')}"
else else
@ -107,7 +107,7 @@ module.exports = class CourseVictoryModal extends ModalView
application.router.navigate(link, {trigger: true}) application.router.navigate(link, {trigger: true})
onDone: -> onDone: ->
window.tracker?.trackEvent 'Play Level Victory Modal Done', category: 'Students', levelSlug: @level.get('slug'), ['Mixpanel'] window.tracker?.trackEvent 'Play Level Victory Modal Done', category: 'Students', levelSlug: @level.get('slug'), []
if me.isSessionless() if me.isSessionless()
link = '/teachers/courses' link = '/teachers/courses'
else else

View file

@ -50,7 +50,7 @@ module.exports = class SpellTopBarView extends CocoView
onClickHintsButton: -> onClickHintsButton: ->
return unless @hintsState? return unless @hintsState?
@hintsState.set('hidden', not @hintsState.get('hidden')) @hintsState.set('hidden', not @hintsState.get('hidden'))
window.tracker?.trackEvent 'Hints Clicked', category: 'Students', levelSlug: @options.level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, ['Mixpanel'] window.tracker?.trackEvent 'Hints Clicked', category: 'Students', levelSlug: @options.level.get('slug'), hintCount: @hintsState.get('hints')?.length ? 0, []
onCodeReload: (e) -> onCodeReload: (e) ->
@openModalView new ReloadLevelModal() @openModalView new ReloadLevelModal()