From f0687feef6380b31374fd76fa3ad296fa8ac0c68 Mon Sep 17 00:00:00 2001 From: Curry Yang <163384738+CurryYangxx@users.noreply.github.com> Date: Wed, 3 Jun 2026 16:27:53 +0800 Subject: [PATCH] feat: add segment event for first request creation pane (#10018) --- packages/insomnia-analytics/src/events.ts | 2 + ...ganizationId.project.$projectId._index.tsx | 15 +++++- packages/insomnia/src/ui/analytics.ts | 9 +++- .../ui/components/first-request-creation.tsx | 53 +++++++++++++++++-- 4 files changed, 72 insertions(+), 7 deletions(-) diff --git a/packages/insomnia-analytics/src/events.ts b/packages/insomnia-analytics/src/events.ts index 10049c0e2a..9bc29f8cd2 100644 --- a/packages/insomnia-analytics/src/events.ts +++ b/packages/insomnia-analytics/src/events.ts @@ -136,6 +136,8 @@ export enum AnalyticsEvent { projectSwitched = 'project-switched', organizationSwitched = 'organization-switched', uploadLintRulesetClicked = 'upload-lint-ruleset-clicked', + firstRequestPaneExampleClicked = 'first-request-pane-example-clicked', + firstRequestPaneCollectionChanged = 'first-request-pane-collection-changed', } export enum InsoEvent { diff --git a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx index 4df76aae11..6aac5e7f26 100644 --- a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx +++ b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId._index.tsx @@ -342,7 +342,12 @@ const Component = () => { selectedCollectionId={selectedCollectionId} onSelectedCollectionChange={setSelectedCollectionId} onCreateCollection={() => { - setNewWorkspaceModalState({ scope: 'collection', isOpen: true, redirect: false, source: 'home-page' }); + setNewWorkspaceModalState({ + scope: 'collection', + isOpen: true, + redirect: false, + source: 'first-request-pane', + }); }} /> @@ -707,8 +712,14 @@ const Component = () => { storageRules={storageRules} scope={newWorkspaceModalState.scope} onCreateWorkspace={workspaceId => { - if (newWorkspaceModalState.scope === 'collection' && newWorkspaceModalState.redirect === false) { + if ( + newWorkspaceModalState.scope === 'collection' && + newWorkspaceModalState.source === 'first-request-pane' + ) { setSelectedCollectionId(workspaceId); + window.main.trackAnalyticsEvent({ + event: AnalyticsEvent.firstRequestPaneCollectionChanged, + }); } }} redirectAfterCreate={newWorkspaceModalState.redirect} diff --git a/packages/insomnia/src/ui/analytics.ts b/packages/insomnia/src/ui/analytics.ts index 4e1ddc37fb..c2305f919b 100644 --- a/packages/insomnia/src/ui/analytics.ts +++ b/packages/insomnia/src/ui/analytics.ts @@ -49,5 +49,12 @@ export function trackImportEvent(event: AnalyticsEvent, properties: Record} - onPress={() => setIsImportModalOpen(true)} + onPress={() => { + window.main.trackAnalyticsEvent({ + event: AnalyticsEvent.importStarted, + properties: { + source: 'first-request-pane', + }, + }); + setIsImportModalOpen(true); + }} />
@@ -375,7 +401,12 @@ export const FirstRequestCreation = ({ ariaLabel="Select target collection" items={collectionItems} selectedKey={selectedCollectionId} - onSelectionChange={key => onSelectedCollectionChange(key ? String(key) : null)} + onSelectionChange={key => { + onSelectedCollectionChange(key ? String(key) : null); + window.main.trackAnalyticsEvent({ + event: AnalyticsEvent.firstRequestPaneCollectionChanged, + }); + }} title="Where should we put your request?" emptyState="You have no collections, so a new one will be created for you by default." footer={ @@ -437,7 +468,21 @@ export const FirstRequestCreation = ({ )) : quickStartItems.map(item => ( -