From 7f4550387cf49565d9d7608362a71ea66d622628 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Tue, 26 Sep 2017 16:44:32 -0400 Subject: [PATCH] Add eventing to course home upgrade paths. --- lms/djangoapps/courseware/date_summary.py | 5 ++-- .../courseware/tests/test_date_summary.py | 1 - lms/envs/common.py | 1 - .../fixtures/course-home-fragment.html | 2 +- .../static/course_experience/js/CourseHome.js | 28 +++++++++++++------ .../js/spec/CourseHome_spec.js | 2 +- .../course-home-fragment.html | 5 +++- .../course-sock-fragment.html | 2 +- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/lms/djangoapps/courseware/date_summary.py b/lms/djangoapps/courseware/date_summary.py index 205edbe3a8..170df6291a 100644 --- a/lms/djangoapps/courseware/date_summary.py +++ b/lms/djangoapps/courseware/date_summary.py @@ -314,7 +314,6 @@ class CourseEndDate(DateSummary): ) - class CertificateAvailableDate(DateSummary): """ Displays the certificate available date of the course. @@ -431,7 +430,9 @@ class VerifiedUpgradeDeadlineDate(DateSummary): platform_name=settings.PLATFORM_NAME, button_panel=HTML( '
' - '{upgrade_label}' + '{upgrade_label}' '
' ).format( upgrade_url=self.link, diff --git a/lms/djangoapps/courseware/tests/test_date_summary.py b/lms/djangoapps/courseware/tests/test_date_summary.py index 08c2f320e6..dcabd580a4 100644 --- a/lms/djangoapps/courseware/tests/test_date_summary.py +++ b/lms/djangoapps/courseware/tests/test_date_summary.py @@ -547,7 +547,6 @@ class TestDateAlerts(SharedModuleStoreTestCase): self.assertEqual(len(messages), 0) - @attr(shard=1) class TestScheduleOverrides(SharedModuleStoreTestCase): diff --git a/lms/envs/common.py b/lms/envs/common.py index 6b561a591f..0b7b3376aa 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2592,7 +2592,6 @@ MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 15 * 60 TIME_ZONE_DISPLAYED_FOR_DEADLINES = 'UTC' - ########################## VIDEO IMAGE STORAGE ############################ VIDEO_IMAGE_SETTINGS = dict( diff --git a/openedx/features/course_experience/static/course_experience/fixtures/course-home-fragment.html b/openedx/features/course_experience/static/course_experience/fixtures/course-home-fragment.html index 134c5351b4..39998df788 100644 --- a/openedx/features/course_experience/static/course_experience/fixtures/course-home-fragment.html +++ b/openedx/features/course_experience/static/course_experience/fixtures/course-home-fragment.html @@ -49,7 +49,7 @@
- Upgrade ($100) + Upgrade ($100)
diff --git a/openedx/features/course_experience/static/course_experience/js/CourseHome.js b/openedx/features/course_experience/static/course_experience/js/CourseHome.js index 16d19580bd..166928ee5c 100644 --- a/openedx/features/course_experience/static/course_experience/js/CourseHome.js +++ b/openedx/features/course_experience/static/course_experience/js/CourseHome.js @@ -44,6 +44,7 @@ export class CourseHome { // eslint-disable-line import/prefer-default-export $(document).ready(() => { this.configureUpgradeMessage(); + this.configureUpgradeAnalytics(); }); } @@ -56,6 +57,25 @@ export class CourseHome { // eslint-disable-line import/prefer-default-export window.analytics.track(event, properties); } + // Promotion analytics for upgrade messages on course home. + // eslint-disable-next-line class-methods-use-this + configureUpgradeAnalytics() { + $('.btn-upgrade').each( + (index, button) => { + const promotionEventProperties = { + promotion_id: 'courseware_verified_certificate_upsell', + creative: $(button).data('creative'), + name: 'In-Course Verification Prompt', + position: $(button).data('position'), + }; + CourseHome.fireSegmentEvent('Promotion Viewed', promotionEventProperties); + $(button).click(() => { + CourseHome.fireSegmentEvent('Promotion Clicked', promotionEventProperties); + }); + }, + ); + } + /** * Persists the collapsed state of the upgrade message. If the message is collapsed, * this information is persisted to local storage. Expanding the message *removes* the @@ -75,14 +95,7 @@ export class CourseHome { // eslint-disable-line import/prefer-default-export const $vcMessage = $('.vc-message'); const $vcDismissToggle = $('.vc-toggle', $vcMessage); const logEventProperties = { courseRunKey: this.courseRunKey }; - const promotionEventProperties = { - promotion_id: 'courseware_verified_certificate_upsell', - creative: 'hero_matthew_smith', - name: 'In-Course Verification Prompt', - position: 'hero', - }; - CourseHome.fireSegmentEvent('Promotion Viewed', promotionEventProperties); Logger.log('edx.course.upgrade.hero.displayed', logEventProperties); // Get height of container and button @@ -130,7 +143,6 @@ export class CourseHome { // eslint-disable-line import/prefer-default-export }); $('.btn-upgrade', $vcMessage).click(() => { - CourseHome.fireSegmentEvent('Promotion Clicked', promotionEventProperties); Logger.log('edx.course.upgrade.hero.clicked', logEventProperties); }); } diff --git a/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js b/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js index 298e552be2..c31eb474c0 100644 --- a/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js +++ b/openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js @@ -50,7 +50,7 @@ describe('Course Home factory', () => { describe('Upgrade message events', () => { const segmentEventProperties = { promotion_id: 'courseware_verified_certificate_upsell', - creative: 'hero_matthew_smith', + creative: 'original_hero', name: 'In-Course Verification Prompt', position: 'hero', }; diff --git a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html index 7f5cfd550f..96686a2b01 100644 --- a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html +++ b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html @@ -82,7 +82,10 @@ from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG, SHOW_REV
- ${_("Upgrade ({price})").format(price=upgrade_price)} + ${_("Upgrade ({price})").format(price=upgrade_price)}
diff --git a/openedx/features/course_experience/templates/course_experience/course-sock-fragment.html b/openedx/features/course_experience/templates/course_experience/course-sock-fragment.html index 7deac01524..6e881dd8b4 100644 --- a/openedx/features/course_experience/templates/course_experience/course-sock-fragment.html +++ b/openedx/features/course_experience/templates/course_experience/course-sock-fragment.html @@ -56,7 +56,7 @@ from openedx.features.course_experience import DISPLAY_COURSE_SOCK_FLAG -