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
3e4d20e0
Commit
3e4d20e0
authored
Aug 16, 2017
by
McKenzie Welter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bundle purchase tracking
parent
eeb70ca3
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 @
3e4d20e0
...
@@ -30,6 +30,10 @@
...
@@ -30,6 +30,10 @@
tpl
:
HtmlUtils
.
template
(
pageTpl
),
tpl
:
HtmlUtils
.
template
(
pageTpl
),
events
:
{
'click .complete-program'
:
'trackPurchase'
},
initialize
:
function
(
options
)
{
initialize
:
function
(
options
)
{
this
.
options
=
options
;
this
.
options
=
options
;
...
@@ -116,6 +120,15 @@
...
@@ -116,6 +120,15 @@
courseModel
:
this
.
courseData
,
courseModel
:
this
.
courseData
,
certificateCollection
:
this
.
certificateCollection
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 @
3e4d20e0
...
@@ -603,6 +603,27 @@ define([
...
@@ -603,6 +603,27 @@ define([
expect
(
$
(
view
.
$
(
'.select-choice'
)[
0
]).
attr
(
'for'
)).
toEqual
(
$
(
view
.
$
(
'.run-select'
)[
0
]).
attr
(
'id'
));
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'
);
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 @
3e4d20e0
...
@@ -602,6 +602,7 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
...
@@ -602,6 +602,7 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
applicable_seat_types
=
self
.
data
[
'applicable_seat_types'
]
applicable_seat_types
=
self
.
data
[
'applicable_seat_types'
]
is_learner_eligible_for_one_click_purchase
=
self
.
data
[
'is_program_eligible_for_one_click_purchase'
]
is_learner_eligible_for_one_click_purchase
=
self
.
data
[
'is_program_eligible_for_one_click_purchase'
]
skus
=
[]
skus
=
[]
bundle_variant
=
'full'
if
is_learner_eligible_for_one_click_purchase
:
if
is_learner_eligible_for_one_click_purchase
:
for
course
in
self
.
data
[
'courses'
]:
for
course
in
self
.
data
[
'courses'
]:
add_course_sku
=
False
add_course_sku
=
False
...
@@ -626,6 +627,8 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
...
@@ -626,6 +627,8 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
is_learner_eligible_for_one_click_purchase
=
False
is_learner_eligible_for_one_click_purchase
=
False
skus
=
[]
skus
=
[]
break
break
else
:
bundle_variant
=
'partial'
if
skus
:
if
skus
:
try
:
try
:
...
@@ -647,7 +650,8 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
...
@@ -647,7 +650,8 @@ class ProgramMarketingDataExtender(ProgramDataExtender):
self
.
data
.
update
({
self
.
data
.
update
({
'discount_data'
:
discount_data
,
'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
):
except
(
ConnectionError
,
SlumberBaseException
,
Timeout
):
log
.
exception
(
'Failed to get discount price for following product SKUs:
%
s '
,
', '
.
join
(
skus
))
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