Skip to content

Commit aa13c34

Browse files
committed
Only track pushNotificationAlertPressed when the app is in inactive state. Also track the app state for pushNotificationReceived.
1 parent 35f82b0 commit aa13c34

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

WooCommerce/Classes/Notifications/PushNotificationsManager.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,13 @@ private extension PushNotificationsManager {
524524
properties[AnalyticKey.fromSelectedSite] = siteID == notificationSiteID
525525
}
526526

527-
let event: WooAnalyticsStat = (applicationState == .background) ? .pushNotificationReceived : .pushNotificationAlertPressed
528-
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+
}
529534
}
530535
}
531536

@@ -605,6 +610,7 @@ private enum AnalyticKey {
605610
static let type = "push_notification_type"
606611
static let token = "push_notification_token"
607612
static let fromSelectedSite = "is_from_selected_site"
613+
static let appState = "app_state"
608614
}
609615

610616
private enum PushType {

0 commit comments

Comments
 (0)