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
42efd33c
Commit
42efd33c
authored
Jul 01, 2013
by
Renzo Lucioni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor Segment.io integration with sequentials and instructor dashboard pages
parent
9b0fa006
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
24 deletions
+33
-24
common/lib/xmodule/xmodule/js/src/sequence/display.coffee
+26
-0
common/static/coffee/spec/logger_spec.coffee
+0
-10
common/static/coffee/src/logger.coffee
+0
-12
lms/static/coffee/src/instructor_dashboard_tracking.coffee
+4
-0
lms/templates/courseware/instructor_dashboard.html
+1
-1
lms/templates/widgets/segment-io.html
+2
-1
No files found.
common/lib/xmodule/xmodule/js/src/sequence/display.coffee
View file @
42efd33c
...
...
@@ -111,6 +111,14 @@ class @Sequence
if
(
1
<=
new_position
)
and
(
new_position
<=
@
num_contents
)
Logger
.
log
"seq_goto"
,
old
:
@
position
,
new
:
new_position
,
id
:
@
id
analytics
.
pageview
@
id
# navigation by clicking the tab directly
analytics
.
track
"Accessed Sequential Directly"
,
sequence_id
:
@
id
current_sequential
:
@
position
target_sequential
:
new_position
# On Sequence chage, destroy any existing polling thread
# for queued submissions, see ../capa/display.coffee
if
window
.
queuePollerID
...
...
@@ -125,12 +133,30 @@ class @Sequence
event
.
preventDefault
()
new_position
=
@
position
+
1
Logger
.
log
"seq_next"
,
old
:
@
position
,
new
:
new_position
,
id
:
@
id
analytics
.
pageview
@
id
# navigation using the next arrow
analytics
.
track
"Accessed Next Sequential"
,
sequence_id
:
@
id
current_sequential
:
@
position
target_sequential
:
new_position
@
render
new_position
previous
:
(
event
)
=>
event
.
preventDefault
()
new_position
=
@
position
-
1
Logger
.
log
"seq_prev"
,
old
:
@
position
,
new
:
new_position
,
id
:
@
id
analytics
.
pageview
@
id
# navigation using the previous arrow
analytics
.
track
"Accessed Previous Sequential"
,
sequence_id
:
@
id
current_sequential
:
@
position
target_sequential
:
new_position
@
render
new_position
link_for
:
(
position
)
->
...
...
common/static/coffee/spec/logger_spec.coffee
View file @
42efd33c
...
...
@@ -3,16 +3,6 @@ describe 'Logger', ->
expect
(
window
.
log_event
).
toBe
Logger
.
log
describe
'log'
,
->
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'
,
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
$
,
'postWithPrefix'
Logger
.
log
'example'
,
'data'
...
...
common/static/coffee/src/logger.coffee
View file @
42efd33c
class
@
Logger
# events we want sent to Segment.io for tracking
SEGMENT_IO_WHITELIST
=
[
"seq_goto"
,
"seq_next"
,
"seq_prev"
,
"problem_check"
,
"problem_reset"
,
"problem_show"
,
"problem_save"
]
# listeners[event_type][element] -> list of callbacks
listeners
=
{}
@
log
:
(
event_type
,
data
,
element
=
null
)
->
# Segment.io event tracking
if
event_type
in
SEGMENT_IO_WHITELIST
# 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
# Check to see if we're listening for the event type.
if
event_type
of
listeners
# Cool. Do the elements also match?
...
...
@@ -43,7 +32,6 @@ class @Logger
else
listeners
[
event_type
][
element
].
push
callback
@
bind
:
->
window
.
onunload
=
->
$
.
ajaxWithPrefix
...
...
lms/static/coffee/src/instructor_dashboard_tracking.coffee
0 → 100644
View file @
42efd33c
if
$
(
'.instructor-dashboard-wrapper'
).
length
==
1
analytics
.
track
"Loaded an Instructor Dashboard Page"
,
location
:
window
.
location
.
pathname
dashboard_page
:
$
(
'.navbar .selectedmode'
).
text
()
lms/templates/courseware/instructor_dashboard.html
View file @
42efd33c
...
...
@@ -104,7 +104,7 @@ function goto( mode)
<section
class=
"instructor-dashboard-content"
>
<h1>
Instructor Dashboard
</h1>
<h2>
[
<a
href=
"#"
onclick=
"goto('Grades');"
class=
"${modeflag.get('Grades')}"
>
Grades
</a>
|
<h2
class=
"navbar"
>
[
<a
href=
"#"
onclick=
"goto('Grades');"
class=
"${modeflag.get('Grades')}"
>
Grades
</a>
|
%if settings.MITX_FEATURES.get('ENABLE_PSYCHOMETRICS'):
<a
href=
"#"
onclick=
"goto('Psychometrics');"
class=
"${modeflag.get('Psychometrics')}"
>
Psychometrics
</a>
|
%endif
...
...
lms/templates/widgets/segment-io.html
View file @
42efd33c
...
...
@@ -17,7 +17,8 @@
<!-- dummy segment.io -->
<script
type=
"text/javascript"
>
var
analytics
=
{
track
:
function
()
{
return
;
}
track
:
function
()
{
return
;
},
pageview
:
function
()
{
return
;
}
};
</script>
<!-- end dummy segment.io -->
...
...
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