@@ -573,6 +573,7 @@ extension WooAnalyticsEvent {
573573
574574 enum Keys {
575575 static let batteryLevel = " battery_level "
576+ static let cardReaderModel = " card_reader_model "
576577 static let countryCode = " country "
577578 static let gatewayID = " plugin_slug "
578579 static let errorDescription = " error_description "
@@ -609,9 +610,14 @@ extension WooAnalyticsEvent {
609610 /// - forGatewayID: the plugin (e.g. "woocommerce-payments" or "woocommerce-gateway-stripe") to be included in the event properties in Tracks.
610611 /// - batteryLevel: the battery level (if available) to be included in the event properties in Tracks, e.g. 0.75 = 75%.
611612 /// - countryCode: the country code of the store.
613+ /// - cardReaderModel: the model type of the card reader.
612614 ///
613- static func cardReaderConnectionSuccess( forGatewayID: String ? , batteryLevel: Float ? , countryCode: String ) -> WooAnalyticsEvent {
615+ static func cardReaderConnectionSuccess( forGatewayID: String ? ,
616+ batteryLevel: Float ? ,
617+ countryCode: String ,
618+ cardReaderModel: String ) -> WooAnalyticsEvent {
614619 var properties = [
620+ Keys . cardReaderModel: cardReaderModel,
615621 Keys . countryCode: countryCode,
616622 Keys . gatewayID: gatewayID ( forGatewayID: forGatewayID)
617623 ]
@@ -629,10 +635,12 @@ extension WooAnalyticsEvent {
629635 /// - forGatewayID: the plugin (e.g. "woocommerce-payments" or "woocommerce-gateway-stripe") to be included in the event properties in Tracks.
630636 /// - error: the error to be included in the event properties.
631637 /// - countryCode: the country code of the store.
638+ /// - cardReaderModel: the model type of the card reader.
632639 ///
633- static func cardReaderConnectionFailed( forGatewayID: String ? , error: Error , countryCode: String ) -> WooAnalyticsEvent {
640+ static func cardReaderConnectionFailed( forGatewayID: String ? , error: Error , countryCode: String , cardReaderModel : String ) -> WooAnalyticsEvent {
634641 WooAnalyticsEvent ( statName: . cardReaderConnectionFailed,
635642 properties: [
643+ Keys . cardReaderModel: cardReaderModel,
636644 Keys . countryCode: countryCode,
637645 Keys . gatewayID: gatewayID ( forGatewayID: forGatewayID) ,
638646 Keys . errorDescription: error. localizedDescription
@@ -646,10 +654,12 @@ extension WooAnalyticsEvent {
646654 /// - Parameters:
647655 /// - forGatewayID: the plugin (e.g. "woocommerce-payments" or "woocommerce-gateway-stripe") to be included in the event properties in Tracks.
648656 /// - countryCode: the country code of the store.
657+ /// - cardReaderModel: the model type of the card reader.
649658 ///
650- static func cardReaderDisconnectTapped( forGatewayID: String ? , countryCode: String ) -> WooAnalyticsEvent {
659+ static func cardReaderDisconnectTapped( forGatewayID: String ? , countryCode: String , cardReaderModel : String ) -> WooAnalyticsEvent {
651660 WooAnalyticsEvent ( statName: . cardReaderDisconnectTapped,
652661 properties: [
662+ Keys . cardReaderModel: cardReaderModel,
653663 Keys . countryCode: countryCode,
654664 Keys . gatewayID: gatewayID ( forGatewayID: forGatewayID)
655665 ]
@@ -769,14 +779,15 @@ extension WooAnalyticsEvent {
769779 /// - Parameters:
770780 /// - forGatewayID: the plugin (e.g. "woocommerce-payments" or "woocommerce-gateway-stripe") to be included in the event properties in Tracks.
771781 /// - countryCode: the country code of the store.
782+ /// - cardReaderModel: the model type of the card reader.
772783 ///
773- static func collectPaymentTapped( forGatewayID: String ? , countryCode: String ) -> WooAnalyticsEvent {
784+ static func collectPaymentTapped( forGatewayID: String ? , countryCode: String , cardReaderModel : String ) -> WooAnalyticsEvent {
774785 WooAnalyticsEvent ( statName: . collectPaymentTapped,
775786 properties: [
787+ Keys . cardReaderModel: cardReaderModel,
776788 Keys . countryCode: countryCode,
777789 Keys . gatewayID: gatewayID ( forGatewayID: forGatewayID)
778- ]
779- )
790+ ] )
780791 }
781792
782793 /// Tracked when the payment collection fails
@@ -785,8 +796,9 @@ extension WooAnalyticsEvent {
785796 /// - forGatewayID: the plugin (e.g. "woocommerce-payments" or "woocommerce-gateway-stripe") to be included in the event properties in Tracks.
786797 /// - error: the error to be included in the event properties.
787798 /// - countryCode: the country code of the store.
799+ /// - cardReaderModel: the model type of the card reader, if available.
788800 ///
789- static func collectPaymentFailed( forGatewayID: String ? , error: Error , countryCode: String ) -> WooAnalyticsEvent {
801+ static func collectPaymentFailed( forGatewayID: String ? , error: Error , countryCode: String , cardReaderModel : String ? ) -> WooAnalyticsEvent {
790802 let paymentMethod : PaymentMethod ? = {
791803 guard case let CardReaderServiceError . paymentCaptureWithPaymentMethod( _, paymentMethod) = error else {
792804 return nil
@@ -813,6 +825,7 @@ extension WooAnalyticsEvent {
813825 }
814826 } ( )
815827 let properties : [ String : WooAnalyticsEventPropertyType ] = [
828+ Keys . cardReaderModel: cardReaderModel,
816829 Keys . countryCode: countryCode,
817830 Keys . gatewayID: gatewayID ( forGatewayID: forGatewayID) ,
818831 Keys . paymentMethodType: paymentMethod? . analyticsValue,
@@ -827,10 +840,12 @@ extension WooAnalyticsEvent {
827840 /// - Parameters:
828841 /// - forGatewayID: the plugin (e.g. "woocommerce-payments" or "woocommerce-gateway-stripe") to be included in the event properties in Tracks.
829842 /// - countryCode: the country code of the store.
843+ /// - cardReaderModel: the model type of the card reader.
830844 ///
831- static func collectPaymentCanceled( forGatewayID: String ? , countryCode: String ) -> WooAnalyticsEvent {
845+ static func collectPaymentCanceled( forGatewayID: String ? , countryCode: String , cardReaderModel : String ) -> WooAnalyticsEvent {
832846 WooAnalyticsEvent ( statName: . collectPaymentCanceled,
833847 properties: [
848+ Keys . cardReaderModel: cardReaderModel,
834849 Keys . countryCode: countryCode,
835850 Keys . gatewayID: gatewayID ( forGatewayID: forGatewayID)
836851 ]
@@ -843,10 +858,15 @@ extension WooAnalyticsEvent {
843858 /// - forGatewayID: the plugin (e.g. "woocommerce-payments" or "woocommerce-gateway-stripe") to be included in the event properties in Tracks.
844859 /// - countryCode: the country code of the store.
845860 /// - paymentMethod: the payment method of the captured payment.
861+ /// - cardReaderModel: the model type of the card reader.
846862 ///
847- static func collectPaymentSuccess( forGatewayID: String ? , countryCode: String , paymentMethod: PaymentMethod ) -> WooAnalyticsEvent {
863+ static func collectPaymentSuccess( forGatewayID: String ? ,
864+ countryCode: String ,
865+ paymentMethod: PaymentMethod ,
866+ cardReaderModel: String ) -> WooAnalyticsEvent {
848867 WooAnalyticsEvent ( statName: . collectPaymentSuccess,
849868 properties: [
869+ Keys . cardReaderModel: cardReaderModel,
850870 Keys . countryCode: countryCode,
851871 Keys . gatewayID: gatewayID ( forGatewayID: forGatewayID) ,
852872 Keys . paymentMethodType: paymentMethod. analyticsValue
0 commit comments