Commit c30d2d2f by Renzo Lucioni

Incorporate Segment.io into Logger.log with whitelist

parent 7518f32f
...@@ -111,11 +111,6 @@ class @Sequence ...@@ -111,11 +111,6 @@ class @Sequence
if (1 <= new_position) and (new_position <= @num_contents) if (1 <= new_position) and (new_position <= @num_contents)
Logger.log "seq_goto", old: @position, new: new_position, id: @id 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 # On Sequence chage, destroy any existing polling thread
# for queued submissions, see ../capa/display.coffee # for queued submissions, see ../capa/display.coffee
if window.queuePollerID if window.queuePollerID
...@@ -132,22 +127,12 @@ class @Sequence ...@@ -132,22 +127,12 @@ class @Sequence
Logger.log "seq_next", old: @position, new: new_position, id: @id Logger.log "seq_next", old: @position, new: new_position, id: @id
@render new_position @render new_position
analytics.track "Sequential Next",
old: @position
new: new_position
id: @id
previous: (event) => previous: (event) =>
event.preventDefault() event.preventDefault()
new_position = @position - 1 new_position = @position - 1
Logger.log "seq_prev", old: @position, new: new_position, id: @id Logger.log "seq_prev", old: @position, new: new_position, id: @id
@render new_position @render new_position
analytics.track "Sequential Previous",
old: @position
new: new_position
id: @id
link_for: (position) -> link_for: (position) ->
@$("#sequence-list a[data-element=#{position}]") @$("#sequence-list a[data-element=#{position}]")
......
class @Logger class @Logger
# events we want sent to Segment.io for tracking
SEGMENT_IO_WHITELIST = ["seq_goto", "seq_next", "seq_prev"]
@log: (event_type, data) -> @log: (event_type, data) ->
if event_type in SEGMENT_IO_WHITELIST
# Segment.io event tracking
analytics.track event_type, data
$.getWithPrefix '/event', $.getWithPrefix '/event',
event_type: event_type event_type: event_type
event: JSON.stringify(data) event: JSON.stringify(data)
......
...@@ -102,7 +102,7 @@ MITX_FEATURES = { ...@@ -102,7 +102,7 @@ MITX_FEATURES = {
# Staff Debug tool. # Staff Debug tool.
'ENABLE_STUDENT_HISTORY_VIEW': True, '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, 'SEGMENT_IO_LMS': False,
# Enables the student notes API and UI. # Enables the student notes API and UI.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment