Skip to content
Snippets Groups Projects
Unverified Commit 961faf4a authored by Dillon-Dumesnil's avatar Dillon-Dumesnil Committed by GitHub
Browse files

Merge pull request #18806 from edx/ddumesnil/pathway-bi

Adding BI event for clicking to learn more about pathways + minor fix…
parents 6f7b19b6 ea48e7b8
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......@@ -8,20 +8,19 @@
<% } %>
</aside>
<aside class="aside js-course-certificates"></aside>
<% if (programRecordUrl) { %>
<aside class="aside js-program-record program-record">
<h2 class="divider-heading"><%- gettext('Program Record') %></h2>
<div class="motivating-section">
<p class="motivating-message"><%- gettext('Once you complete one of the program requirements you have a program record. This record is marked complete once you meet all program requirements. A program record can be used to continue your learning journey and demonstrate your learning to others.') %></p>
</div>
<aside class="aside js-program-record program-record">
<h2 class="divider-heading"><%- gettext('Program Record') %></h2>
<div class="motivating-section">
<p class="motivating-message"><%- gettext('Once you complete one of the program requirements you have a program record. This record is marked complete once you meet all program requirements. A program record can be used to continue your learning journey and demonstrate your learning to others.') %></p>
</div>
<% if (programRecordUrl) { %>
<div class="sidebar-button-wrapper">
<a href="<%- programRecordUrl %>" class="program-record-link">
<button class="btn sidebar-button"><%- gettext('View Program Record') %></button>
</a>
</div>
</aside>
<% } %>
<% } %>
</aside>
<% if (creditPathways.length > 0) { %>
<aside class="aside js-program-pathways program-pathways">
<h2 class = "divider-heading"><%- gettext('Additional Learning Opportunities') %></h2>
......@@ -38,7 +37,7 @@
<% if (pathway.destination_url) { %>
<div class="sidebar-button-wrapper">
<a href="<%- pathway.destination_url %>" class="pathway-link">
<button class="btn sidebar-button"><%- gettext('Learn More') %></button>
<button class="btn sidebar-button" data-pathway-id="<%- pathway.id %>" data-pathway-name="<%- pathway.name %>"><%- gettext('Learn More') %></button>
</a>
</div>
<% } %>
......
......@@ -13,12 +13,16 @@ def get_credentials_records_url(program_uuid=None):
"""
Returns a URL for a given records page (or general records list if given no UUID).
May return None if this feature is disabled.
Arguments:
program_uuid (str): Optional program uuid to link for a program records URL
"""
base_url = CredentialsApiConfig.current().public_records_url
if base_url is None:
return None
if program_uuid:
return base_url + 'programs/{}/'.format(program_uuid)
# Credentials expects the uuid without dashes so we are converting here
return base_url + 'programs/{}/'.format(program_uuid.replace('-', ''))
return base_url
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment