From 9a28eb32680a063408e99586f03ee3baadd35b91 Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Mon, 29 Jul 2024 16:32:00 +0100 Subject: [PATCH] chore: check analytics issue [INS-4212] (#7775) --- packages/insomnia/src/ui/analytics.ts | 1 + packages/insomnia/src/ui/routes/actions.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/insomnia/src/ui/analytics.ts b/packages/insomnia/src/ui/analytics.ts index b57f65860..b02d56ba3 100644 --- a/packages/insomnia/src/ui/analytics.ts +++ b/packages/insomnia/src/ui/analytics.ts @@ -1,5 +1,6 @@ export enum SegmentEvent { appStarted = 'App Started', + analyticsDisabled = 'Analytics Disabled', collectionCreate = 'Collection Created', dataExport = 'Data Exported', dataImport = 'Data Imported', diff --git a/packages/insomnia/src/ui/routes/actions.tsx b/packages/insomnia/src/ui/routes/actions.tsx index cbbc3755a..e72b87e7e 100644 --- a/packages/insomnia/src/ui/routes/actions.tsx +++ b/packages/insomnia/src/ui/routes/actions.tsx @@ -1269,6 +1269,9 @@ export const deleteClientCertificateAction: ActionFunction = async ({ request }) export const updateSettingsAction: ActionFunction = async ({ request }) => { const patch = await request.json(); + if (patch.hasOwnProperty('enableAnalytics') && !patch.enableAnalytics) { + window.main.trackSegmentEvent({ event: SegmentEvent.analyticsDisabled }); + } await models.settings.patch(patch); return null; };