Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
2cd18dfa
Commit
2cd18dfa
authored
Jun 26, 2013
by
Renzo Lucioni
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #263 from edx/renzo/segment-io-whitelist-expansion
Add handful of events to the Segment.io whitelist
parents
38d7ddf0
3f49da38
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+2
-1
common/static/coffee/spec/logger_spec.coffee
+7
-2
common/static/coffee/src/logger.coffee
+7
-3
No files found.
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
2cd18dfa
...
...
@@ -138,7 +138,8 @@ class @Problem
# maybe preferable to consolidate all dispatches to use FormData
###
check_fd
:
=>
Logger
.
log
'problem_check'
,
@
answers
# Calling check from check_fd will result in firing the 'problem_check' event twice, since it is also called in the check function.
#Logger.log 'problem_check', @answers
# If there are no file inputs in the problem, we can fall back on @check
if
$
(
'input:file'
).
length
==
0
...
...
common/static/coffee/spec/logger_spec.coffee
View file @
2cd18dfa
...
...
@@ -3,10 +3,15 @@ describe 'Logger', ->
expect
(
window
.
log_event
).
toBe
Logger
.
log
describe
'log'
,
->
it
'sends an event to Segment.io, if the event is whitelisted'
,
->
it
'sends an event to Segment.io, if the event is whitelisted
and the data is not a dictionary
'
,
->
spyOn
(
analytics
,
'track'
)
Logger
.
log
'seq_goto'
,
'data'
expect
(
analytics
.
track
).
toHaveBeenCalledWith
'seq_goto'
,
'data'
expect
(
analytics
.
track
).
toHaveBeenCalledWith
'seq_goto'
,
value
:
'data'
it
'sends an event to Segment.io, if the event is whitelisted and the data is a dictionary'
,
->
spyOn
(
analytics
,
'track'
)
Logger
.
log
'seq_goto'
,
value
:
'data'
expect
(
analytics
.
track
).
toHaveBeenCalledWith
'seq_goto'
,
value
:
'data'
it
'send a request to log event'
,
->
spyOn
$
,
'getWithPrefix'
...
...
common/static/coffee/src/logger.coffee
View file @
2cd18dfa
class
@
Logger
# events we want sent to Segment.io for tracking
SEGMENT_IO_WHITELIST
=
[
"seq_goto"
,
"seq_next"
,
"seq_prev"
]
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment