Skip to content

Commit

Permalink
Add properties to parameters to the screen event (#21)
Browse files Browse the repository at this point in the history
* Add properties to parameters to the screen event

* Merging parameters with existing

---------

Co-authored-by: Piotr Bruź <[email protected]>
  • Loading branch information
pbruz-grx and Piotr Bruź authored Nov 30, 2023
1 parent 2b91b8d commit b6ca94d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/SegmentFirebase/FirebaseDestination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ public class FirebaseDestination: DestinationPlugin {
if let eventName = event.name {
var parameters: [String: Any] = [FirebaseAnalytics.AnalyticsParameterScreenName: eventName]

if let properties = event.properties?.dictionaryValue {
let propertiesParameters = returnMappedFirebaseParameters(properties, for: FirebaseDestination.mappedKeys)
parameters = parameters.merging(propertiesParameters) { (current, _) in current }
}

if let campaign = event.context?.dictionaryValue?["campaign"] as? [String: Any] {
let campaignParameters = returnMappedFirebaseParameters(campaign, for: FirebaseDestination.campaignMappedKeys)
parameters = parameters.merging(campaignParameters) { (current, _) in current }
Expand Down

0 comments on commit b6ca94d

Please sign in to comment.