diff --git a/lms/static/js/learner_dashboard/views/program_details_sidebar_view.js b/lms/static/js/learner_dashboard/views/program_details_sidebar_view.js index e1f84737eb..8d9e422c63 100644 --- a/lms/static/js/learner_dashboard/views/program_details_sidebar_view.js +++ b/lms/static/js/learner_dashboard/views/program_details_sidebar_view.js @@ -11,6 +11,15 @@ import ProgramProgressView from './progress_circle_view'; import sidebarTpl from '../../../templates/learner_dashboard/program_details_sidebar.underscore'; class ProgramDetailsSidebarView extends Backbone.View { + constructor(options) { + const defaults = { + events: { + 'click .sidebar-button': 'trackPathwayClicked', + }, + }; + super(Object.assign({}, defaults, options)); + } + initialize(options) { this.tpl = HtmlUtils.template(sidebarTpl); this.courseModel = options.courseModel || {}; @@ -18,6 +27,7 @@ class ProgramDetailsSidebarView extends Backbone.View { this.programCertificate = this.getProgramCertificate(); this.programRecordUrl = options.programRecordUrl; this.creditPathways = options.creditPathways; + this.programModel = options.model; this.render(); } @@ -81,6 +91,18 @@ class ProgramDetailsSidebarView extends Backbone.View { return type.replace(/\s+/g, '-'); } + + trackPathwayClicked(event) { + var button = event.currentTarget; + window.analytics.track('edx.bi.dashboard.program.pathway.clicked', { + category: 'pathways', + // Credentials uses the uuid without dashes so we are converting here for consistency + program_uuid: this.programModel.attributes.uuid.replace(/-/g, ''), + program_name: this.programModel.attributes.title, + pathway_link_id: $(button).data('pathwayId'), + pathway_name: $(button).data('pathwayName'), + }); + } } export default ProgramDetailsSidebarView; diff --git a/lms/templates/learner_dashboard/program_details_sidebar.underscore b/lms/templates/learner_dashboard/program_details_sidebar.underscore index 939fd09185..e2eeeeff0b 100644 --- a/lms/templates/learner_dashboard/program_details_sidebar.underscore +++ b/lms/templates/learner_dashboard/program_details_sidebar.underscore @@ -8,20 +8,19 @@ <% } %> -<% if (programRecordUrl) { %> - <% if (creditPathways.length > 0) { %>