Explorar o código

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
M Fahru %!s(int64=2) %!d(string=hai) anos
pai
achega
fe8b613fab

+ 7 - 3
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})

+ 1 - 1
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')}

+ 4 - 2
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})

+ 2 - 1
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")}

+ 1 - 0
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)