From 5165a8c7139eacae92af12de56064389d34740e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Bru=C5=BA?= Date: Thu, 30 Nov 2023 09:05:11 +0100 Subject: [PATCH 1/2] Add properties to parameters to the screen event --- Sources/SegmentFirebase/FirebaseDestination.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/SegmentFirebase/FirebaseDestination.swift b/Sources/SegmentFirebase/FirebaseDestination.swift index dc5ce08..56a0024 100644 --- a/Sources/SegmentFirebase/FirebaseDestination.swift +++ b/Sources/SegmentFirebase/FirebaseDestination.swift @@ -118,6 +118,10 @@ public class FirebaseDestination: DestinationPlugin { if let eventName = event.name { var parameters: [String: Any] = [FirebaseAnalytics.AnalyticsParameterScreenName: eventName] + if let properties = event.properties?.dictionaryValue { + parameters = returnMappedFirebaseParameters(properties, for: FirebaseDestination.mappedKeys) + } + if let campaign = event.context?.dictionaryValue?["campaign"] as? [String: Any] { let campaignParameters = returnMappedFirebaseParameters(campaign, for: FirebaseDestination.campaignMappedKeys) parameters = parameters.merging(campaignParameters) { (current, _) in current } From eecf63fad4e3407f638608eae0427ef0045f3f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Bru=C5=BA?= Date: Thu, 30 Nov 2023 17:54:53 +0100 Subject: [PATCH 2/2] Merging parameters with existing --- Sources/SegmentFirebase/FirebaseDestination.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/SegmentFirebase/FirebaseDestination.swift b/Sources/SegmentFirebase/FirebaseDestination.swift index 56a0024..780c18f 100644 --- a/Sources/SegmentFirebase/FirebaseDestination.swift +++ b/Sources/SegmentFirebase/FirebaseDestination.swift @@ -119,7 +119,8 @@ public class FirebaseDestination: DestinationPlugin { var parameters: [String: Any] = [FirebaseAnalytics.AnalyticsParameterScreenName: eventName] if let properties = event.properties?.dictionaryValue { - parameters = returnMappedFirebaseParameters(properties, for: FirebaseDestination.mappedKeys) + let propertiesParameters = returnMappedFirebaseParameters(properties, for: FirebaseDestination.mappedKeys) + parameters = parameters.merging(propertiesParameters) { (current, _) in current } } if let campaign = event.context?.dictionaryValue?["campaign"] as? [String: Any] {