Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
9 changes: 4 additions & 5 deletions WooCommerce/Classes/Notifications/LocalNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
Expand Down Expand Up @@ -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"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
Expand Down