Skip to content

Commit

Permalink
♻️ Update push handler event properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt authored and iujames committed Sep 17, 2024
1 parent 937c897 commit 30758ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
17 changes: 7 additions & 10 deletions Sources/AppcuesKit/Push/ParsedNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ internal struct ParsedNotification {
let accountID: String
let userID: String
let notificationID: String
let workflowID: String
let workflowTaskID: String
let transactionID: String
let workflowID: String?
let workflowTaskID: String?
let transactionID: String?
let deepLinkURL: URL?
let experienceID: String?
let attachmentURL: URL?
Expand All @@ -24,20 +24,17 @@ internal struct ParsedNotification {
init?(userInfo: [AnyHashable: Any]) {
guard let accountID = userInfo["appcues_account_id"] as? String,
let userID = userInfo["appcues_user_id"] as? String,
let notificationID = userInfo["appcues_notification_id"] as? String,
let workflowID = userInfo["appcues_workflow_id"] as? String,
let workflowTaskID = userInfo["appcues_workflow_task_id"] as? String,
let transactionID = userInfo["appcues_transaction_id"] as? String else {
let notificationID = userInfo["appcues_notification_id"] as? String else {
return nil
}

self.accountID = accountID
self.userID = userID
self.notificationID = notificationID
self.workflowID = workflowID
self.workflowTaskID = workflowTaskID
self.transactionID = transactionID

self.workflowID = userInfo["appcues_workflow_id"] as? String
self.workflowTaskID = userInfo["appcues_workflow_task_id"] as? String
self.transactionID = userInfo["appcues_transaction_id"] as? String
self.deepLinkURL = (userInfo["appcues_deep_link_url"] as? String)
.flatMap { URL(string: $0) }
self.experienceID = userInfo["appcues_experience_id"] as? String
Expand Down
8 changes: 6 additions & 2 deletions Sources/AppcuesKit/Push/PushMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ internal class PushMonitor: PushMonitoring {
analyticsPublisher.publish(TrackingUpdate(
type: .event(name: Events.Push.pushOpened.rawValue, interactive: false),
properties: [
"notification_id": parsedNotification.notificationID
],
"notification_id": parsedNotification.notificationID,
"workflow_id": parsedNotification.workflowID,
"workflow_task_id": parsedNotification.workflowTaskID,
"transaction_id": parsedNotification.transactionID,
"device_id": storage.deviceID
].compactMapValues { $0 },
isInternal: true
))

Expand Down

0 comments on commit 30758ff

Please sign in to comment.