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
26fdf5d2
Commit
26fdf5d2
authored
Apr 22, 2014
by
Renzo Lucioni
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3421 from edx/renzo/segment-io-identify-fix
Correct ordering of Segment.io identify and page calls
parents
deb9eb82
cfd841b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
lms/templates/widgets/segment-io.html
+18
-18
No files found.
lms/templates/widgets/segment-io.html
View file @
26fdf5d2
...
@@ -8,24 +8,7 @@
...
@@ -8,24 +8,7 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
// Asynchronously load Segment.io's analytics.js library
// Asynchronously load Segment.io's analytics.js library
window
.
analytics
||
(
window
.
analytics
=
[]),
window
.
analytics
.
methods
=
[
"identify"
,
"track"
,
"trackLink"
,
"trackForm"
,
"trackClick"
,
"trackSubmit"
,
"page"
,
"pageview"
,
"ab"
,
"alias"
,
"ready"
,
"group"
,
"on"
,
"once"
,
"off"
],
window
.
analytics
.
factory
=
function
(
t
){
return
function
(){
var
a
=
Array
.
prototype
.
slice
.
call
(
arguments
);
return
a
.
unshift
(
t
),
window
.
analytics
.
push
(
a
),
window
.
analytics
}};
for
(
var
i
=
0
;
i
<
window
.
analytics
.
methods
.
length
;
i
++
){
var
method
=
window
.
analytics
.
methods
[
i
];
window
.
analytics
[
method
]
=
window
.
analytics
.
factory
(
method
)}
window
.
analytics
.
load
=
function
(
t
){
var
a
=
document
.
createElement
(
"script"
);
a
.
type
=
"text/javascript"
,
a
.
async
=!
0
,
a
.
src
=
(
"https:"
===
document
.
location
.
protocol
?
"https://"
:
"http://"
)
+
"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"
+
t
+
"/analytics.min.js"
;
var
n
=
document
.
getElementsByTagName
(
"script"
)[
0
];
n
.
parentNode
.
insertBefore
(
a
,
n
)},
window
.
analytics
.
SNIPPET_VERSION
=
"2.0.8"
,
window
.
analytics
||
(
window
.
analytics
=
[]),
window
.
analytics
.
methods
=
[
"identify"
,
"track"
,
"trackLink"
,
"trackForm"
,
"trackClick"
,
"trackSubmit"
,
"page"
,
"pageview"
,
"ab"
,
"alias"
,
"ready"
,
"group"
,
"on"
,
"once"
,
"off"
],
window
.
analytics
.
factory
=
function
(
t
){
return
function
(){
var
a
=
Array
.
prototype
.
slice
.
call
(
arguments
);
return
a
.
unshift
(
t
),
window
.
analytics
.
push
(
a
),
window
.
analytics
}};
for
(
var
i
=
0
;
i
<
window
.
analytics
.
methods
.
length
;
i
++
){
var
method
=
window
.
analytics
.
methods
[
i
];
window
.
analytics
[
method
]
=
window
.
analytics
.
factory
(
method
)}
window
.
analytics
.
load
=
function
(
t
){
var
a
=
document
.
createElement
(
"script"
);
a
.
type
=
"text/javascript"
,
a
.
async
=!
0
,
a
.
src
=
(
"https:"
===
document
.
location
.
protocol
?
"https://"
:
"http://"
)
+
"d2dq2ahtl5zl1z.cloudfront.net/analytics.js/v1/"
+
t
+
"/analytics.min.js"
;
var
n
=
document
.
getElementsByTagName
(
"script"
)[
0
];
n
.
parentNode
.
insertBefore
(
a
,
n
)},
window
.
analytics
.
SNIPPET_VERSION
=
"2.0.8"
,
window
.
analytics
.
load
(
"${ settings.SEGMENT_IO_LMS_KEY }"
);
analytics
.
load
(
"${ settings.SEGMENT_IO_LMS_KEY }"
);
// Get current page URL and pull out the path
path
=
window
.
location
.
href
.
split
(
"/"
)[
3
]
// Match on the current path and fire the appropriate pageview event
if
(
path
==
"register"
)
{
// Registration page viewed
window
.
analytics
.
page
(
"Registration"
);
}
else
if
(
path
==
"login"
)
{
// Login page viewed
window
.
analytics
.
page
(
"Login"
);
}
else
if
(
path
==
"dashboard"
)
{
// Dashboard viewed
window
.
analytics
.
page
(
"Dashboard"
);
}
else
{
// This event serves as a catch-all, firing when any other page is viewed
window
.
analytics
.
page
(
"Other"
);
}
%
if
user
.
is_authenticated
():
%
if
user
.
is_authenticated
():
...
@@ -39,6 +22,23 @@
...
@@ -39,6 +22,23 @@
});
});
%
endif
%
endif
// Get current page URL and pull out the path
path
=
window
.
location
.
href
.
split
(
"/"
)[
3
]
// Match on the current path and fire the appropriate pageview event
if
(
path
==
"register"
)
{
// Registration page viewed
analytics
.
page
(
"Registration"
);
}
else
if
(
path
==
"login"
)
{
// Login page viewed
analytics
.
page
(
"Login"
);
}
else
if
(
path
==
"dashboard"
)
{
// Dashboard viewed
analytics
.
page
(
"Dashboard"
);
}
else
{
// This event serves as a catch-all, firing when any other page is viewed
analytics
.
page
(
"Other"
);
}
</script>
</script>
<!-- end Segment.io -->
<!-- end Segment.io -->
% else:
% else:
...
...
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