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

Added tracking to 'Enter Section Highlights' link.
This commit is contained in:
sandroroux
2017-11-01 13:00:25 -04:00
committed by Nimisha Asthagiri
parent bdde858779
commit 82aa1654f8
3 changed files with 14 additions and 1 deletions

View File

@@ -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');

View File

@@ -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();
}
},

View File

@@ -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'));