Add support for UserProperties to analytics and capture FTUE use case selection.

Additionally update taps to interactions following updates in the analytics event repo.
This commit is contained in:
Doug
2022-02-15 17:54:17 +00:00
parent cdfa801bc7
commit e5bbfa9a30
8 changed files with 111 additions and 22 deletions
@@ -35,8 +35,9 @@ class PostHogAnalyticsClient: AnalyticsClientProtocol {
postHog?.enable()
}
func identify(id: String) {
postHog?.identify(id)
func identify(id: String, userProperties: AnalyticsEvent.UserProperties) {
// As user properties overwrite old ones, compactMap the dictionary to avoid resetting any missing properties
postHog?.identify(id, properties: userProperties.properties.compactMapValues { $0 })
}
func reset() {
@@ -62,4 +63,8 @@ class PostHogAnalyticsClient: AnalyticsClientProtocol {
postHog?.screen(event.screenName.rawValue, properties: event.properties)
}
func updateUserProperties(_ userProperties: AnalyticsEvent.UserProperties) {
// As user properties overwrite old ones via $set, compactMap the dictionary to avoid resetting any missing properties
postHog?.capture("$identify", properties: ["$set": userProperties.properties.compactMapValues { $0 }])
}
}