From 0eb338da1bfd5fb644e1b137e817cffe58931064 Mon Sep 17 00:00:00 2001 From: julianajlk Date: Fri, 8 Nov 2024 12:38:51 -0500 Subject: [PATCH 1/4] feat: Add Cohesion env variables to distinguish stage and prod --- .env | 2 ++ .env.development | 2 ++ .env.development-stage | 2 ++ .env.test | 2 ++ cohesion.config.js | 4 ++-- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 3b35f1590..3d1b12484 100644 --- a/.env +++ b/.env @@ -19,6 +19,8 @@ NEW_RELIC_LICENSE_KEY=null ORDER_HISTORY_URL=null REFRESH_ACCESS_TOKEN_ENDPOINT=null SEGMENT_KEY=null +COHESION_TAGULAR_WRITE_KEY=null +COHESION_TAGULAR_SOURCE_KEY=null SITE_NAME=null USER_INFO_COOKIE_NAME=null USER_LOCATION_COOKIE_NAME=null diff --git a/.env.development b/.env.development index a239c4371..10cc604d9 100644 --- a/.env.development +++ b/.env.development @@ -17,6 +17,8 @@ MARKETING_SITE_BASE_URL='http://localhost:18000' ORDER_HISTORY_URL=http://localhost:1996/orders REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh' SEGMENT_KEY='VMsX2obE9Xveo4se3c6CmfdG0LZVc7qI' +COHESION_TAGULAR_WRITE_KEY='wk_2nkzqlbOsxrS0UwzagXrVuHqQyy' +COHESION_TAGULAR_SOURCE_KEY='src_2nkzqlaM9p3iziS4RHRHuRecrX8' SITE_NAME='edX' USER_INFO_COOKIE_NAME='edx-user-info' USER_LOCATION_COOKIE_NAME='prod-edx-cf-loc' diff --git a/.env.development-stage b/.env.development-stage index 4e600db6a..8161b6f29 100644 --- a/.env.development-stage +++ b/.env.development-stage @@ -17,6 +17,8 @@ MARKETING_SITE_BASE_URL='/proxy/lms' ORDER_HISTORY_URL=http://localhost:1996/orders REFRESH_ACCESS_TOKEN_ENDPOINT='/proxy/lms/login_refresh' SEGMENT_KEY=null +COHESION_TAGULAR_WRITE_KEY='wk_2nkzqlbOsxrS0UwzagXrVuHqQyy' +COHESION_TAGULAR_SOURCE_KEY='src_2nkzqlaM9p3iziS4RHRHuRecrX8' SITE_NAME='edX' USER_INFO_COOKIE_NAME='npmstage-edx-user-info' USER_LOCATION_COOKIE_NAME='prod-edx-cf-loc' diff --git a/.env.test b/.env.test index eba51b57f..8ca2e2743 100644 --- a/.env.test +++ b/.env.test @@ -15,6 +15,8 @@ MARKETING_SITE_BASE_URL='http://localhost:18000' ORDER_HISTORY_URL=http://localhost:1996/orders REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh' SEGMENT_KEY=null +COHESION_TAGULAR_WRITE_KEY=null +COHESION_TAGULAR_SOURCE_KEY=null SITE_NAME='edX' USER_INFO_COOKIE_NAME='edx-user-info' USER_LOCATION_COOKIE_NAME='prod-edx-cf-loc' diff --git a/cohesion.config.js b/cohesion.config.js index 915773b15..c68169923 100644 --- a/cohesion.config.js +++ b/cohesion.config.js @@ -22,8 +22,8 @@ const cohesionConfig = { defaultCategory: '', defaultSubject: '', tagularApiKey: '', - tagularSourceKey: 'src_2euJfAVNt6Z9kQz4e9t1SQBtm8x', - tagularWriteKey: 'wk_2euJfDkJVTtEVzsC8BPOb0g9dVj', + tagularSourceKey: process.env.COHESION_TAGULAR_SOURCE_KEY, + tagularWriteKey: process.env.COHESION_TAGULAR_WRITE_KEY, tagularCookieDomain: 'edx.org', tagularDomainWhitelist: JSON.stringify([ 'edx.org', From 38be6ab9000e42ae81fd207f13f2dc9d426f192f Mon Sep 17 00:00:00 2001 From: julianajlk Date: Fri, 8 Nov 2024 12:48:04 -0500 Subject: [PATCH 2/4] fix: Remove taggy from Cohesion snippet --- public/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/public/index.html b/public/index.html index 369991021..40a6a1fce 100755 --- a/public/index.html +++ b/public/index.html @@ -40,7 +40,6 @@ domainWhitelist: <%= htmlWebpackPlugin?.options?.cohesionConfig?.tagularDomainWhitelist %>, apiVersion: 'v2/t', multiparty: true, - taggy: { enabled: true }, } }) From 64ff687d3f00d347ae8ecf74074718058dc08728 Mon Sep 17 00:00:00 2001 From: julianajlk Date: Fri, 8 Nov 2024 12:49:49 -0500 Subject: [PATCH 3/4] fix: Fix correlationId key on PayPal click event --- src/payment/data/actions.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/payment/data/actions.js b/src/payment/data/actions.js index 5a4100b2f..c0c4f4481 100644 --- a/src/payment/data/actions.js +++ b/src/payment/data/actions.js @@ -81,13 +81,12 @@ export const TRACK_PAYMENT_BUTTON_CLICK = 'TRACK_PAYMENT_BUTTON_CLICK'; export const trackPaymentButtonClick = tagularElement => { // Ideally this would happen in a middleware saga for separation of concerns // but due to deadlines/payment MFE will go away, adding a call here. - // Note: Click events on the PayPal button and Place Order button differ in the type of event data it's treated as. + // Note: Click events on the PayPal button and Place Order button differ in the type of event data, + // and correlation vs. correlationId sent. let payload; if (tagularElement.name === 'paypal') { payload = { - correlation: { - id: getCorrelationID(), - }, + correlationId: getCorrelationID(), webElement: tagularElement, }; tagularEvent('ElementClicked', payload); From ec9d66005ed543a88a882b631be782dab2547e55 Mon Sep 17 00:00:00 2001 From: julianajlk Date: Fri, 8 Nov 2024 16:15:59 -0500 Subject: [PATCH 4/4] fix: ConversionTracked had an option that is not available in the schema --- src/payment/data/sagas.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/payment/data/sagas.js b/src/payment/data/sagas.js index a85c86113..3bd0b9e3d 100644 --- a/src/payment/data/sagas.js +++ b/src/payment/data/sagas.js @@ -239,9 +239,7 @@ export function* handleSubmitPayment({ payload }) { // RV tracking for successful Stripe Payment if (method === 'stripe') { // Metada for conversion_category and conversion_action: - // Sucessful payment = 'Order' and 'Completed' - // Failed payment = 'Enrollment' and 'Declined' - tagularElement.category = 'Order'; + tagularElement.category = 'Enrollment'; tagularElement.action = 'Completed'; yield put(trackPaymentButtonClick(tagularElement)); } @@ -255,7 +253,7 @@ export function* handleSubmitPayment({ payload }) { } else { // RV tracking for failed Stripe Payment if (method === 'stripe') { - tagularElement.category = 'Enrollment'; + tagularElement.category = 'Cart'; tagularElement.action = 'Declined'; yield put(trackPaymentButtonClick(tagularElement)); }