Commit 82aa1654 by sandroroux Committed by Nimisha Asthagiri

Added Google Analytics tracking to the Highlights Modal's save and cancel buttons

Added tracking to 'Enter Section Highlights' link.
parent bdde8587
...@@ -296,8 +296,8 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j ...@@ -296,8 +296,8 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
}); });
afterEach(function() { afterEach(function() {
EditHelpers.removeMockAnalytics();
EditHelpers.cancelModalIfShowing(); EditHelpers.cancelModalIfShowing();
EditHelpers.removeMockAnalytics();
// Clean up after the $.datepicker // Clean up after the $.datepicker
$('#start_date').datepicker('destroy'); $('#start_date').datepicker('destroy');
$('#due_date').datepicker('destroy'); $('#due_date').datepicker('destroy');
......
...@@ -206,6 +206,7 @@ define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components ...@@ -206,6 +206,7 @@ define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components
}); });
if (modal) { if (modal) {
window.analytics.track('edx.bi.highlights.modal_open');
modal.show(); modal.show();
} }
}, },
......
...@@ -215,6 +215,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -215,6 +215,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
}); });
HighlightsXBlockModal = CourseOutlineXBlockModal.extend({ HighlightsXBlockModal = CourseOutlineXBlockModal.extend({
events: _.extend({}, CourseOutlineXBlockModal.prototype.events, {
'click .action-save': 'callAnalytics',
'click .action-cancel': 'callAnalytics'
}),
initialize: function() { initialize: function() {
CourseOutlineXBlockModal.prototype.initialize.call(this); CourseOutlineXBlockModal.prototype.initialize.call(this);
if (this.options.xblockType) { if (this.options.xblockType) {
...@@ -238,6 +244,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -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() { addActionButtons: function() {
this.addActionButton('save', gettext('Save'), true); this.addActionButton('save', gettext('Save'), true);
this.addActionButton('cancel', gettext('Cancel')); 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