diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.ts index 03a177c28908e..15401da60b193 100644 --- a/frontend/src/lib/utils/eventUsageLogic.ts +++ b/frontend/src/lib/utils/eventUsageLogic.ts @@ -443,6 +443,8 @@ export const eventUsageLogic = kea([ reportAutocaptureToggled: (autocapture_opt_out: boolean) => ({ autocapture_opt_out }), reportAutocaptureExceptionsToggled: (autocapture_opt_in: boolean) => ({ autocapture_opt_in }), reportFailedToCreateFeatureFlagWithCohort: (code: string, detail: string) => ({ code, detail }), + reportFeatureFlagCopySuccess: true, + reportFeatureFlagCopyFailure: (error) => ({ error }), reportInviteMembersButtonClicked: true, reportDashboardLoadingTime: (loadingMilliseconds: number, dashboardId: number) => ({ loadingMilliseconds, @@ -1048,6 +1050,12 @@ export const eventUsageLogic = kea([ reportFailedToCreateFeatureFlagWithCohort: ({ detail, code }) => { posthog.capture('failed to create feature flag with cohort', { detail, code }) }, + reportFeatureFlagCopySuccess: () => { + posthog.capture('feature flag copied') + }, + reportFeatureFlagCopyFailure: ({ error }) => { + posthog.capture('feature flag copy failure', { error }) + }, reportInviteMembersButtonClicked: () => { posthog.capture('invite members button clicked') }, diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts index 742eff1b44cb8..c7542d156b1bd 100644 --- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts +++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts @@ -795,10 +795,11 @@ export const featureFlagLogic = kea([ ? 'updated' : 'copied' lemonToast.success(`Feature flag ${operation} successfully!`) + eventUsageLogic.actions.reportFeatureFlagCopySuccess() } else { - lemonToast.error( - `Error while saving feature flag: ${JSON.stringify(featureFlagCopy?.failed) || featureFlagCopy}` - ) + const errorMessage = JSON.stringify(featureFlagCopy?.failed) || featureFlagCopy + lemonToast.error(`Error while saving feature flag: ${errorMessage}`) + eventUsageLogic.actions.reportFeatureFlagCopyFailure(errorMessage) } actions.loadProjectsWithCurrentFlag()