Update event naming for course sock.

Only show course sock to English readers.
This commit is contained in:
Diana Huang
2017-08-22 11:40:17 -04:00
parent dc576c6c2a
commit 086e15c9b6
5 changed files with 16 additions and 11 deletions

View File

@@ -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',
},
);
});

View File

@@ -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)