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/LocalNotification.swift b/WooCommerce/Classes/Notifications/LocalNotification.swift index 941f769f0b6..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)" } @@ -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" } } diff --git a/WooCommerce/Classes/Notifications/PushNotificationsManager.swift b/WooCommerce/Classes/Notifications/PushNotificationsManager.swift index c4bfdbcf02a..bf52c038e32 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] } }