@@ -29,7 +29,7 @@ final class PushNotificationsManager: PushNotesManager {
2929 /// in the foreground.
3030 ///
3131 var foregroundNotificationsToView : AnyPublisher < PushNotification , Never > {
32- foregroundNotificationsSubject . eraseToAnyPublisher ( )
32+ foregroundNotificationsToViewSubject . eraseToAnyPublisher ( )
3333 }
3434
3535 /// Mutable reference to `foregroundNotificationsToView`.
@@ -371,6 +371,7 @@ private extension PushNotificationsManager {
371371 guard let self = self else { return }
372372 self . presentDetails ( for: foregroundNotification)
373373 self . foregroundNotificationsToViewSubject. send ( foregroundNotification)
374+ ServiceLocator . analytics. track ( . viewInAppPushNotificationPressed, withProperties: [ AnalyticKey . type: foregroundNotification. kind. rawValue] )
374375 }
375376
376377 foregroundNotificationsSubject. send ( foregroundNotification)
@@ -523,8 +524,13 @@ private extension PushNotificationsManager {
523524 properties [ AnalyticKey . fromSelectedSite] = siteID == notificationSiteID
524525 }
525526
526- let event : WooAnalyticsStat = ( applicationState == . background) ? . pushNotificationReceived : . pushNotificationAlertPressed
527- ServiceLocator . analytics. track ( event, withProperties: properties)
527+ switch applicationState {
528+ case . inactive:
529+ ServiceLocator . analytics. track ( . pushNotificationAlertPressed, withProperties: properties)
530+ default :
531+ properties [ AnalyticKey . appState] = applicationState. rawValue
532+ ServiceLocator . analytics. track ( . pushNotificationReceived, withProperties: properties)
533+ }
528534 }
529535}
530536
@@ -604,6 +610,7 @@ private enum AnalyticKey {
604610 static let type = " push_notification_type "
605611 static let token = " push_notification_token "
606612 static let fromSelectedSite = " is_from_selected_site "
613+ static let appState = " app_state "
607614}
608615
609616private enum PushType {
0 commit comments