Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/alias-distinct-id-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"posthog": patch
---

fix: include `distinct_id` alongside `alias` in `$create_alias` event properties
3 changes: 3 additions & 0 deletions posthog/src/main/java/com/posthog/PostHog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,9 @@ public class PostHog private constructor(

val props = mutableMapOf<String, Any>()
props["alias"] = alias
// The source identity is also duplicated into the properties so consumers that only
// read the event properties can resolve both sides of the alias linkage.
props["distinct_id"] = distinctId

capture(PostHogEventName.CREATE_ALIAS.event, properties = props)
}
Expand Down
1 change: 1 addition & 0 deletions posthog/src/test/java/com/posthog/PostHogTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,7 @@ internal class PostHogTest {
assertEquals("\$create_alias", theEvent.event)
assertNotNull(theEvent.distinctId)
assertEquals("theAlias", theEvent.properties!!["alias"] as String)
assertEquals(theEvent.distinctId, theEvent.properties!!["distinct_id"] as String)

sut.close()
}
Expand Down
Loading