Unverified Commit e758e20a by Nimisha Asthagiri Committed by GitHub

Merge pull request #16409 from edx/google-analytics-in-studio

Course Week Highlights (Studio): adding Google Analytics tracking
parents 69eeca61 82aa1654
......@@ -296,8 +296,8 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
});
afterEach(function() {
EditHelpers.removeMockAnalytics();
EditHelpers.cancelModalIfShowing();
EditHelpers.removeMockAnalytics();
// Clean up after the $.datepicker
$('#start_date').datepicker('destroy');
$('#due_date').datepicker('destroy');
......
......@@ -206,6 +206,7 @@ define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components
});
if (modal) {
window.analytics.track('edx.bi.highlights.modal_open');
modal.show();
}
},
......
......@@ -215,6 +215,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
});
HighlightsXBlockModal = CourseOutlineXBlockModal.extend({
events: _.extend({}, CourseOutlineXBlockModal.prototype.events, {
'click .action-save': 'callAnalytics',
'click .action-cancel': 'callAnalytics'
}),
initialize: function() {
CourseOutlineXBlockModal.prototype.initialize.call(this);
if (this.options.xblockType) {
......@@ -238,6 +244,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
);
},
callAnalytics: function(event) {
event.preventDefault();
window.analytics.track('edx.bi.highlights.' + event.target.innerText.toLowerCase());
this.save(event);
},
addActionButtons: function() {
this.addActionButton('save', gettext('Save'), true);
this.addActionButton('cancel', gettext('Cancel'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment