feat(mobile): stamp inbox_client=mobile on inbox analytics events (port #3059)#3086
Merged
Merged
Conversation
#3059) Ports desktop PR #3059 to the mobile app: stamp a client discriminator `inbox_client="mobile"` on the inbox-family analytics events so the shared PostHog project can be sliced by surface. The mobile analytics wrapper (`useAnalytics().track`) now spreads `{ inbox_client: "mobile", ...properties }` for events in the mobile inbox set (Inbox viewed / report opened / closed / scrolled / action), with the client value first so an explicit override wins. Non-inbox events are unchanged. Mobile keeps its own event set rather than importing the shared helper, mirroring how it already owns its `ANALYTICS_EVENTS` map. Generated-By: PostHog Code Task-Id: 03d5200d-e698-4abe-8980-4bfe2290a9c7
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "feat(mobile): stamp inbox_client=mobile ..." | Re-trigger Greptile |
| // "cloud"). Mirrors packages/ui/src/shell/posthogAnalyticsImpl.ts. | ||
| const INBOX_CLIENT = "mobile" as const; | ||
|
|
||
| const INBOX_ANALYTICS_EVENT_NAMES: ReadonlySet<string> = new Set([ |
Contributor
There was a problem hiding this comment.
INBOX_ANALYTICS_EVENT_NAMES is module-private, so the test file has to maintain an identical parallel list in INBOX_EVENTS. If a new inbox event is added to ANALYTICS_EVENTS but forgotten in either place the two drift silently. Exporting the set lets the test iterate it directly, eliminating the duplicate list.
Suggested change
| const INBOX_ANALYTICS_EVENT_NAMES: ReadonlySet<string> = new Set([ | |
| export const INBOX_ANALYTICS_EVENT_NAMES: ReadonlySet<string> = new Set([ |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Export INBOX_ANALYTICS_EVENT_NAMES and iterate it in the analytics test instead of maintaining a parallel INBOX_EVENTS list, so the two can no longer drift silently when an inbox event is added. Addresses Greptile review feedback on #3086. Generated-By: PostHog Code Task-Id: 03d5200d-e698-4abe-8980-4bfe2290a9c7
MarconLP
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ports desktop PR #3059 (
feat(inbox): stamp inbox_client=code on inbox analytics events) to the mobile app.Desktop added a client discriminator property,
inbox_client, to every inbox-family analytics event so the shared PostHog project can be sliced by surface. The plan is: desktop stamps"code", mobile stamps"mobile", and the PostHog web frontend stamps"cloud". This PR implements the mobile side.Changes
apps/mobile/src/lib/analytics.ts: theuseAnalytics().trackwrapper now stamps{ inbox_client: "mobile", ...properties }on the mobile inbox-family events (Inbox viewed,Inbox report opened,Inbox report closed,Inbox report scrolled,Inbox report action). The client value is spread first so an explicit caller override wins, matching the desktop shape. Non-inbox events are untouched.INBOX_ANALYTICS_EVENT_NAMESset built from mobile's ownANALYTICS_EVENTSvalues — mobile already owns its own event map, so it keeps a mobile-local set rather than importing the shared helper. Mobile has noSIGNAL_SOURCE_CONNECTEDevent, so only the inbox events that exist in mobile are included.apps/mobile/src/lib/analytics.test.ts: added tests covering that inbox events getinbox_client="mobile"(parameterized across all inbox event names), that non-inbox events do not, and that a caller-providedinbox_clientwins over the default.Testing
pnpm --filter mobile test src/lib/analytics.test.ts— 12 passing