Skip to content

Comments

support $set and $set_once properties#5

Open
myrlund wants to merge 2 commits intoSamHoque:mainfrom
takex3:main
Open

support $set and $set_once properties#5
myrlund wants to merge 2 commits intoSamHoque:mainfrom
takex3:main

Conversation

@myrlund
Copy link

@myrlund myrlund commented Feb 3, 2026

Convex does not allow passing $ prefixed args, so custom properties seem like the best way to pass person properties on to Posthog.

Summary by CodeRabbit

  • New Features
    • Event tracking now supports optional "set" and "set once" properties that are merged into tracked event payloads when provided, allowing callers to update or initialize user/event properties alongside standard event data.

@coderabbitai
Copy link

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The change adds two optional fields—setProperties and setOnceProperties—to event-tracking APIs and wires them through: the component trackEvent action now conditionally merges these into the outgoing payload as $set and $set_once, and the client API (PostHogComponent / trackUserEvent) accepts and forwards the same fields.

Changes

Cohort / File(s) Summary
Component action
src/component/lib.ts
Added optional setProperties and setOnceProperties arguments to the exported trackEvent action; when provided, merged into the event payload as $set and $set_once.
Client API surface
src/client/index.ts
Extended PostHogComponent.trackEvent argument types and PostHog.trackUserEvent data shape to accept setProperties?: Record<string, unknown> and setOnceProperties?: Record<string, unknown> and forwarded them to the underlying track call.

Sequence Diagram(s)

sequenceDiagram
  participant UI as UI Component
  participant Comp as src/component/lib.ts
  participant Client as src/client/index.ts
  participant Backend as PostHog SDK / Server

  UI->>Comp: call trackEvent(eventName, properties, setProperties?, setOnceProperties?)
  Comp->>Client: invoke PostHogComponent.trackEvent(..., setProperties?, setOnceProperties?)
  Client->>Backend: build payload (properties + $set?, $set_once?) and send trackUserEvent
  Backend-->>Client: ack
  Client-->>Comp: result
  Comp-->>UI: complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code where events are sown,

set and set_once now join the tone,
Optional carrots, tucked in the payload,
Analytics bloom along the road,
A small rabbit cheer for data grown! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'support $set and $set_once properties' accurately and concisely describes the main change: adding support for $set and $set_once properties to the trackEvent API by mapping them through optional arguments (setProperties and setOnceProperties).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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