Avoid changing format of data sent to our logs, and prevent problem_check event from firing twice

This commit is contained in:
Renzo Lucioni
2013-06-25 15:15:28 -04:00
parent bcbce3eff0
commit 84f4361d52
2 changed files with 11 additions and 6 deletions

View File

@@ -3,9 +3,13 @@ class @Logger
SEGMENT_IO_WHITELIST = ["seq_goto", "seq_next", "seq_prev", "problem_check", "problem_reset", "problem_show", "problem_save"]
@log: (event_type, data) ->
# Segment.io event tracking
if event_type in SEGMENT_IO_WHITELIST
# Segment.io event tracking
analytics.track event_type, data
# to avoid changing the format of data sent to our servers, we only massage it here
if typeof data isnt 'object' or data is null
analytics.track event_type, value: data
else
analytics.track event_type, data
$.getWithPrefix '/event',
event_type: event_type