Skip to content

feat(inbox): Capture "Signal source connected" analytics event#2380

Merged
charlesvien merged 1 commit into
mainfrom
posthog-code/signal-source-connected-analytics
May 27, 2026
Merged

feat(inbox): Capture "Signal source connected" analytics event#2380
charlesvien merged 1 commit into
mainfrom
posthog-code/signal-source-connected-analytics

Conversation

@Twixes
Copy link
Copy Markdown
Member

@Twixes Twixes commented May 26, 2026

Summary

  • Adds a new Signal source connected analytics event, fired from both signal-source connection paths in useSignalSourceManager: the direct toggle (non-warehouse sources) and the post-DataSourceSetup-wizard completion (warehouse sources).
  • Event carries source_product, is_first_connection (brand-new config vs. re-enable of an existing one), and via_setup_wizard (warehouse OAuth path vs. plain toggle).
  • Closes a gap surfaced when trying to measure inbox onboarding — there was no event firing on the actual source-connected moment. Now we can build a first-time-for-user trend (e.g. "inbox users onboarded") and subscribe a team channel to a daily snapshot.

Test plan

  • Toggle on error_tracking from the Inbox sources settings → confirm Signal source connected fires once with source_product: "error_tracking", is_first_connection: true, via_setup_wizard: false. Toggle off then on again → second firing has is_first_connection: false.
  • Toggle on session_replay → same flow as above (non-warehouse path).
  • Connect github (or any warehouse source) via the DataSourceSetup wizard end-to-end → confirm one firing on completion with via_setup_wizard: true and is_first_connection: true.
  • Disable a previously enabled source → confirm no event fires (we only track connections, not disconnections).
  • If the API call inside handleSetupComplete fails → confirm the event does not fire (it lives inside the try block, before the catch).

Fires when a user enables a signal source for the Inbox, either by toggling a non-warehouse source on directly or by completing the DataSourceSetup wizard for a warehouse source. `is_first_connection` distinguishes a brand-new config from a re-enable; `via_setup_wizard` distinguishes the OAuth path from a plain toggle. Lets us measure inbox onboarding (e.g. first-time-for-user trend of new users connecting their first source).

Generated-By: PostHog Code
Task-Id: 55527856-9edd-4907-a389-98ac880f806d
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 26, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/renderer/features/inbox/hooks/useSignalSourceManager.ts:431-435
The `track` call fires unconditionally inside the `try` block — even when `existing` is already truthy **and** `existing.enabled` is already `true`. In that case neither `createSignalSourceConfig` nor `updateSignalSourceConfig` is invoked, so no actual connection happened, yet a `Signal source connected` event is emitted. A concrete path to this state: a warehouse source's external-data-source row is deleted externally while the signal-source config stays enabled; the next toggle attempt opens the wizard, and completing it fires a spurious analytics event.

```suggestion
        if (!existing || !existing.enabled) {
          track(ANALYTICS_EVENTS.SIGNAL_SOURCE_CONNECTED, {
            source_product: completedSource,
            is_first_connection: !existing,
            via_setup_wizard: true,
          });
        }
```

Reviews (1): Last reviewed commit: "feat(inbox): Capture "Signal source conn..." | Re-trigger Greptile

@charlesvien charlesvien merged commit cc30041 into main May 27, 2026
15 checks passed
@charlesvien charlesvien deleted the posthog-code/signal-source-connected-analytics branch May 27, 2026 02:54
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.

2 participants