File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
WooCommerce/Classes/ViewRelated/Coupons/Add and Edit Coupons Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ final class AddEditCouponViewModel: ObservableObject {
267267 }
268268
269269 private func createCoupon( coupon: Coupon ) {
270- ServiceLocator . analytics . track ( . couponCreationInitiated )
270+ trackCouponCreateInitiated ( with : coupon )
271271
272272 if let validationError = validateCouponLocally ( coupon) {
273273 notice = NoticeFactory . createCouponErrorNotice ( validationError,
@@ -459,6 +459,16 @@ private extension AddEditCouponViewModel {
459459 return coupon. freeShipping != initialCoupon. freeShipping
460460 }
461461
462+ func trackCouponCreateInitiated( with coupon: Coupon ) {
463+ ServiceLocator . analytics. track ( . couponCreationInitiated, withProperties: [
464+ " discount_type " : coupon. discountType,
465+ " has_expiry_date " : coupon. dateExpires != nil ,
466+ " includes_free_shipping " : coupon. freeShipping,
467+ " has_product_or_category_restrictions " : coupon. excludedProductCategories. isNotEmpty || coupon. excludedProductIds. isNotEmpty,
468+ " has_usage_restrictions " : coupon. usageLimit != nil && coupon. usageLimit > 0
469+ ] )
470+ }
471+
462472 func trackCouponUpdateInitiated( with coupon: Coupon ) {
463473 ServiceLocator . analytics. track ( . couponUpdateInitiated, withProperties: [
464474 " discount_type_updated " : checkDiscountTypeUpdated ( for: coupon) ,
You can’t perform that action at this time.
0 commit comments