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

@@ -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)