filtering null values from the identify properties
- resetting values to null may cause inconsistent cross device tracking
This commit is contained in:
parent
63a937c096
commit
48b339075b
|
@ -176,7 +176,7 @@ class DefaultVectorAnalytics @Inject constructor(
|
|||
}
|
||||
|
||||
override fun updateUserProperties(identity: Identity) {
|
||||
posthog?.identify(REUSE_EXISTING_ID, identity.getProperties().toPostHogProperties(), IGNORED_OPTIONS)
|
||||
posthog?.identify(REUSE_EXISTING_ID, identity.getProperties()?.toPostHogUserProperties(), IGNORED_OPTIONS)
|
||||
}
|
||||
|
||||
private fun Map<String, Any?>?.toPostHogProperties(): Properties? {
|
||||
|
@ -186,4 +186,14 @@ class DefaultVectorAnalytics @Inject constructor(
|
|||
putAll(this@toPostHogProperties)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We avoid sending nulls as part of the UserProperties as this will reset the values across all devices
|
||||
* The Identify event has nullable properties to allow for clients to opt in
|
||||
*/
|
||||
private fun Map<String, Any?>.toPostHogUserProperties(): Properties {
|
||||
return Properties().apply {
|
||||
putAll(this@toPostHogUserProperties.filter { it.value != null })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue