From fe8b613fabfcb4b1943da03e1ed3f489e55db2eb Mon Sep 17 00:00:00 2001 From: M Fahru Date: Wed, 4 Sep 2024 06:59:20 -0700 Subject: [PATCH] Merge pull request #20071 from overleaf/mf-plans-page-click-currency [web] Add currency segmentation to all of the `plans-page-click` events GitOrigin-RevId: d886e4e87817092b51f32733c01d7cc3f15115c8 --- services/web/app/views/subscriptions/plans/_mixins.pug | 10 +++++++--- .../app/views/subscriptions/plans/_university_info.pug | 2 +- .../subscriptions/plans/light-redesign/_table_ctas.pug | 6 ++++-- .../light-redesign/_table_short_feature_lists.pug | 3 ++- .../pages/user/subscription/plans-v2/plans-v2-main.js | 1 + 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/services/web/app/views/subscriptions/plans/_mixins.pug b/services/web/app/views/subscriptions/plans/_mixins.pug index b16bb4260f..2f5c67db4a 100644 --- a/services/web/app/views/subscriptions/plans/_mixins.pug +++ b/services/web/app/views/subscriptions/plans/_mixins.pug @@ -282,7 +282,9 @@ mixin table_head_group_total_per_year(groupPlan) ) !{translate("total_per_year_for_x_users", {licenseSize})} mixin table_head_group_organization(highlighted, eventTrackingKey, additionalEventSegmentation) - - var segmentation = JSON.stringify(Object.assign({}, {button: 'group_organization-link', location: 'table-header-list', period: 'annual'}, additionalEventSegmentation)) + - additionalEventSegmentation = additionalEventSegmentation || {} + - var segmentation = { ...additionalEventSegmentation, button: 'group_organization-link', location: 'table-header-list', period: 'annual', currency: recommendedCurrency } + .plans-v2-table-th-content p.plans-v2-table-th-content-title #{translate("organization")} .plans-v2-table-comments-icon @@ -537,7 +539,8 @@ mixin btn_buy_student_university(highlighted, eventTrackingKey, additionalEventS mixin additional_link_group(eventTrackingKey, additionalEventSegmentation, plan) - var buttonSegmentation = plan + '-link' - - var segmentation = JSON.stringify(Object.assign({}, {button: buttonSegmentation, location: 'table-header'}, additionalEventSegmentation)) + - additionalEventSegmentation = additionalEventSegmentation || {} + - var segmentation = { ...additionalEventSegmentation, button: buttonSegmentation, location: 'table-header', currency: recommendedCurrency } small.plans-v2-table-th-content-additional-link | #{translate("or")} a( @@ -551,7 +554,8 @@ mixin additional_link_group(eventTrackingKey, additionalEventSegmentation, plan) mixin additional_link_buy(eventTrackingKey, additionalEventSegmentation, plan, period) - var buttonSegmentation = plan + '-link' - - var segmentation = JSON.stringify(Object.assign({}, {button: buttonSegmentation, location: 'table-header', period}, additionalEventSegmentation)) + - additionalEventSegmentation = additionalEventSegmentation || {} + - var segmentation = { ...additionalEventSegmentation, button: buttonSegmentation, location: 'table-header', currency: recommendedCurrency } - var itmCampaign = itm_campaign ? { itm_campaign } : {itm_campaign: 'plans'} - var itmReferrer = itm_referrer ? { itm_referrer } : {} - var qs = new URLSearchParams({planCode: plan, currency: recommendedCurrency, itm_content: 'card', ...itmCampaign, ...itmReferrer}) diff --git a/services/web/app/views/subscriptions/plans/_university_info.pug b/services/web/app/views/subscriptions/plans/_university_info.pug index 72de57a64b..3d78b626ff 100644 --- a/services/web/app/views/subscriptions/plans/_university_info.pug +++ b/services/web/app/views/subscriptions/plans/_university_info.pug @@ -12,5 +12,5 @@ event-tracking="plans-page-click" event-tracking-mb="true" event-tracking-trigger="click" - event-segmentation='{"button": "university-support"}' + event-segmentation={button: "university-support", currency: recommendedCurrency} ) #{translate('show_your_support')} diff --git a/services/web/app/views/subscriptions/plans/light-redesign/_table_ctas.pug b/services/web/app/views/subscriptions/plans/light-redesign/_table_ctas.pug index 0deee3ea99..6331d33daf 100644 --- a/services/web/app/views/subscriptions/plans/light-redesign/_table_ctas.pug +++ b/services/web/app/views/subscriptions/plans/light-redesign/_table_ctas.pug @@ -95,7 +95,8 @@ mixin btn_buy_student_student(highlighted, eventTrackingKey, additionalEventSegm mixin additional_link_group(eventTrackingKey, additionalEventSegmentation, plan) - var buttonSegmentation = plan + '-link' - - var segmentation = JSON.stringify(Object.assign({}, {button: buttonSegmentation, location: 'table-header'}, additionalEventSegmentation)) + - additionalEventSegmentation = additionalEventSegmentation || {} + - var segmentation = { ...additionalEventSegmentation, button: buttonSegmentation, location: 'table-header' } a.btn.btn-bg-ghost( href="/for/contact-sales" @@ -108,7 +109,8 @@ mixin additional_link_group(eventTrackingKey, additionalEventSegmentation, plan) mixin additional_link_buy(eventTrackingKey, additionalEventSegmentation, plan, period) - var buttonSegmentation = plan + '-link' - - var segmentation = JSON.stringify(Object.assign({}, {button: buttonSegmentation, location: 'table-header', period}, additionalEventSegmentation)) + - additionalEventSegmentation = additionalEventSegmentation || {} + - var segmentation = { ...additionalEventSegmentation, button: buttonSegmentation, location: 'table-header', period } - var itmCampaign = itm_campaign ? { itm_campaign } : {itm_campaign: 'plans'} - var itmReferrer = itm_referrer ? { itm_referrer } : {} - var qs = new URLSearchParams({planCode: plan, currency: recommendedCurrency, itm_content: 'card', ...itmCampaign, ...itmReferrer}) diff --git a/services/web/app/views/subscriptions/plans/light-redesign/_table_short_feature_lists.pug b/services/web/app/views/subscriptions/plans/light-redesign/_table_short_feature_lists.pug index bb8eb46843..bdcce6f0e7 100644 --- a/services/web/app/views/subscriptions/plans/light-redesign/_table_short_feature_lists.pug +++ b/services/web/app/views/subscriptions/plans/light-redesign/_table_short_feature_lists.pug @@ -25,7 +25,8 @@ mixin table_short_feature_list_group_professional() +table_head_group_total_per_year('professional') mixin table_short_feature_list_group_organization(additionalEventSegmentation) - - var segmentation = JSON.stringify(Object.assign({}, {button: 'group_organization-link', location: 'table-header-list', period: 'annual'}, additionalEventSegmentation)) + - additionalEventSegmentation = additionalEventSegmentation || {} + - var segmentation = { ...additionalEventSegmentation, button: 'group_organization-link', location: 'table-header-list', period: 'annual', currency: recommendedCurrency} ul li #{translate("best_choices_companies_universities_non_profits")} li #{translate("for_groups_or_site_wide")} diff --git a/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-main.js b/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-main.js index 099bb279b1..503b64e603 100644 --- a/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-main.js +++ b/services/web/frontend/js/pages/user/subscription/plans-v2/plans-v2-main.js @@ -54,6 +54,7 @@ function setUpSubscriptionTracking(linkEl) { button: plan, location, 'billing-period': period, + currency: currentCurrencyCode, } eventTracking.sendMB(eventTrackingKey, eventTrackingSegmentation)