From 5c61ea53d5136b2d1afda217a4537cf18495e960 Mon Sep 17 00:00:00 2001 From: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> Date: Wed, 7 Jan 2026 13:33:49 +0100 Subject: [PATCH] Include Stripe couponCode and promotionCode in analytics events (#29873) * Include valid couponCode and promotionCode in `payment-page-view` and `payment-page-form-submit` analytics events * Update payment event types * Remove obsolete comment * fix: only send validated coupon and promotion codes in analytics event * Add coupon name for the analytics events * Update test to include the coupon name for analytics * Remove coupon code from analytics * Simplify promotion code validation using coupon.code * Remove undefined * Allow access to promotion code * Remove `lastValidatedPromotionCode` and compare against coupon code from the preview response * Fix test setup to initialize coupon code * Keep the submit button enabled only when the coupon code is either empty or successfully validated by the backend * Update test coupon code value to TEST_COUPON GitOrigin-RevId: b12fa147d91fd3b90b59bc77868a0786ddb633b7 --- services/web/types/subscription/analytics-event.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/types/subscription/analytics-event.ts b/services/web/types/subscription/analytics-event.ts index 98ce12fdf1..9d13d48124 100644 --- a/services/web/types/subscription/analytics-event.ts +++ b/services/web/types/subscription/analytics-event.ts @@ -8,7 +8,6 @@ import { RecurlyPlanCode } from './plan' type PaymentPageFormSubmitEventBaseSegmentation = { currencyCode: CurrencyCode plan_code?: string - coupon_code: string isPaypal: boolean upgradeType: 'standalone' referrer?: string @@ -16,6 +15,8 @@ type PaymentPageFormSubmitEventBaseSegmentation = { type PaymentPageFormSubmitEventStripeSegmentation = PaymentPageFormSubmitEventBaseSegmentation & { + couponName?: string + promotionCode?: string payment_provider: StripePaymentProviderService stripe_price_id: string stripe_price_lookup_key: string @@ -23,6 +24,7 @@ type PaymentPageFormSubmitEventStripeSegmentation = type PaymentPageFormSubmitEventRecurlySegmentation = PaymentPageFormSubmitEventBaseSegmentation & { + coupon_code?: string payment_provider: Exclude< PaymentProvider['service'], 'stripe-us' | 'stripe-uk'