Incorporate Segment.io into Logger.log with whitelist

This commit is contained in:
Renzo Lucioni
2013-06-17 13:48:50 -04:00
parent 7518f32f5e
commit c30d2d2f52
3 changed files with 8 additions and 16 deletions

View File

@@ -111,11 +111,6 @@ class @Sequence
if (1 <= new_position) and (new_position <= @num_contents)
Logger.log "seq_goto", old: @position, new: new_position, id: @id
analytics.track "Sequential Goto",
old: @position
new: new_position
id: @id
# On Sequence chage, destroy any existing polling thread
# for queued submissions, see ../capa/display.coffee
if window.queuePollerID
@@ -132,22 +127,12 @@ class @Sequence
Logger.log "seq_next", old: @position, new: new_position, id: @id
@render new_position
analytics.track "Sequential Next",
old: @position
new: new_position
id: @id
previous: (event) =>
event.preventDefault()
new_position = @position - 1
Logger.log "seq_prev", old: @position, new: new_position, id: @id
@render new_position
analytics.track "Sequential Previous",
old: @position
new: new_position
id: @id
link_for: (position) ->
@$("#sequence-list a[data-element=#{position}]")

View File

@@ -1,5 +1,12 @@
class @Logger
# events we want sent to Segment.io for tracking
SEGMENT_IO_WHITELIST = ["seq_goto", "seq_next", "seq_prev"]
@log: (event_type, data) ->
if event_type in SEGMENT_IO_WHITELIST
# Segment.io event tracking
analytics.track event_type, data
$.getWithPrefix '/event',
event_type: event_type
event: JSON.stringify(data)

View File

@@ -102,7 +102,7 @@ MITX_FEATURES = {
# Staff Debug tool.
'ENABLE_STUDENT_HISTORY_VIEW': True,
# segment.io for LMS--need to explicitly turn it on on production.
# segment.io for LMS--need to explicitly turn it on for production.
'SEGMENT_IO_LMS': False,
# Enables the student notes API and UI.