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
ff54a771
Commit
ff54a771
authored
Aug 21, 2017
by
McKenzie Welter
Committed by
GitHub
Aug 21, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15838 from edx/McKenzieW/learner-2228
Track program purchase attempts from learner programs dashboard
parents
eeb70ca3
3e4d20e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletions
+39
-1
lms/static/js/learner_dashboard/views/program_details_view.js
+13
-0
lms/static/js/spec/learner_dashboard/program_details_view_spec.js
+21
-0
openedx/core/djangoapps/programs/utils.py
+5
-1
No files found.
lms/static/js/learner_dashboard/views/program_details_view.js
View file @
ff54a771
...
...
@@ -30,6 +30,10 @@
tpl
:
HtmlUtils
.
template
(
pageTpl
),
events
:
{
'click .complete-program'
:
'trackPurchase'
},
initialize
:
function
(
options
)
{
this
.
options
=
options
;
...
...
@@ -116,6 +120,15 @@
courseModel
:
this
.
courseData
,
certificateCollection
:
this
.
certificateCollection
});
},
trackPurchase
:
function
()
{
var
data
=
this
.
options
.
programData
;
window
.
analytics
.
track
(
'edx.bi.user.dashboard.program.purchase'
,
{
category
:
data
.
variant
+
' bundle'
,
label
:
data
.
title
,
uuid
:
data
.
uuid
});
}
});
}
...
...
lms/static/js/spec/learner_dashboard/program_details_view_spec.js
View file @
ff54a771
...
...
@@ -603,6 +603,27 @@ define([
expect
(
$
(
view
.
$
(
'.select-choice'
)[
0
]).
attr
(
'for'
)).
toEqual
(
$
(
view
.
$
(
'.run-select'
)[
0
]).
attr
(
'id'
));
expect
(
$
(
view
.
$
(
'.enroll-button button'
)[
0
]).
text
().
trim
()).
toEqual
(
'Enroll Now'
);
});
it
(
'should send analytic event when purchase button clicked'
,
function
()
{
var
properties
=
{
category
:
'partial bundle'
,
label
:
'Test Course Title'
,
uuid
:
'0ffff5d6-0177-4690-9a48-aa2fecf94610'
};
view
=
initView
({
programData
:
$
.
extend
({},
options
.
programData
,
{
is_learner_eligible_for_one_click_purchase
:
true
,
variant
:
'partial'
})
});
view
.
render
();
$
(
'.complete-program'
).
click
();
// Verify that analytics event fires when the purchase button is clicked.
expect
(
window
.
analytics
.
track
).
toHaveBeenCalledWith
(
'edx.bi.user.dashboard.program.purchase'
,
properties
);
});
});
}
);
openedx/core/djangoapps/programs/utils.py
View file @
ff54a771
...
...
@@ -602,6 +602,7 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
applicable_seat_types
=
self
.
data
[
'applicable_seat_types'
]
is_learner_eligible_for_one_click_purchase
=
self
.
data
[
'is_program_eligible_for_one_click_purchase'
]
skus
=
[]
bundle_variant
=
'full'
if
is_learner_eligible_for_one_click_purchase
:
for
course
in
self
.
data
[
'courses'
]:
add_course_sku
=
False
...
...
@@ -626,6 +627,8 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
is_learner_eligible_for_one_click_purchase
=
False
skus
=
[]
break
else
:
bundle_variant
=
'partial'
if
skus
:
try
:
...
...
@@ -647,7 +650,8 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
self
.
data
.
update
({
'discount_data'
:
discount_data
,
'full_program_price'
:
discount_data
[
'total_incl_tax'
]
'full_program_price'
:
discount_data
[
'total_incl_tax'
],
'variant'
:
bundle_variant
})
except
(
ConnectionError
,
SlumberBaseException
,
Timeout
):
log
.
exception
(
'Failed to get discount price for following product SKUs:
%
s '
,
', '
.
join
(
skus
))
...
...
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