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

Course Week Highlights (Studio): adding Google Analytics tracking
This commit is contained in:
Nimisha Asthagiri
2017-11-06 16:44:07 -05:00
committed by GitHub
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'));