Commit c32d8a62 by Robert Raposa Committed by GitHub

Merge pull request #15866 from edx/diana/update-events

LEARNER-2025: Update event naming for course sock.
parents 100b5aa5 086e15c9
......@@ -9,10 +9,10 @@
});
});
$('.date-summary-verified-upgrade-deadline .date-summary-link').on('click', function() {
Logger.log('edx.course.home.upgrade_verified.clicked', {location: 'sidebar'});
Logger.log('edx.course.enrollment.upgrade.clicked', {location: 'sidebar'});
});
$('.upgrade-banner-button').on('click', function() {
Logger.log('edx.course.home.upgrade_verified.clicked', {location: 'notification'});
Logger.log('edx.course.enrollment.upgrade.clicked', {location: 'notification'});
});
$('.view-verified-info').on('click', function() {
Logger.log('edx.course.home.learn_about_verified.clicked', {location: 'notification'});
......
......@@ -120,7 +120,7 @@
var user = $(event.target).closest('.action-upgrade').data('user'),
course = $(event.target).closest('.action-upgrade').data('course-id');
Logger.log('edx.course.enrollment.upgrade.clicked', [user, course], null);
Logger.log('edx.course.enrollment.upgrade.clicked', [user, course], {location: 'learner_dashboard'});
});
$('.action-email-settings').click(function(event) {
......
......@@ -19,13 +19,13 @@ define(['jquery', 'logger', 'js/courseware/course_home_events'], function($, Log
it('sends an event when "Upgrade to Verified" is clicked from the sidebar', function() {
$('.date-summary-link').click();
expect(Logger.log).toHaveBeenCalledWith('edx.course.home.upgrade_verified.clicked', {location: 'sidebar'});
expect(Logger.log).toHaveBeenCalledWith('edx.course.enrollment.upgrade.clicked', {location: 'sidebar'});
});
it('sends an event when "Upgrade Now" is clicked from the upsell notification', function() {
$('.upgrade-banner-button').click();
expect(Logger.log).toHaveBeenCalledWith(
'edx.course.home.upgrade_verified.clicked', {location: 'notification'}
'edx.course.enrollment.upgrade.clicked', {location: 'notification'}
);
});
......
......@@ -57,9 +57,9 @@ export class CourseSock { // eslint-disable-line import/prefer-default-export
// Log open and close events
const isOpening = $toggleActionButton.hasClass('active');
const logMessage = isOpening ? 'User opened the verification sock.'
: 'User closed the verification sock.';
Logger.log(
const logMessage = isOpening ? 'edx.bi.course.sock.toggle_opened'
: 'edx.bi.course.sock.toggle_closed';
window.analytics.track(
logMessage,
{
from_page: pageLocation,
......@@ -69,9 +69,9 @@ export class CourseSock { // eslint-disable-line import/prefer-default-export
$upgradeToVerifiedButton.on('click', () => {
Logger.log(
'User clicked the upgrade button in the verification sock.',
'edx.course.enrollment.upgrade.clicked',
{
from_page: pageLocation,
location: 'sock',
},
);
});
......
......@@ -2,6 +2,7 @@
Fragment for rendering the course's sock and associated toggle button.
"""
from django.template.loader import render_to_string
from django.utils.translation import get_language
from opaque_keys.edx.keys import CourseKey
from web_fragments.fragment import Fragment
......@@ -37,7 +38,11 @@ class CourseSockFragmentView(EdxFragmentView):
verification_deadline = VerifiedUpgradeDeadlineDate(course, request.user)
deadline_has_passed = verification_deadline.deadline_has_passed()
show_course_sock = has_verified_mode and not is_already_verified and not deadline_has_passed
# If this proves its worth, we can internationalize and display for more than English speakers.
show_course_sock = (
has_verified_mode and not is_already_verified and
not deadline_has_passed and get_language() == 'en'
)
# Get the price of the course and format correctly
course_price = get_cosmetic_verified_display_price(course)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment