From 1ce2affdd2f8ce267a842f5425fba3da5401570e Mon Sep 17 00:00:00 2001 From: "Mark L. Chang" Date: Wed, 3 Apr 2013 23:45:05 -0400 Subject: [PATCH] outline page event tracking --- cms/static/js/base.js | 48 ++++++++++++++++++++++++++- cms/templates/widgets/segment-io.html | 7 +++- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 6ea918cc36..7b930a176b 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -331,6 +331,12 @@ function createNewUnit(e) { var parent = $(this).data('parent'); var template = $(this).data('template'); + analytics.track('Created a Unit', { + 'course': course_location_analytics, + 'parent_location': parent + }); + + $.post('/clone_item', {'parent_location': parent, 'template': template, @@ -363,6 +369,12 @@ function _deleteItem($el) { var id = $el.data('id'); + analytics.track('Deleted an Item', { + 'course': course_location_analytics, + 'id': id + }); + + $.post('/delete_item', {'id': id, 'delete_children': true, 'delete_all_versions': true}, function (data) { @@ -426,6 +438,11 @@ function displayFinishedUpload(xhr) { var html = Mustache.to_html(template, resp); $('table > tbody').prepend(html); + analytics.track('Uploaded a File', { + 'course': course_location_analytics, + 'asset_url': resp.url + }); + } function markAsLoaded() { @@ -555,6 +572,11 @@ function saveNewSection(e) { var template = $saveButton.data('template'); var display_name = $(this).find('.new-section-name').val(); + analytics.track('Created a Section', { + 'course': course_location_analytics, + 'display_name': display_name + }); + $.post('/clone_item', { 'parent_location': parent, 'template': template, @@ -600,6 +622,12 @@ function saveNewCourse(e) { return; } + analytics.track('Created a Course', { + 'org': org, + 'number': number, + 'display_name': display_name + }); + $.post('/create_new_course', { 'template': template, 'org': org, @@ -646,9 +674,14 @@ function saveNewSubsection(e) { var parent = $(this).find('.new-subsection-name-save').data('parent'); var template = $(this).find('.new-subsection-name-save').data('template'); - var display_name = $(this).find('.new-subsection-name-input').val(); + analytics.track('Created a Subsection', { + 'course': course_location_analytics, + 'display_name': display_name + }); + + $.post('/clone_item', { 'parent_location': parent, 'template': template, @@ -702,6 +735,13 @@ function saveEditSectionName(e) { return; } + analytics.track('Edited Section Name', { + 'course': course_location_analytics, + 'display_name': display_name, + 'id': id + }); + + var $_this = $(this); // call into server to commit the new order $.ajax({ @@ -741,6 +781,12 @@ function saveSetSectionScheduleDate(e) { var id = $modal.attr('data-id'); + analytics.track('Edited Section Release Date', { + 'course': course_location_analytics, + 'id': id, + 'start': start + }); + // call into server to commit the new order $.ajax({ url: "/save_item", diff --git a/cms/templates/widgets/segment-io.html b/cms/templates/widgets/segment-io.html index 1ccee8cff1..7d00c731b0 100644 --- a/cms/templates/widgets/segment-io.html +++ b/cms/templates/widgets/segment-io.html @@ -1,6 +1,11 @@ % if settings.MITX_FEATURES.get('SEGMENT_IO'): -% endif \ No newline at end of file +% endif