From 221551445f473b45c7a2abdf9ef55d5bfad25fa5 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 16 Oct 2025 13:27:14 +0700 Subject: [PATCH 1/4] update test pos surveys to real ones --- WooCommerce/Classes/Notifications/LocalNotification.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/WooCommerce/Classes/Notifications/LocalNotification.swift b/WooCommerce/Classes/Notifications/LocalNotification.swift index 941f769f0b6..8ac9fcd015f 100644 --- a/WooCommerce/Classes/Notifications/LocalNotification.swift +++ b/WooCommerce/Classes/Notifications/LocalNotification.swift @@ -72,10 +72,9 @@ struct LocalNotification { static let surveyURL = "surveyURL" } - // periphery:ignore - real survey links to be added in WOOMOB-1497 enum SurveyURL { - static let pointOfSalePotentialMerchant = "https://automattic.survey.fm/woo-app-general-feedback-test-survey" - static let pointOfSaleCurrentMerchant = "https://automattic.survey.fm/woo-app-general-feedback-test-survey" + static let pointOfSalePotentialMerchant = "https://automattic.survey.fm/pos-survey-potential-users" + static let pointOfSaleCurrentMerchant = "https://automattic.survey.fm/pos-survey-existing-users" } } From ce12416cf9f68f86c7ce78bfa7dc5e5082c20d99 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 16 Oct 2025 13:51:35 +0700 Subject: [PATCH 2/4] update survey identifiers --- WooCommerce/Classes/Notifications/LocalNotification.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WooCommerce/Classes/Notifications/LocalNotification.swift b/WooCommerce/Classes/Notifications/LocalNotification.swift index 8ac9fcd015f..7e4447a4113 100644 --- a/WooCommerce/Classes/Notifications/LocalNotification.swift +++ b/WooCommerce/Classes/Notifications/LocalNotification.swift @@ -35,9 +35,9 @@ struct LocalNotification { case .productImageBackgroundUpload: return "product_image_background_upload" case .pointOfSalePotentialMerchant: - return "point_of_sale_potential_merchant" + return "woo_pos_survey_potential_user_survey" case .pointOfSaleCurrentMerchant: - return "point_of_sale_current_merchant" + return "woo_pos_survey_current_user_survey" case let .unknown(siteID): return "unknown_" + "\(siteID)" } From e555fad9a7d74ba7a7abe252bb51be385852a93d Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 16 Oct 2025 13:59:22 +0700 Subject: [PATCH 3/4] add local_notification_displayed case --- .../WooFoundationCore/Analytics/WooAnalyticsStat.swift | 1 + .../Analytics/WooAnalyticsEvent+LocalNotification.swift | 5 +++++ .../Classes/Notifications/PushNotificationsManager.swift | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Modules/Sources/WooFoundationCore/Analytics/WooAnalyticsStat.swift b/Modules/Sources/WooFoundationCore/Analytics/WooAnalyticsStat.swift index a3861574146..d446839a965 100644 --- a/Modules/Sources/WooFoundationCore/Analytics/WooAnalyticsStat.swift +++ b/Modules/Sources/WooFoundationCore/Analytics/WooAnalyticsStat.swift @@ -115,6 +115,7 @@ public enum WooAnalyticsStat: String { case localNotificationTapped = "local_notification_tapped" case localNotificationDismissed = "local_notification_dismissed" case localNotificationScheduled = "local_notification_scheduled" + case localNotificationDisplayed = "local_notification_displayed" case localNotificationCanceled = "local_notification_canceled" // MARK: Dashboard View Events diff --git a/WooCommerce/Classes/Analytics/WooAnalyticsEvent+LocalNotification.swift b/WooCommerce/Classes/Analytics/WooAnalyticsEvent+LocalNotification.swift index ff346554e66..fa2873bd696 100644 --- a/WooCommerce/Classes/Analytics/WooAnalyticsEvent+LocalNotification.swift +++ b/WooCommerce/Classes/Analytics/WooAnalyticsEvent+LocalNotification.swift @@ -23,6 +23,11 @@ extension WooAnalyticsEvent { properties: getTracksProperties(type: type, userInfo: userInfo)) } + static func displayed(type: String, userInfo: [AnyHashable: Any]) -> WooAnalyticsEvent { + WooAnalyticsEvent(statName: .localNotificationDisplayed, + properties: getTracksProperties(type: type, userInfo: userInfo)) + } + static func canceled(type: String, userInfo: [AnyHashable: Any]) -> WooAnalyticsEvent { WooAnalyticsEvent(statName: .localNotificationCanceled, properties: getTracksProperties(type: type, userInfo: userInfo)) diff --git a/WooCommerce/Classes/Notifications/PushNotificationsManager.swift b/WooCommerce/Classes/Notifications/PushNotificationsManager.swift index c4bfdbcf02a..9e52e7ed798 100644 --- a/WooCommerce/Classes/Notifications/PushNotificationsManager.swift +++ b/WooCommerce/Classes/Notifications/PushNotificationsManager.swift @@ -264,6 +264,9 @@ extension PushNotificationsManager { // Check if this is a local notification if !content.isRemoteNotification { // Display local notifications with banner and sound when app is in foreground + let identifier = notification.request.identifier + analytics.track(event: .LocalNotification.displayed(type: LocalNotification.Scenario.identifierForAnalytics(identifier), + userInfo: content.userInfo)) return [.banner, .sound, .list] } } @@ -284,7 +287,7 @@ extension PushNotificationsManager { guard let self = self else { return } self.presentDetails(for: foregroundNotification) self.foregroundNotificationsToViewSubject.send(foregroundNotification) - self.analytics.track(.viewInAppPushNotificationPressed, + self.analytics.track(.viewInAppPushNotificationPressed, // withProperties: [AnalyticKey.type: foregroundNotification.kind.rawValue]) } From e985bdfd918716a6115a66b5b12164d76625d34d Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Thu, 16 Oct 2025 14:09:13 +0700 Subject: [PATCH 4/4] cleanup --- .../Classes/Notifications/PushNotificationsManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WooCommerce/Classes/Notifications/PushNotificationsManager.swift b/WooCommerce/Classes/Notifications/PushNotificationsManager.swift index 9e52e7ed798..bf52c038e32 100644 --- a/WooCommerce/Classes/Notifications/PushNotificationsManager.swift +++ b/WooCommerce/Classes/Notifications/PushNotificationsManager.swift @@ -287,7 +287,7 @@ extension PushNotificationsManager { guard let self = self else { return } self.presentDetails(for: foregroundNotification) self.foregroundNotificationsToViewSubject.send(foregroundNotification) - self.analytics.track(.viewInAppPushNotificationPressed, // + self.analytics.track(.viewInAppPushNotificationPressed, withProperties: [AnalyticKey.type: foregroundNotification.kind.rawValue]) }