From 22bd8da1f2e4a84f45101da61222e687987bb1b2 Mon Sep 17 00:00:00 2001 From: "Mark L. Chang" Date: Thu, 4 Apr 2013 00:34:37 -0400 Subject: [PATCH] added event tracking to static pages --- cms/static/coffee/src/views/module_edit.coffee | 7 ++++++- cms/static/coffee/src/views/tabs.coffee | 12 ++++++++++++ cms/static/js/views/course_info_edit.js | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index 9f7e3a5e60..3cb3b1703f 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -15,7 +15,7 @@ class CMS.Views.ModuleEdit extends Backbone.View $component_editor: => @$el.find('.component-editor') loadDisplay: -> - XModule.loadModule(@$el.find('.xmodule_display')) + XModule.loadModule(@$el.find('.xmodule_display')) loadEdit: -> if not @module @@ -55,6 +55,11 @@ class CMS.Views.ModuleEdit extends Backbone.View clickSaveButton: (event) => event.preventDefault() data = @module.save() + + analytics.track "Saved Module", + course: course_location_analytics + id: _this.model.id + data.metadata = _.extend(data.metadata || {}, @metadata()) @hideModal() @model.save(data).done( => diff --git a/cms/static/coffee/src/views/tabs.coffee b/cms/static/coffee/src/views/tabs.coffee index 9fbe4e5789..1034fc988e 100644 --- a/cms/static/coffee/src/views/tabs.coffee +++ b/cms/static/coffee/src/views/tabs.coffee @@ -28,6 +28,10 @@ class CMS.Views.TabsEdit extends Backbone.View @$('.component').each((idx, element) => tabs.push($(element).data('id')) ) + + analytics.track "Reordered Static Pages", + course: course_location_analytics + $.ajax({ type:'POST', url: '/reorder_static_tabs', @@ -56,10 +60,18 @@ class CMS.Views.TabsEdit extends Backbone.View 'i4x://edx/templates/static_tab/Empty' ) + analytics.track "Added Static Page", + course: course_location_analytics + deleteTab: (event) => if not confirm 'Are you sure you want to delete this component? This action cannot be undone.' return $component = $(event.currentTarget).parents('.component') + + analytics.track "Deleted Static Page", + course: course_location_analytics + id: $component.data('id') + $.post('/delete_item', { id: $component.data('id') }, => diff --git a/cms/static/js/views/course_info_edit.js b/cms/static/js/views/course_info_edit.js index ce959fd443..a6d42e1927 100644 --- a/cms/static/js/views/course_info_edit.js +++ b/cms/static/js/views/course_info_edit.js @@ -107,6 +107,11 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ // push change to display, hide the editor, submit the change targetModel.save({}, {error : CMS.ServerError}); this.closeEditor(this); + + analytics.track('Saved Course Update', { + 'course': course_location_analytics, + 'date': this.dateEntry(event).val() + }); }, onCancel: function(event) { @@ -147,6 +152,11 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ return; } + analytics.track('Deleted Course Update', { + 'course': course_location_analytics, + 'date': this.dateEntry(event).val() + }); + var targetModel = this.eventModel(event); this.modelDom(event).remove(); var cacheThis = this; @@ -284,6 +294,11 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({ this.model.save({}, {error: CMS.ServerError}); this.$form.hide(); this.closeEditor(this); + + analytics.track('Saved Course Handouts', { + 'course': course_location_analytics + }); + }, onCancel: function(event) {