Merge pull request #11360 from edx/cdyer/track-push
Track push notification activity in analytics
This commit is contained in:
@@ -221,8 +221,11 @@ define([
|
||||
"coffee/spec/models/settings_grading_spec", "coffee/spec/models/textbook_spec",
|
||||
"coffee/spec/models/upload_spec",
|
||||
|
||||
"coffee/spec/views/metadata_edit_spec", "coffee/spec/views/module_edit_spec",
|
||||
"coffee/spec/views/textbook_spec", "coffee/spec/views/upload_spec",
|
||||
"coffee/spec/views/course_info_spec",
|
||||
"coffee/spec/views/metadata_edit_spec",
|
||||
"coffee/spec/views/module_edit_spec",
|
||||
"coffee/spec/views/textbook_spec",
|
||||
"coffee/spec/views/upload_spec",
|
||||
|
||||
"js/spec/video/transcripts/utils_spec", "js/spec/video/transcripts/editor_spec",
|
||||
"js/spec/video/transcripts/videolist_spec", "js/spec/video/transcripts/message_manager_spec",
|
||||
|
||||
@@ -123,6 +123,9 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
|
||||
# Verify the link is not rewritten when saved.
|
||||
expect(requestSent.content).toEqual('/static/image.jpg')
|
||||
|
||||
# Verify that analytics are sent
|
||||
expect(window.analytics.track).toHaveBeenCalled()
|
||||
|
||||
it "does rewrite links for preview", ->
|
||||
# Create a new update.
|
||||
@createNewUpdate('/static/image.jpg')
|
||||
@@ -177,15 +180,22 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
|
||||
requestSent = JSON.parse(requests[requests.length - 1].requestBody)
|
||||
expect(requestSent.push_notification_selected).toEqual(true)
|
||||
|
||||
# Check that analytics send push_notification info
|
||||
analytics_payload = window.analytics.track.calls[0].args[1]
|
||||
expect(analytics_payload).toEqual(jasmine.objectContaining({'push_notification_selected': true}))
|
||||
|
||||
it "sends correct value for push_notification_selected when it is unselected", ->
|
||||
requests = AjaxHelpers.requests(this);
|
||||
# unselect push notification
|
||||
@courseInfoEdit.$el.find('.toggle-checkbox').attr('checked', false);
|
||||
|
||||
@courseInfoEdit.$el.find('.save-button').click()
|
||||
requestSent = JSON.parse(requests[requests.length - 1].requestBody)
|
||||
expect(requestSent.push_notification_selected).toEqual(false)
|
||||
|
||||
# Check that analytics send push_notification info
|
||||
analytics_payload = window.analytics.track.calls[0].args[1]
|
||||
expect(analytics_payload).toEqual(jasmine.objectContaining({'push_notification_selected': false}))
|
||||
|
||||
describe "Course Handouts", ->
|
||||
handoutsTemplate = readFixtures('course_info_handouts.underscore')
|
||||
|
||||
|
||||
@@ -105,7 +105,8 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
|
||||
|
||||
analytics.track('Saved Course Update', {
|
||||
'course': course_location_analytics,
|
||||
'date': this.dateEntry(event).val()
|
||||
'date': this.dateEntry(event).val(),
|
||||
'push_notification_selected': this.push_notification_selected(event)
|
||||
});
|
||||
},
|
||||
|
||||
@@ -134,7 +135,7 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
|
||||
// Variable stored for unit test.
|
||||
this.$modalCover = ModalUtils.showModalCover(false,
|
||||
function() {
|
||||
self.closeEditor(false)
|
||||
self.closeEditor(false);
|
||||
}
|
||||
);
|
||||
},
|
||||
@@ -211,8 +212,9 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
|
||||
|
||||
// hide the push notification checkbox for subsequent edits to the Post
|
||||
var push_notification_ele = this.$currentPost.find(".new-update-push-notification");
|
||||
if (push_notification_ele)
|
||||
if (push_notification_ele) {
|
||||
push_notification_ele.hide();
|
||||
}
|
||||
}
|
||||
|
||||
ModalUtils.hideModalCover(this.$modalCover);
|
||||
@@ -231,12 +233,16 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
|
||||
|
||||
editor: function(event) {
|
||||
var li = $(event.currentTarget).closest("li");
|
||||
if (li) return $(li).find("form").first();
|
||||
if (li) {
|
||||
return $(li).find("form").first();
|
||||
}
|
||||
},
|
||||
|
||||
dateEntry: function(event) {
|
||||
var li = $(event.currentTarget).closest("li");
|
||||
if (li) return $(li).find(".date").first();
|
||||
if (li) {
|
||||
return $(li).find(".date").first();
|
||||
}
|
||||
},
|
||||
|
||||
push_notification_selected: function(event) {
|
||||
@@ -249,7 +255,6 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return CourseInfoUpdateView;
|
||||
|
||||
Reference in New Issue
Block a user