Documentation
¶
Overview ¶
Package alias joins anonymous pre-login activity to the logged-in user — identity stitching. The SDK sends the anonymous id as a breadcrumb on identify(); we record anon→canonical here, and a Store decorator rewrites ids at read time so funnels, retention, and journeys survive the login boundary. GDPR erasure fans out across a user's aliases, so "delete user u123" also erases their pre-login trail.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecordFrom ¶ added in v0.9.0
RecordFrom records an identity edge from an identity event, so the HTTP ingest path and the import path stitch the same way and can never drift. It understands both conventions PostHog (and our own SDK) emit:
- $identify: the logged-in event carries the visitor's prior anonymous id in $anon_distinct_id → Add(anon, user).
- $create_alias: merges a second id into the person, carried in the alias property → Add(alias, user). PostHog uses this for its own person merges, so importing a PostHog export with these events reconstructs its stitched identities instead of splitting one human into two "users" (which silently corrupts retention/funnels).
Any other event is ignored. A nil map is a no-op so callers needn't guard.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func (*Map) Add ¶
Add records anon→canonical. Guards: the shared cookieless sentinel, empty ids, self-aliases, and canonical ids that are themselves aliased (one hop only — a chain would make resolution order-dependent).
type Store ¶
Store decorates a store.Store with read-time canonicalization: every event comes back under its canonical id, so the engine computes joined journeys without the storage layer knowing aliases exist.
func (*Store) DeleteUser ¶
DeleteUser erases the canonical id AND every alias pointing at it — the GDPR request must take the pre-login trail with it — then forgets the aliases.