Skip to content

feat(analytics): add setPersonProperties to the facade - #83

Merged
rahul-sinha1908 merged 1 commit into
devfrom
feature/funnel-analytics-events
Oct 28, 2026
Merged

rahul-sinha1908 merged 1 commit into
devfrom
feature/funnel-analytics-events

Conversation

@rahul-sinha1908

Copy link
Copy Markdown
Contributor

Part 2 of 5. Depends on idivarts/shared-constants#11 (the two new types) — merge that first.

What

One optional sink method and one exported function:

setPersonProperties(props: AnalyticsPersonProperties, once?: AnalyticsPersonPropertiesOnce)

Why it is separate from setContext

The two answer different questions and neither substitutes for the other:

  • super properties (setContext) belong to the event — "what plan was this event fired on". That is what a funnel reads.
  • person properties are what a vendor can filter and cohort people by. PostHog cannot cohort by a super property, so retention-by-plan and "free users who hit a wall three times" are unbuildable without this.

Why once is a separate argument

plan_key_first, became_paid_at and first_brand_name must survive every later change. A plain set would overwrite them on each upgrade and the acquisition cohort would shift underneath you. The interface doc tells a vendor without that distinction to write props and ignore once, rather than silently overwriting a first-ever value.

Coverage

Sinks with no notion of a person (Branch, Meta, Firebase) simply do not implement the method, so a caller never needs to know which vendors can take it. The PostHog sinks implement it in trendly-brands (PR 4 of 5) — web via posthog.setPersonProperties, native via a $set capture, since posthog-react-native has no equivalent API and identify() with properties can only $set.

🤖 Generated with Claude Code

Person properties are not super properties and neither substitutes for the
other: a super property belongs to the event and says what was true when it
fired, which is what a funnel reads, while only a person property lets a
vendor filter and cohort PEOPLE — which retention-by-plan and "free users who
hit a wall three times" need.

The sink method takes `once` separately so a vendor can honour $set_once.
plan_key_first and became_paid_at must survive every later upgrade; a plain
set would overwrite them each time and the cohort would shift underneath.

Sinks with no notion of a person (Branch, Meta, Firebase) simply do not
implement it, so a caller never has to know which vendors can take it.

Depends on idivarts/shared-constants#11 for the two new types.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant