feat: add video sharing config change signal (#32211)

* feat: add tracking to video sharing options change

* test: add tracking to video sharing options change
This commit is contained in:
Nathan Sprenkle
2023-05-10 10:28:35 -04:00
committed by GitHub
parent 9036c0613f
commit f0a9ef2161
2 changed files with 29 additions and 0 deletions

View File

@@ -883,6 +883,24 @@ describe('CourseOutlinePage', function() {
expect($('div.course-video-sharing')).not.toExist();
expect(selectedOption()).not.toExist();
});
it('tracks changes to video sharing option', function() {
createCourse({
video_sharing_enabled: true,
video_sharing_options: 'all-on',
video_sharing_doc_url: 'http://rick.roll'
});
selectedOption().val('per-video').trigger('change');
expect(window.analytics.track).toHaveBeenCalledWith(
'edx.social.video_sharing_options.changed',
{
course_id: 'mock-course',
video_sharing_options: 'per-video'
}
);
});
});
describe('Section', function() {

View File

@@ -29,6 +29,7 @@ define([
if (event.type === "change") {
event.preventDefault();
this.updateVideoSharingConfiguration(event.target.value);
this.trackVideoSharingConfigurationChange(event.target.value);
}
},
@@ -38,6 +39,16 @@ define([
});
},
trackVideoSharingConfigurationChange: function (value) {
window.analytics.track(
'edx.social.video_sharing_options.changed',
{
course_id: this.model.id,
video_sharing_options: value
}
);
},
refresh: function () {
this.model.fetch({
success: this.render.bind(this),