Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(analytics): localize paired event usage actions (#107476)

Paul D'Ambra2baba59e4757
diff --git a/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.test.ts b/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.test.ts
index 9e3ae8f2f1d7..8f150c13c548 100644
--- a/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.test.ts
+++ b/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.test.ts
@@ -2,6 +2,7 @@ import { MOCK_TEAM_ID } from 'lib/api.mock'
import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { DefinitionPopoverState, definitionPopoverLogic } from 'lib/components/DefinitionPopover/definitionPopoverLogic'
@@ -129,6 +130,7 @@ describe('definitionPopoverLogic', () => {
})
it('cancel', async () => {
+ const capture = jest.spyOn(posthog, 'capture')
await expectLogic(logic, async () => {
logic.actions.setDefinition(mockEventDefinitions[0])
logic.actions.setPopoverState(DefinitionPopoverState.Edit)
@@ -152,6 +154,8 @@ describe('definitionPopoverLogic', () => {
dirty: false,
localDefinition: mockEventDefinitions[0],
})
+ expect(capture).toHaveBeenCalledWith('definition cancelled', { type: TaxonomicFilterGroupType.Events })
+ capture.mockRestore()
})
describe('save', () => {
diff --git a/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts b/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts
index 3949635a9270..f60fb8491ce8 100644
--- a/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts
+++ b/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts
@@ -10,7 +10,6 @@ import { resolvePropertyDefinitionId } from 'lib/components/PropertyFilters/util
import { getDataWarehouseItemWithFieldDefaults } from 'lib/components/TaxonomicFilter/dataWarehouseItemUtils'
import { TaxonomicDefinitionTypes, TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { capitalizeFirstLetter } from 'lib/utils/strings'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -466,24 +465,20 @@ export const definitionPopoverLogic = kea<definitionPopoverLogicType>([
},
handleSaveSuccess: () => {
if (cache.startTime !== undefined) {
- if (eventUsageLogic.findMounted()) {
- posthog.capture('definition save succeeded', {
- type: values.type,
- load_time: performance.now() - cache.startTime,
- })
- }
+ posthog.capture('definition save succeeded', {
+ type: values.type,
+ load_time: performance.now() - cache.startTime,
+ })
cache.startTime = undefined
}
},
handleSaveFailure: ({ error }) => {
if (cache.startTime !== undefined) {
- if (eventUsageLogic.findMounted()) {
- posthog.capture('definition save failed', {
- type: values.type,
- load_time: performance.now() - cache.startTime,
- error: error,
- })
- }
+ posthog.capture('definition save failed', {
+ type: values.type,
+ load_time: performance.now() - cache.startTime,
+ error: error,
+ })
cache.startTime = undefined
}
},
@@ -491,18 +486,14 @@ export const definitionPopoverLogic = kea<definitionPopoverLogicType>([
actions.setPopoverState(DefinitionPopoverState.View)
actions.setLocalDefinition(values.definition)
props?.onCancel?.()
- if (eventUsageLogic.findMounted()) {
- posthog.capture('definition cancelled', { type: values.type })
- }
+ posthog.capture('definition cancelled', { type: values.type })
},
recordHoverActivity: async (_, breakpoint) => {
await breakpoint(IS_TEST_MODE ? 1 : 1000) // Tests will wait for all breakpoints to finish
- if (eventUsageLogic.findMounted()) {
- posthog.capture('definition hovered', {
- type: values.type,
- media_preview_count: values.mediaPreviews.length ?? 0,
- })
- }
+ posthog.capture('definition hovered', {
+ type: values.type,
+ media_preview_count: values.mediaPreviews.length ?? 0,
+ })
},
})),
events(({ actions }) => ({
diff --git a/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx b/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx
index acc27fa18899..5b17335b883b 100644
--- a/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx
+++ b/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx
@@ -1,5 +1,6 @@
import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
import { toast } from 'react-toastify'
import { IconX } from '@posthog/icons'
@@ -16,6 +17,13 @@ import type { FeatureFlagsSet } from '../../logic/featureFlagLogic'
import { MCPHintToast } from './MCPHintToast'
import type { SurfaceKey } from './prompts'
+function reportMCPHintDismissed(dismissType: 'surface' | 'all', surfaceKey?: string): void {
+ posthog.capture('mcp hint dismissed', {
+ dismiss_type: dismissType,
+ surface_key: surfaceKey,
+ })
+}
+
// In production the toast auto-dismisses after a few seconds so it doesn't linger;
// in development we keep it open so it's easier to inspect.
const AUTO_DISMISS_MS = process.env.NODE_ENV === 'development' ? false : 15000
@@ -56,13 +64,6 @@ export interface mcpHintLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface mcpHintLogicActions {
- reportMCPHintDismissed: (
- dismissType: 'all' | 'surface',
- surfaceKey?: string | undefined
- ) => {
- dismissType: 'all' | 'surface'
- surfaceKey: string | undefined
- } // eventUsageLogic
reportMCPHintShown: (surfaceKey: string) => {
surfaceKey: string
} // eventUsageLogic
@@ -164,7 +165,7 @@ export const mcpHintLogic = kea<mcpHintLogicType>([
path(['lib', 'components', 'MCPHint', 'mcpHintLogic']),
connect(() => ({
values: [userLogic, ['user'], featureFlagLogic, ['featureFlags']],
- actions: [userLogic, ['updateUser'], eventUsageLogic, ['reportMCPHintShown', 'reportMCPHintDismissed']],
+ actions: [userLogic, ['updateUser'], eventUsageLogic, ['reportMCPHintShown']],
})),
actions({
tryShowHint: (surfaceKey: SurfaceKey, derivedPrompt?: string) => ({ surfaceKey, derivedPrompt }),
@@ -271,12 +272,12 @@ export const mcpHintLogic = kea<mcpHintLogicType>([
}
},
dismissSurface: ({ surfaceKey }) => {
- actions.reportMCPHintDismissed('surface', surfaceKey)
+ reportMCPHintDismissed('surface', surfaceKey)
},
dismissAll: () => {
toast.dismiss()
actions.updateUser({ hide_mcp_hints: true })
- actions.reportMCPHintDismissed('all')
+ reportMCPHintDismissed('all')
},
reenable: () => {
actions.updateUser({ hide_mcp_hints: false })
diff --git a/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts b/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts
index fdbb14118dc8..f6ab9319d308 100644
--- a/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts
+++ b/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts
@@ -19,7 +19,6 @@ import {
isQuickFilterItem,
quickFilterToPropertyFilter,
} from 'lib/components/TaxonomicFilter/types'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { propertyDefinitionsModel } from '~/models/propertyDefinitionsModel'
import {
@@ -153,9 +152,7 @@ export const taxonomicPropertyFilterLogic = kea<taxonomicPropertyFilterLogicType
openDropdown: () => {
const existingFilter = props.filters[props.filterIndex]
if (!existingFilter || !isValidPropertyFilter(existingFilter)) {
- if (eventUsageLogic.isMounted()) {
- posthog.capture('taxonomic filter add filter clicked', { eventName: props.eventNames?.[0] })
- }
+ posthog.capture('taxonomic filter add filter clicked', { eventName: props.eventNames?.[0] })
}
},
selectItem: ({ taxonomicGroup, propertyKey, itemPropertyFilterType, item }) => {
diff --git a/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts b/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts
index 53c75f5a2546..49e6b649df5c 100644
--- a/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts
+++ b/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts
@@ -1,7 +1,6 @@
import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import posthog from 'posthog-js'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { createFuse } from 'lib/utils/fuseSearch'
import { Scene } from 'scenes/sceneTypes'
import { teamLogic } from 'scenes/teamLogic'
@@ -82,7 +81,6 @@ export const sceneDashboardChoiceModalLogic = kea<sceneDashboardChoiceModalLogic
props({} as SceneDashboardChoiceModalProps),
key((props) => `${props.scene}`),
connect(() => ({
- logic: [eventUsageLogic],
actions: [
teamLogic,
['updateCurrentTeam'],
diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.ts
index b6ecb1da7049..36b216025db3 100644
--- a/frontend/src/lib/utils/eventUsageLogic.ts
+++ b/frontend/src/lib/utils/eventUsageLogic.ts
@@ -72,8 +72,6 @@ import {
SurveyQuestionType,
} from '~/types'
-import type { ExperimentMetricsRecalculationTriggerEnumApi } from 'products/experiments/frontend/generated/api.schemas'
-
import type { ExperimentMetricUnion } from '../../queries/schema/schema-general'
import type { FunnelCorrelationResultsType, Realm, UserType } from '../../types'
@@ -593,7 +591,7 @@ export function getEventPropertiesForExperiment(experiment: Experiment): object
}
}
-function sanitizeInsight(insight: Partial<InsightModel> | null): object | undefined {
+export function sanitizeInsight(insight: Partial<InsightModel> | null): object | undefined {
if (!insight) {
return undefined
}
@@ -814,15 +812,6 @@ export interface eventUsageLogicActions {
reportAxisUnitsChanged: (properties: Record<string, any>) => {
[x: string]: any
}
- reportBillingAddonPlanSwitchStarted: (
- fromProduct: string,
- toProduct: string,
- reason: 'downgrade' | 'upgrade'
- ) => {
- fromProduct: string
- reason: 'downgrade' | 'upgrade'
- toProduct: string
- }
reportBillingCTAShown: () => {
value: true
}
@@ -873,9 +862,6 @@ export interface eventUsageLogicActions {
reportCustomerAnalyticsDashboardDateFilterApplied: ({ filter }: any) => {
filter: any
}
- reportCustomerAnalyticsDashboardEventPickerClicked: ({ event }: any) => {
- event: any
- }
reportCustomerAnalyticsDashboardEventsSaved: () => boolean
reportCustomerAnalyticsViewed: (delay?: number) => {
delay: number | undefined
@@ -965,15 +951,6 @@ export interface eventUsageLogicActions {
reportDashboardEmptyAddChartClicked: (dashboardId: number | undefined) => {
dashboardId: number | undefined
}
- reportDashboardEmptyAiPromptClicked: (
- promptLabel: string,
- dashboardId: number | undefined,
- promptType: 'custom_prompt' | 'starter_question'
- ) => {
- dashboardId: number | undefined
- promptLabel: string
- promptType: 'custom_prompt' | 'starter_question'
- }
reportDashboardEmptyAiPromptSubmitted: (
dashboardId: number | undefined,
promptType: 'custom_prompt' | 'starter_question'
@@ -1034,33 +1011,9 @@ export interface eventUsageLogicActions {
count: number
method: 'bulk' | 'single'
}
- reportDashboardPinToggled: (
- dashboardId: number,
- pinned: boolean,
- source: DashboardEventSource
- ) => {
- dashboardId: number
- pinned: boolean
- source: DashboardEventSource
- }
reportDashboardTileDensityConfigured: (tileDensity: DashboardTileSpacing) => {
tileDensity: DashboardTileSpacing
}
- reportDashboardTileRefreshed: (
- dashboardId: number,
- tile: DashboardTile,
- filters: Record<string, any>,
- variables: Record<string, any>,
- refreshDurationMs: number,
- individualRefresh: boolean
- ) => {
- dashboardId: number
- filters: Record<string, any>
- individualRefresh: boolean
- refreshDurationMs: number
- tile: DashboardTile
- variables: Record<string, any>
- }
reportDashboardTileRepositioned: (
dashboardId: number,
action: 'moved' | 'resized',
@@ -1070,15 +1023,6 @@ export interface eventUsageLogicActions {
dashboardId: number
layoutZoom: number
}
- reportDashboardViewed: (
- dashboard: DashboardType,
- lastRefreshed: Dayjs | null,
- delay?: number
- ) => {
- dashboard: DashboardType
- delay: number | undefined
- lastRefreshed: Dayjs | null
- }
reportDataManagementDefinitionClickEdit: (type: TaxonomicFilterGroupType) => {
type: TaxonomicFilterGroupType
}
@@ -1112,9 +1056,6 @@ export interface eventUsageLogicActions {
experimentId: ExperimentIdType
opened: boolean
}
- reportExperimentBiasWarningShown: (experiment: Experiment) => {
- experiment: Experiment
- }
reportExperimentDashboardCreated: (
experiment: Experiment,
dashboardId: number
@@ -1150,13 +1091,6 @@ export interface eventUsageLogicActions {
reportExperimentHoldoutCreated: (holdout: ExperimentHoldoutType) => {
holdout: ExperimentHoldoutType
}
- reportExperimentInconsistencyWarningShown: (
- experiment: Experiment,
- warningKey: string
- ) => {
- experiment: Experiment
- warningKey: string
- }
reportExperimentMetricBreakdownAdded: (
experiment: Experiment,
metricUuid: string,
@@ -1214,60 +1148,6 @@ export interface eventUsageLogicActions {
queryId: string | null | undefined
teamId: number | null | undefined
}
- reportExperimentMetricRecalculation: (
- status: 'completed' | 'failed' | 'triggered',
- properties: {
- duration_ms?: number
- experiment_id: number
- failed?: number
- is_existing?: boolean
- poll_count?: number
- recalculation_id: string | null
- succeeded?: number
- total_metrics?: number
- trigger?: ExperimentMetricsRecalculationTriggerEnumApi
- }
- ) => {
- properties: {
- duration_ms?: number | undefined
- experiment_id: number
- failed?: number | undefined
- is_existing?: boolean | undefined
- poll_count?: number | undefined
- recalculation_id: string | null
- succeeded?: number | undefined
- total_metrics?: number | undefined
- trigger?: ExperimentMetricsRecalculationTriggerEnumApi | undefined
- }
- status: 'completed' | 'failed' | 'triggered'
- }
- reportExperimentMetricsRefreshed: (
- experiment: Experiment,
- forceRefresh: boolean,
- context?: {
- auto_refresh_enabled?: boolean
- auto_refresh_interval?: number
- previous_refresh_age_ms?: number | null
- previous_refresh_id?: string | null
- previous_refresh_state?: string | null
- previous_refresh_triggered_by?: string | null
- triggered_by: 'auto-refresh' | 'manual'
- }
- ) => {
- context:
- | {
- auto_refresh_enabled?: boolean | undefined
- auto_refresh_interval?: number | undefined
- previous_refresh_age_ms?: number | null | undefined
- previous_refresh_id?: string | null | undefined
- previous_refresh_state?: string | null | undefined
- previous_refresh_triggered_by?: string | null | undefined
- triggered_by: 'auto-refresh' | 'manual'
- }
- | undefined
- experiment: Experiment
- forceRefresh: boolean
- }
reportExperimentRecordingOpened: (
experimentId: ExperimentIdType,
context: ExperimentRecordingsFilterContext
@@ -1317,13 +1197,6 @@ export interface eventUsageLogicActions {
context: ExperimentRecordingsListRenderedContext
experimentId: ExperimentIdType
}
- reportExperimentRecordingsTabViewed: (
- experimentId: ExperimentIdType,
- context: ExperimentRecordingsTabContext
- ) => {
- context: ExperimentRecordingsTabContext
- experimentId: ExperimentIdType
- }
reportExperimentReleaseConditionsViewed: (experimentId: ExperimentIdType) => {
experimentId: ExperimentIdType
}
@@ -1337,13 +1210,6 @@ export interface eventUsageLogicActions {
reportExperimentSharedMetricCreated: (sharedMetric: SharedMetric) => {
sharedMetric: SharedMetric
}
- reportExperimentTabViewed: (
- experimentId: ExperimentIdType,
- tab: string
- ) => {
- experimentId: ExperimentIdType
- tab: string
- }
reportExperimentTimeseriesRecalculated: (
experimentId: ExperimentIdType,
metric: ExperimentMetric
@@ -1399,13 +1265,6 @@ export interface eventUsageLogicActions {
reportExperimentWizardStarted: (guideVisible: boolean) => {
guideVisible: boolean
}
- reportFailedToCreateFeatureFlagWithCohort: (
- code: string,
- detail: string
- ) => {
- code: string
- detail: string
- }
reportFeatureFlagBulkCopy: (
flagCount: number,
projectCount: number,
@@ -1415,12 +1274,6 @@ export interface eventUsageLogicActions {
flagCount: number
projectCount: number
}
- reportFeatureFlagCopyFailure: (error: any) => {
- error: any
- }
- reportFeatureFlagScheduleSuccess: () => {
- value: true
- }
reportFeatureFlagsBulkArchived: (
archivedCount: number,
pendingApprovalCount: number,
@@ -1453,17 +1306,6 @@ export interface eventUsageLogicActions {
reportGroupProfileViewed: (delay?: number) => {
delay: number | undefined
}
- reportGroupPropertyUpdated: (
- action: 'added' | 'removed' | 'updated',
- totalProperties: number,
- oldPropertyType?: string,
- newPropertyType?: string
- ) => {
- action: 'added' | 'removed' | 'updated'
- newPropertyType: string | undefined
- oldPropertyType: string | undefined
- totalProperties: number
- }
reportGroupTypeDetailDashboardCreated: () => {}
reportHeatmapsToggled: (heatmaps_opt_in: boolean) => {
heatmaps_opt_in: boolean
@@ -1509,28 +1351,6 @@ export interface eventUsageLogicActions {
format: string
insightId: number | null
}
- reportInsightSaved: (
- insight: Partial<InsightModel> | null,
- query: Node | null,
- isNewInsight: boolean,
- saveType: 'save' | 'save_as'
- ) => {
- insight: Partial<InsightModel<Node<Record<string, any>>>> | null
- isNewInsight: boolean
- query: Node<Record<string, any>> | null
- saveType: 'save' | 'save_as'
- }
- reportInsightViewed: (
- insightModel: Partial<InsightModel>,
- query: Node | null,
- isFirstLoad: boolean,
- delay?: number
- ) => {
- delay: number | undefined
- insightModel: Partial<InsightModel<Node<Record<string, any>>>>
- isFirstLoad: boolean
- query: Node<Record<string, any>> | null
- }
reportInsightsTableCalcToggled: (mode: string) => {
mode: string
}
@@ -1564,13 +1384,6 @@ export interface eventUsageLogicActions {
reportInviteMembersButtonClicked: () => {
value: true
}
- reportMCPHintDismissed: (
- dismissType: 'all' | 'surface',
- surfaceKey?: string
- ) => {
- dismissType: 'all' | 'surface'
- surfaceKey: string | undefined
- }
reportMCPHintShown: (surfaceKey: string) => {
surfaceKey: string
}
@@ -1618,23 +1431,6 @@ export interface eventUsageLogicActions {
productKey: string
properties: OnboardingEventProperties | undefined
}
- reportOnboardingProductSelectionPath: (
- path: 'ai' | 'browsing_history' | 'manual' | 'use_case',
- properties?: {
- hasBrowsingHistory?: boolean
- recommendedProducts?: string[]
- useCase?: string
- }
- ) => {
- path: 'ai' | 'browsing_history' | 'manual' | 'use_case'
- properties:
- | {
- hasBrowsingHistory?: boolean | undefined
- recommendedProducts?: string[] | undefined
- useCase?: string | undefined
- }
- | undefined
- }
reportOnboardingProductToggled: (
productKey: string,
selected: boolean,
@@ -1678,20 +1474,6 @@ export interface eventUsageLogicActions {
reportPersonProfileViewed: (delay?: number) => {
delay: number | undefined
}
- reportPersonPropertyUpdated: (
- action: 'added' | 'removed' | 'updated',
- totalProperties: number,
- oldPropertyType?: string,
- newPropertyType?: string
- ) => {
- action: 'added' | 'removed' | 'updated'
- newPropertyType: string | undefined
- oldPropertyType: string | undefined
- totalProperties: number
- }
- reportPersonalIntegrationConnectClicked: (kind: string) => {
- kind: string
- }
reportPersonsJoinModeUpdated: (mode: string) => {
mode: string
}
@@ -1879,17 +1661,6 @@ export interface eventUsageLogicActions {
enabled: boolean
}
}
- reportWebAnalyticsDateRangeChanged: (props: {
- date_from: string | null
- date_to: string | null
- interval: string
- }) => {
- props: {
- date_from: string | null
- date_to: string | null
- interval: string
- }
- }
reportWebAnalyticsFilterApplied: (props: {
filter_type: string
property_filter_category?: PropertyFilterType
@@ -2041,31 +1812,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
responseAgeMs?: number
) => ({ surface, discoveryId, installationId, responseAgeMs }),
reportIntegrationConnectRejected: (kind: string, error: string) => ({ kind, error }),
- reportPersonalIntegrationConnectClicked: (kind: string) => ({ kind }),
- reportGroupPropertyUpdated: (
- action: 'added' | 'updated' | 'removed',
- totalProperties: number,
- oldPropertyType?: string,
- newPropertyType?: string
- ) => ({ action, totalProperties, oldPropertyType, newPropertyType }),
// insights
- reportInsightSaved: (
- insight: Partial<InsightModel> | null,
- query: Node | null,
- isNewInsight: boolean,
- saveType: 'save' | 'save_as'
- ) => ({ insight, query, isNewInsight, saveType }),
- reportInsightViewed: (
- insightModel: Partial<InsightModel>,
- query: Node | null,
- isFirstLoad: boolean,
- delay?: number
- ) => ({
- insightModel,
- query,
- isFirstLoad,
- delay,
- }),
reportDataTableColumnsUpdated: (context_type: string) => ({ context_type }),
// insight filters
reportFunnelStepReordered: true,
@@ -2091,17 +1838,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportProjectCreationSubmitted: (projectCount: number, nameLength: number) => ({ projectCount, nameLength }),
reportProjectNoticeDismissed: (key: string) => ({ key }),
reportProjectNoticeShown: (variant: string) => ({ variant }),
- reportPersonPropertyUpdated: (
- action: 'added' | 'updated' | 'removed',
- totalProperties: number,
- oldPropertyType?: string,
- newPropertyType?: string
- ) => ({ action, totalProperties, oldPropertyType, newPropertyType }),
- reportDashboardViewed: (dashboard: DashboardType, lastRefreshed: Dayjs | null, delay?: number) => ({
- dashboard,
- delay,
- lastRefreshed,
- }),
reportDashboardModeToggled: (
dashboard: DashboardType | null,
mode: DashboardMode | null,
@@ -2124,26 +1860,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
dashboard: DashboardType | null,
action: 'shown' | 'discarded' | 'kept_editing'
) => ({ dashboard, action }),
- reportDashboardTileRefreshed: (
- dashboardId: number,
- tile: DashboardTile,
- filters: Record<string, any>,
- variables: Record<string, any>,
- refreshDurationMs: number,
- individualRefresh: boolean
- ) => ({
- dashboardId,
- tile,
- filters,
- variables,
- refreshDurationMs,
- individualRefresh,
- }),
- reportDashboardPinToggled: (dashboardId: number, pinned: boolean, source: DashboardEventSource) => ({
- dashboardId,
- pinned,
- source,
- }),
reportDashboardMoveInitiated: (method: 'single' | 'bulk', count: number) => ({ method, count }),
reportDashboardInsightDeleteAfterRemovalClicked: (otherDashboardCount: number) => ({ otherDashboardCount }),
reportDashboardTileRepositioned: (dashboardId: number, action: 'moved' | 'resized', layoutZoom: number) => ({
@@ -2157,15 +1873,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
attribute: 'name' | 'description'
) => ({ dashboardId, insightId, attribute }),
/** Empty-state AI prompt chips (ai-first empty dashboard only). */
- reportDashboardEmptyAiPromptClicked: (
- promptLabel: string,
- dashboardId: number | undefined,
- promptType: 'starter_question' | 'custom_prompt'
- ) => ({
- promptLabel,
- dashboardId,
- promptType,
- }),
reportDashboardEmptyAiPromptSubmitted: (
dashboardId: number | undefined,
promptType: 'custom_prompt' | 'starter_question'
@@ -2211,28 +1918,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportExperimentWizardStarted: (guideVisible: boolean) => ({ guideVisible }),
reportExperimentWizardGuideToggled: (visible: boolean, currentStep: string) => ({ visible, currentStep }),
reportExperimentViewed: (experiment: Experiment, duration: number | null) => ({ experiment, duration }),
- reportExperimentInconsistencyWarningShown: (experiment: Experiment, warningKey: string) => ({
- experiment,
- warningKey,
- }),
- reportExperimentBiasWarningShown: (experiment: Experiment) => ({ experiment }),
- reportExperimentMetricsRefreshed: (
- experiment: Experiment,
- forceRefresh: boolean,
- context?: {
- triggered_by: 'manual' | 'auto-refresh'
- auto_refresh_enabled?: boolean
- auto_refresh_interval?: number
- previous_refresh_id?: string | null
- previous_refresh_age_ms?: number | null
- previous_refresh_state?: string | null
- previous_refresh_triggered_by?: string | null
- }
- ) => ({
- experiment,
- forceRefresh,
- context,
- }),
reportExperimentMetricBreakdownAdded: (
experiment: Experiment,
metricUuid: string,
@@ -2306,20 +1991,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
// Single event for the whole recalc lifecycle — see docs/superpowers/specs/2026-06-04-experiment-metric-
// recalculation-events.md. status discriminates the moment ('triggered' / 'completed' / 'failed' —
// 'polled' is deliberately not emitted); the property bag carries the fields relevant to that moment.
- reportExperimentMetricRecalculation: (
- status: 'triggered' | 'completed' | 'failed',
- properties: {
- experiment_id: number
- recalculation_id: string | null
- trigger?: ExperimentMetricsRecalculationTriggerEnumApi
- is_existing?: boolean
- total_metrics?: number
- succeeded?: number
- failed?: number
- duration_ms?: number
- poll_count?: number
- }
- ) => ({ status, properties }),
reportExperimentFeatureFlagModalOpened: () => ({}),
reportExperimentTimeseriesViewed: (experimentId: ExperimentIdType, metric: ExperimentMetric) => ({
experimentId,
@@ -2330,11 +2001,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
metric,
}),
reportExperimentAiSummaryRequested: (experiment: Experiment) => ({ experiment }),
- reportExperimentTabViewed: (experimentId: ExperimentIdType, tab: string) => ({ experimentId, tab }),
- reportExperimentRecordingsTabViewed: (
- experimentId: ExperimentIdType,
- context: ExperimentRecordingsTabContext
- ) => ({ experimentId, context }),
reportExperimentRecordingsBucketLoaded: (
experimentId: ExperimentIdType,
context: ExperimentRecordingsBucketLoadedContext
@@ -2406,8 +2072,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportActivityLogSettingToggled: (receive_org_level_activity_logs: boolean | null) => ({
receive_org_level_activity_logs,
}),
- reportFailedToCreateFeatureFlagWithCohort: (code: string, detail: string) => ({ code, detail }),
- reportFeatureFlagCopyFailure: (error) => ({ error }),
reportFeatureFlagBulkCopy: (flagCount: number, projectCount: number, failedCount: number) => ({
flagCount,
projectCount,
@@ -2418,18 +2082,8 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
pendingApprovalCount,
failedCount,
}),
- reportFeatureFlagScheduleSuccess: true,
reportInviteMembersButtonClicked: true,
reportAxisUnitsChanged: (properties: Record<string, any>) => ({ ...properties }),
- reportBillingAddonPlanSwitchStarted: (
- fromProduct: string,
- toProduct: string,
- reason: 'upgrade' | 'downgrade'
- ) => ({
- fromProduct,
- toProduct,
- reason,
- }),
reportFlagsCodeExampleInteraction: (optionType: string) => ({
optionType,
}),
@@ -2503,14 +2157,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
useCase,
recommendedProducts,
}),
- reportOnboardingProductSelectionPath: (
- path: 'ai' | 'use_case' | 'browsing_history' | 'manual',
- properties?: {
- useCase?: string
- recommendedProducts?: string[]
- hasBrowsingHistory?: boolean
- }
- ) => ({ path, properties }),
reportOnboardingProductToggled: (productKey: string, selected: boolean, recommendationSource: string) => ({
productKey,
selected,
@@ -2588,11 +2234,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
property_filter_category?: PropertyFilterType
total_filter_count: number
}) => ({ props }),
- reportWebAnalyticsDateRangeChanged: (props: {
- date_from: string | null
- date_to: string | null
- interval: string
- }) => ({ props }),
reportWebAnalyticsCompareToggled: (props: { enabled: boolean }) => ({ props }),
reportWebAnalyticsPathCleaningToggled: (props: { enabled: boolean }) => ({ props }),
// Customer Analytics
@@ -2601,7 +2242,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportCustomerAnalyticsDashboardConfigurationViewed: () => true,
reportCustomerAnalyticsDashboardConfigureEventWithAIClicked: ({ event }) => ({ event }),
reportCustomerAnalyticsDashboardDateFilterApplied: ({ filter }) => ({ filter }),
- reportCustomerAnalyticsDashboardEventPickerClicked: ({ event }) => ({ event }),
reportCustomerAnalyticsAddJoinButtonClicked: ({ table }) => ({ table }),
reportCustomerAnalyticsDashboardEventsSaved: () => true,
reportCustomerAnalyticsViewed: (delay?: number) => ({ delay }),
@@ -2653,12 +2293,8 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
// navbar starred
// MCP hints
reportMCPHintShown: (surfaceKey: string) => ({ surfaceKey }),
- reportMCPHintDismissed: (dismissType: 'surface' | 'all', surfaceKey?: string) => ({
- dismissType,
- surfaceKey,
- }),
}),
- listeners(({ values }) => ({
+ listeners(() => ({
reportBillingCTAShown: () => {
posthog.capture('billing CTA shown')
},
@@ -2716,77 +2352,18 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
error,
})
},
- // Personal integrations are a separate table with their own connect surface, so they get
- // their own event: saved insights already count `integration_connect_clicked` unfiltered and
- // would silently start including personal links.
- reportPersonalIntegrationConnectClicked: ({ kind }) => {
- posthog.capture('personal integration connect clicked', { integration_kind: kind })
- },
reportTimeToSeeData: async ({ payload }) => {
posthog.capture('time to see data', payload)
},
reportGroupTypeDetailDashboardCreated: async () => {
posthog.capture('group type detail dashboard created')
},
- reportGroupPropertyUpdated: async ({ action, totalProperties, oldPropertyType, newPropertyType }) => {
- posthog.capture(`group property ${action}`, {
- old_property_type: oldPropertyType !== 'undefined' ? oldPropertyType : undefined,
- new_property_type: newPropertyType !== 'undefined' ? newPropertyType : undefined,
- total_properties: totalProperties,
- })
- },
- reportInsightSaved: async ({ insight, query, isNewInsight, saveType }) => {
- // "insight saved" is a proxy for the new insight's results being valuable to the user
- posthog.capture('insight saved', {
- ...sanitizeQuery(query),
- insight: sanitizeInsight(insight),
- is_new_insight: isNewInsight,
- save_type: saveType,
- })
- },
- reportInsightViewed: ({ insightModel, query, isFirstLoad, delay }) => {
- const payload: Record<string, any> = {
- report_delay: delay,
- is_first_component_load: isFirstLoad,
- viewer_is_creator:
- insightModel.created_by?.uuid && values.user?.uuid
- ? insightModel.created_by?.uuid === values.user?.uuid
- : undefined,
- is_saved: insightModel.saved,
- description_length: insightModel.description?.length ?? 0,
- tags_count: insightModel.tags?.length ?? 0,
- insight: sanitizeInsight(insightModel),
- insight_id: insightModel.id,
- insight_short_id: insightModel.short_id,
- ...sanitizeQuery(query),
- }
-
- // The view path passes a bare source node, so sanitizeQuery's `query_kind`/`query_source_kind`
- // describe the source rather than the wrapper. Override them from the full stored query so
- // `query_kind` consistently means the top-level node, matching every other insight event.
- const modelQuery = insightModel.query as Node | null | undefined
- if (modelQuery) {
- payload.query_kind = modelQuery.kind
- payload.query_source_kind = isNodeWithSource(modelQuery) ? modelQuery.source.kind : undefined
- }
-
- const eventName = delay ? 'insight analyzed' : 'insight viewed'
- posthog.capture(eventName, objectClean({ ...payload, source: 'web' }))
- },
reportPersonsModalViewed: async ({ params }) => {
posthog.capture('insight person modal viewed', params)
},
reportPersonsModalSearched: async ({ params }) => {
posthog.capture('insight person modal searched', params)
},
- reportDashboardViewed: async ({ dashboard, lastRefreshed, delay }, breakpoint) => {
- if (!delay) {
- await breakpoint(500) // Debounce to avoid noisy events from continuous navigation
- }
- const properties = dashboardViewedProperties(dashboard, lastRefreshed, values.user?.uuid)
- const eventName = delay ? 'dashboard analyzed' : 'viewed dashboard' // `viewed dashboard` name is kept for backwards compatibility
- posthog.capture(eventName, { ...properties, source: 'web' })
- },
reportProjectCreationSubmitted: async ({
projectCount,
nameLength,
@@ -2812,13 +2389,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportDataTableColumnsUpdated: async ({ context_type }) => {
posthog.capture('data table columns updated', { context_type })
},
- reportPersonPropertyUpdated: async ({ action, totalProperties, oldPropertyType, newPropertyType }) => {
- posthog.capture(`person property ${action}`, {
- old_property_type: oldPropertyType !== 'undefined' ? oldPropertyType : undefined,
- new_property_type: newPropertyType !== 'undefined' ? newPropertyType : undefined,
- total_properties: totalProperties,
- })
- },
reportDashboardModeToggled: async ({ dashboard, mode, source, layoutZoom, layoutEditMode }) => {
posthog.capture('dashboard mode toggled', {
dashboard_id: dashboard?.id,
@@ -2854,38 +2424,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
action,
})
},
- reportDashboardTileRefreshed: async ({
- dashboardId,
- tile,
- filters,
- variables,
- refreshDurationMs,
- individualRefresh,
- }) => {
- const insight = tile.insight
- const sanitizedQuery = insight?.query ? sanitizeQuery(insight.query) : {}
-
- posthog.capture('dashboard insight refreshed', {
- dashboard_id: dashboardId,
- insight_id: insight?.id,
- insight_short_id: insight?.short_id,
- was_cached: tile.is_cached,
- last_refreshed: insight?.last_refresh?.toString(),
- refresh_age: insight?.last_refresh ? now().diff(insight?.last_refresh, 'seconds') : undefined,
- filters,
- variables,
- refresh_duration_ms: refreshDurationMs,
- individual_refresh: individualRefresh,
- ...sanitizedQuery,
- })
- },
- reportDashboardPinToggled: async ({ dashboardId, pinned, source }) => {
- posthog.capture(`dashboard pin toggled`, {
- dashboard_id: dashboardId,
- pinned,
- source,
- })
- },
reportDashboardMoveInitiated: async ({ method, count }) => {
posthog.capture('dashboard move initiated', { method, count })
},
@@ -2908,14 +2446,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
other_dashboard_count: otherDashboardCount,
})
},
- reportDashboardEmptyAiPromptClicked: async ({ promptLabel, dashboardId, promptType }) => {
- posthog.capture('dashboard empty ai prompt clicked', {
- prompt_label: promptLabel,
- dashboard_id: dashboardId,
- prompt_type: promptType,
- source: 'web',
- })
- },
reportDashboardEmptyAiPromptSubmitted: async ({ dashboardId, promptType }) => {
posthog.capture('dashboard empty ai prompt submitted', {
dashboard_id: dashboardId,
@@ -3036,30 +2566,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
duration,
})
},
- reportExperimentInconsistencyWarningShown: ({ experiment, warningKey }) => {
- posthog.capture('experiment inconsistency warning shown', {
- ...getEventPropertiesForExperiment(experiment),
- warning_key: warningKey,
- })
- },
- reportExperimentBiasWarningShown: ({ experiment }) => {
- posthog.capture('experiment bias warning shown', {
- ...getEventPropertiesForExperiment(experiment),
- })
- },
- reportExperimentMetricsRefreshed: ({ experiment, forceRefresh, context }) => {
- posthog.capture('experiment metrics refreshed', {
- ...getEventPropertiesForExperiment(experiment),
- force_refresh: forceRefresh,
- triggered_by: context?.triggered_by || 'manual',
- auto_refresh_enabled: context?.auto_refresh_enabled,
- auto_refresh_interval: context?.auto_refresh_interval,
- previous_refresh_id: context?.previous_refresh_id ?? null,
- previous_refresh_age_ms: context?.previous_refresh_age_ms ?? null,
- previous_refresh_state: context?.previous_refresh_state ?? null,
- previous_refresh_triggered_by: context?.previous_refresh_triggered_by ?? null,
- })
- },
reportExperimentMetricBreakdownAdded: ({ experiment, metricUuid, breakdown, isPrimary }) => {
posthog.capture('experiment metric breakdown added', {
...getEventPropertiesForExperiment(experiment),
@@ -3147,9 +2653,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
...context,
})
},
- reportExperimentMetricRecalculation: ({ status, properties }) => {
- posthog.capture('experiment metric recalculation', { status, ...properties })
- },
reportExperimentFeatureFlagModalOpened: () => {
posthog.capture('experiment feature flag modal opened')
},
@@ -3179,18 +2682,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
// The recordings-tab events below carry the experiment id alone rather than
// `getEventPropertiesForExperiment`, which serializes every metric definition. These fire on
// tab switches and recording clicks, so that payload would be sent many times per visit.
- reportExperimentTabViewed: ({ experimentId, tab }) => {
- posthog.capture('experiment tab viewed', {
- experiment_id: experimentId,
- tab,
- })
- },
- reportExperimentRecordingsTabViewed: ({ experimentId, context }) => {
- posthog.capture('experiment recordings tab viewed', {
- experiment_id: experimentId,
- ...context,
- })
- },
reportExperimentRecordingsBucketLoaded: ({ experimentId, context }) => {
posthog.capture('experiment recordings bucket loaded', {
experiment_id: experimentId,
@@ -3317,12 +2808,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
receive_org_level_activity_logs,
})
},
- reportFailedToCreateFeatureFlagWithCohort: ({ detail, code }) => {
- posthog.capture('failed to create feature flag with cohort', { detail, code })
- },
- reportFeatureFlagCopyFailure: ({ error }) => {
- posthog.capture('feature flag copy failure', { error })
- },
reportFeatureFlagBulkCopy: ({ flagCount, projectCount, failedCount }) => {
posthog.capture('feature flags bulk copied', {
flag_count: flagCount,
@@ -3337,22 +2822,9 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
failed_count: failedCount,
})
},
- reportFeatureFlagScheduleSuccess: () => {
- posthog.capture('feature flag scheduled')
- },
reportInviteMembersButtonClicked: () => {
posthog.capture('invite members button clicked')
},
- reportBillingAddonPlanSwitchStarted: ({ fromProduct, toProduct, reason }) => {
- const eventName =
- reason === 'upgrade'
- ? 'billing addon subscription upgrade clicked'
- : 'billing addon subscription downgrade clicked'
- posthog.capture(eventName, {
- from_product: fromProduct,
- to_product: toProduct,
- })
- },
reportResourceAccessLevelUpdated: ({ resourceType, roleName, accessLevel }) => {
posthog.capture('resource access level updated', {
resource_type: resourceType,
@@ -3575,14 +3047,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
...LEGACY_ONBOARDING_EVENT_PROPS,
})
},
- reportOnboardingProductSelectionPath: ({ path, properties }) => {
- posthog.capture('onboarding product selection path', {
- path,
- use_case: properties?.useCase,
- recommended_products: properties?.recommendedProducts,
- has_browsing_history: properties?.hasBrowsingHistory,
- })
- },
reportOnboardingProductToggled: ({ productKey, selected, recommendationSource }) => {
posthog.capture('onboarding product toggled', {
product_key: productKey,
@@ -3702,9 +3166,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportWebAnalyticsFilterRemoved: ({ props }) => {
posthog.capture('web analytics filter removed', props)
},
- reportWebAnalyticsDateRangeChanged: ({ props }) => {
- posthog.capture('web analytics date range changed', props)
- },
reportWebAnalyticsCompareToggled: ({ props }) => {
posthog.capture('web analytics compare toggled', props)
},
@@ -3725,9 +3186,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportCustomerAnalyticsDashboardDateFilterApplied: async ({ filter }) => {
posthog.capture('customer analytics dashboard date filter applied', { filter })
},
- reportCustomerAnalyticsDashboardEventPickerClicked: async ({ event }) => {
- posthog.capture('customer analytics dashboard event picker clicked', { event })
- },
reportCustomerAnalyticsDashboardConfigureEventWithAIClicked: async ({ event }) => {
posthog.capture('customer analytics dashboard configure event with AI clicked', { event })
},
@@ -3850,11 +3308,5 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
surface_key: surfaceKey,
})
},
- reportMCPHintDismissed: ({ dismissType, surfaceKey }) => {
- posthog.capture('mcp hint dismissed', {
- dismiss_type: dismissType,
- surface_key: surfaceKey,
- })
- },
})),
])
diff --git a/frontend/src/models/dashboardsModel.tsx b/frontend/src/models/dashboardsModel.tsx
index 603a7b8760f5..34d6bdd15b6b 100644
--- a/frontend/src/models/dashboardsModel.tsx
+++ b/frontend/src/models/dashboardsModel.tsx
@@ -7,7 +7,7 @@ import api, { PaginatedResponse } from 'lib/api'
import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'
import { GENERATED_DASHBOARD_PREFIX } from 'lib/constants'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
-import { DashboardEventSource, eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
import { isUserLoggedIn } from 'lib/utils/getAppContext'
import { permanentlyMount } from 'lib/utils/kea-logic-builders'
import { idToKey } from 'lib/utils/objects'
@@ -22,6 +22,14 @@ import { DashboardBasicType, DashboardTile, DashboardType, InsightShortId, Insig
import type { Node } from '../queries/schema/schema-general'
+function reportDashboardPinToggled(dashboardId: number, pinned: boolean, source: DashboardEventSource): void {
+ posthog.capture(`dashboard pin toggled`, {
+ dashboard_id: dashboardId,
+ pinned,
+ source,
+ })
+}
+
/** A dashboard's folder is its file system path without the dashboard's own name, so the two move together. */
function filedAt<T extends DashboardBasicType | DashboardType>(dashboard: T, path: string): T {
return { ...dashboard, file_system_path: path, folder: parentPath(path) }
@@ -524,7 +532,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
const response = await api.update(`api/projects/${teamLogic.values.currentTeamId}/dashboards/${id}`, {
pinned: true,
})
- eventUsageLogic.actions.reportDashboardPinToggled(id, true, source)
+ reportDashboardPinToggled(id, true, source)
return getQueryBasedDashboard(response)!
},
unpinDashboard: async ({ id, source }) => {
@@ -535,7 +543,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
pinned: false,
}
)
- eventUsageLogic.actions.reportDashboardPinToggled(id, false, source)
+ reportDashboardPinToggled(id, false, source)
return getQueryBasedDashboard(response)!
},
duplicateDashboard: async ({ id, name, show, duplicateTiles }) => {
diff --git a/frontend/src/scenes/billing/BillingProductAddonActions.tsx b/frontend/src/scenes/billing/BillingProductAddonActions.tsx
index b35954d5679f..1d9456c919b3 100644
--- a/frontend/src/scenes/billing/BillingProductAddonActions.tsx
+++ b/frontend/src/scenes/billing/BillingProductAddonActions.tsx
@@ -1,12 +1,12 @@
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
import { IconCheckCircle, IconPlus } from '@posthog/icons'
import { LemonButton, LemonButtonProps, LemonTag } from '@posthog/lemon-ui'
import { TRIAL_CANCELLATION_SURVEY_ID, UNSUBSCRIBE_SURVEY_ID } from 'lib/constants'
import { More } from 'lib/lemon-ui/LemonButton/More'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { BillingProductV2AddonType } from '~/types'
@@ -21,6 +21,21 @@ import { DATA_PIPELINES_CUTOFF_DATE } from './constants'
import { TrialCancellationSurveyModal } from './TrialCancellationSurveyModal'
import { UnsubscribeSurveyModal } from './UnsubscribeSurveyModal'
+function reportBillingAddonPlanSwitchStarted(
+ fromProduct: string,
+ toProduct: string,
+ reason: 'upgrade' | 'downgrade'
+): void {
+ const eventName =
+ reason === 'upgrade'
+ ? 'billing addon subscription upgrade clicked'
+ : 'billing addon subscription downgrade clicked'
+ posthog.capture(eventName, {
+ from_product: fromProduct,
+ to_product: toProduct,
+ })
+}
+
interface BillingProductAddonActionsProps {
addon: BillingProductV2AddonType
productRef?: React.RefObject<HTMLDivElement>
@@ -65,7 +80,7 @@ export const BillingProductAddonActions = ({
const { showConfirmUpgradeModal, showConfirmDowngradeModal, showConfirmPurchaseModal } = useActions(
billingProductLogic({ product: addon })
)
- const { reportBillingAddonPlanSwitchStarted } = useActions(eventUsageLogic)
+
const upgradePlan = currentAndUpgradePlans?.upgradePlan
const isTrialEligible = !!addon.trial
// amountDueToday is what will actually hit the card right now — prorated and net of any credit
diff --git a/frontend/src/scenes/dashboard/DashboardAiPromptComposer.tsx b/frontend/src/scenes/dashboard/DashboardAiPromptComposer.tsx
index 6ad6534a76f5..6b6518bda821 100644
--- a/frontend/src/scenes/dashboard/DashboardAiPromptComposer.tsx
+++ b/frontend/src/scenes/dashboard/DashboardAiPromptComposer.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
import type { FormEvent } from 'react'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
@@ -8,6 +9,19 @@ import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { dashboardAiPromptComposerLogic } from './dashboardAiPromptComposerLogic'
+function reportDashboardEmptyAiPromptClicked(
+ promptLabel: string,
+ dashboardId: number | undefined,
+ promptType: 'starter_question' | 'custom_prompt'
+): void {
+ posthog.capture('dashboard empty ai prompt clicked', {
+ prompt_label: promptLabel,
+ dashboard_id: dashboardId,
+ prompt_type: promptType,
+ source: 'web',
+ })
+}
+
type SamplePromptPreview = 'activity' | 'adoption' | 'retention' | 'paths'
const SAMPLE_PROMPTS: { question: string; prompt: string; preview: SamplePromptPreview }[] = [
@@ -113,7 +127,7 @@ export function DashboardAiPromptComposer({
}: DashboardAiPromptComposerProps): JSX.Element {
const { prompt, promptSource } = useValues(dashboardAiPromptComposerLogic)
const { setPrompt } = useActions(dashboardAiPromptComposerLogic)
- const { reportDashboardEmptyAiPromptClicked, reportDashboardEmptyAiPromptSubmitted } = useActions(eventUsageLogic)
+ const { reportDashboardEmptyAiPromptSubmitted } = useActions(eventUsageLogic)
const submitPrompt = (event: FormEvent<HTMLFormElement>): void => {
event.preventDefault()
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.test.ts b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
index 2f9942d7680c..f61545c2b423 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.test.ts
+++ b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
@@ -3,6 +3,7 @@ import { MOCK_TEAM_ID } from 'lib/api.mock'
import { router } from 'kea-router'
import { expectLogic, truth } from 'kea-test-utils'
+import posthog from 'posthog-js'
import { LemonDialog, lemonToast } from '@posthog/lemon-ui'
import * as dashboardWidgetUtils from '@posthog/products-dashboards/frontend/utils'
@@ -2165,6 +2166,28 @@ describe('dashboardLogic', () => {
})
})
+ it('captures a dashboard view after the logic unmounts during the debounce', async () => {
+ const capture = jest.spyOn(posthog, 'capture').mockImplementation()
+ jest.useFakeTimers()
+ try {
+ logic = dashboardLogic({ id: 5 })
+ logic.mount()
+ logic.actions.reportDashboardViewedEvent(dashboards[5], null)
+ expect(capture.mock.calls.filter(([event]) => event === 'viewed dashboard')).toHaveLength(0)
+ logic.unmount()
+ expect(logic.isMounted()).toBe(false)
+ await jest.advanceTimersByTimeAsync(499)
+ expect(capture.mock.calls.filter(([event]) => event === 'viewed dashboard')).toHaveLength(0)
+ await jest.advanceTimersByTimeAsync(1)
+ expect(capture.mock.calls.filter(([event]) => event === 'viewed dashboard')).toEqual([
+ ['viewed dashboard', expect.objectContaining({ dashboard_id: 5, source: 'web' })],
+ ])
+ } finally {
+ jest.useRealTimers()
+ capture.mockRestore()
+ }
+ })
+
describe('moving between dashboards', () => {
beforeEach(() => {
logic = dashboardLogic({ id: 9 })
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsx
index 1c69c4f4c5d0..6950aa2f363c 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx
+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx
@@ -45,7 +45,13 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { accessLevelSatisfied } from 'lib/utils/accessControlUtils'
import { deleteInsightWithUndo } from 'lib/utils/deleteWithUndo'
import { clearDOMTextSelection, getJSHeapMemory, uuid } from 'lib/utils/dom'
-import { DashboardEventSource, eventUsageLogic, sanitizeDashboard } from 'lib/utils/eventUsageLogic'
+import {
+ DashboardEventSource,
+ dashboardViewedProperties,
+ eventUsageLogic,
+ sanitizeDashboard,
+ sanitizeQuery,
+} from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { shouldCancelQuery } from 'lib/utils/requests'
import { toParams } from 'lib/utils/url'
@@ -160,6 +166,32 @@ import {
import { TileFiltersOverride } from './TileFiltersOverride'
import { tileLogic } from './tileLogic'
+function reportDashboardTileRefreshed(
+ dashboardId: number,
+ tile: DashboardTile,
+ filters: Record<string, any>,
+ variables: Record<string, any>,
+ refreshDurationMs: number,
+ individualRefresh: boolean
+): void {
+ const insight = tile.insight
+ const sanitizedQuery = insight?.query ? sanitizeQuery(insight.query) : {}
+
+ posthog.capture('dashboard insight refreshed', {
+ dashboard_id: dashboardId,
+ insight_id: insight?.id,
+ insight_short_id: insight?.short_id,
+ was_cached: tile.is_cached,
+ last_refreshed: insight?.last_refresh?.toString(),
+ refresh_age: insight?.last_refresh ? now().diff(insight?.last_refresh, 'seconds') : undefined,
+ filters,
+ variables,
+ refresh_duration_ms: refreshDurationMs,
+ individual_refresh: individualRefresh,
+ ...sanitizedQuery,
+ })
+}
+
export interface DashboardLogicProps {
id: number
dashboard?: DashboardType
@@ -707,6 +739,15 @@ export interface dashboardLogicActions {
reportDashboardViewed: () => {
value: true
}
+ reportDashboardViewedEvent: (
+ dashboard: DashboardType,
+ lastRefreshed: Dayjs | null,
+ delay?: number
+ ) => {
+ dashboard: DashboardType
+ delay: number | undefined
+ lastRefreshed: Dayjs | null
+ }
reportInsightsViewed: (insights: InsightModel[]) => {
insights: InsightModel<Node<Record<string, any>>>[]
}
@@ -1326,6 +1367,8 @@ function exitFilterEditModeWhenSaved(
}
}
+let dashboardViewedTimeout: ReturnType<typeof setTimeout> | undefined
+
export const dashboardLogic = kea<dashboardLogicType>([
path(['scenes', 'dashboard', 'dashboardLogic']),
connect(() => ({
@@ -1556,6 +1599,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
*/
setShouldReportOnAPILoad: (shouldReport: boolean) => ({ shouldReport }), // See reducer for details
reportDashboardViewed: true, // Reports `viewed dashboard` and `dashboard analyzed` events
+ reportDashboardViewedEvent: (dashboard: DashboardType, lastRefreshed: Dayjs | null, delay?: number) => ({
+ dashboard,
+ lastRefreshed,
+ delay,
+ }),
reportInsightsViewed: (insights: InsightModel[]) => ({ insights }),
/**
@@ -4159,7 +4207,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
tile.filters_overrides
)
- eventUsageLogic.actions.reportDashboardTileRefreshed(
+ reportDashboardTileRefreshed(
dashboardId,
tile,
urlFilters,
@@ -4277,7 +4325,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
if (refreshedInsight.is_cached) {
tilesRefreshedCachedCount++
}
- eventUsageLogic.actions.reportDashboardTileRefreshed(
+ reportDashboardTileRefreshed(
dashboardId,
tile,
urlFilters,
@@ -4734,12 +4782,25 @@ export const dashboardLogic = kea<dashboardLogicType>([
})
}
},
+ reportDashboardViewedEvent: ({ dashboard, lastRefreshed, delay }) => {
+ clearTimeout(dashboardViewedTimeout)
+ const captureDashboardView = (): void => {
+ const properties = dashboardViewedProperties(dashboard, lastRefreshed, userLogic.values.user?.uuid)
+ const eventName = delay ? 'dashboard analyzed' : 'viewed dashboard' // `viewed dashboard` name is kept for backwards compatibility
+ posthog.capture(eventName, { ...properties, source: 'web' })
+ }
+ if (delay) {
+ captureDashboardView()
+ } else {
+ dashboardViewedTimeout = setTimeout(captureDashboardView, 500) // Debounce to avoid noisy events from continuous navigation
+ }
+ },
reportDashboardViewed: async (_, breakpoint) => {
// Caching `dashboard`, as the dashboard might have unmounted after the breakpoint,
// and "values.dashboard" will then fail
const { dashboard, lastDashboardRefresh, tiles } = values
if (dashboard) {
- eventUsageLogic.actions.reportDashboardViewed(dashboard, lastDashboardRefresh)
+ actions.reportDashboardViewedEvent(dashboard, lastDashboardRefresh)
const insights = tiles.map((t) => t.insight).filter((i): i is InsightModel => !!i)
actions.reportInsightsViewed(insights)
@@ -4750,7 +4811,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
router.values.location.pathname === urls.projectHomepage() ||
router.values.location.pathname.startsWith(urls.sharedDashboard(''))
) {
- eventUsageLogic.actions.reportDashboardViewed(dashboard, lastDashboardRefresh, 10)
+ actions.reportDashboardViewedEvent(dashboard, lastDashboardRefresh, 10)
}
} else {
// dashboard has not loaded yet, report after API request is completed
diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.ts b/frontend/src/scenes/dashboard/newDashboardLogic.ts
index 134a19868bd2..d4dfdb41e879 100644
--- a/frontend/src/scenes/dashboard/newDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/newDashboardLogic.ts
@@ -19,7 +19,6 @@ import posthog from 'posthog-js'
import api from 'lib/api'
import { tryShowMCPHint } from 'lib/components/MCPHint/mcpHintLogic'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/types'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -258,7 +257,7 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
key(({ featureFlagId }) => featureFlagId ?? 'new'),
path(['scenes', 'dashboard', 'newDashboardLogic']),
connect(() => ({
- logic: [dashboardsModel, eventUsageLogic],
+ logic: [dashboardsModel],
})),
actions({
setIsLoading: (isLoading: boolean) => ({ isLoading }),
diff --git a/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.test.ts b/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.test.ts
index 624916fbd64e..22d65c938c1c 100644
--- a/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.test.ts
+++ b/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.test.ts
@@ -2,6 +2,7 @@ import { MOCK_TEAM_ID, api } from 'lib/api.mock'
import { combineUrl, router } from 'kea-router'
import { expectLogic, partial } from 'kea-test-utils'
+import posthog from 'posthog-js'
import { EVENT_DEFINITIONS_PER_PAGE, PROPERTY_DEFINITIONS_PER_EVENT } from 'lib/constants'
import { eventDefinitionsTableLogic } from 'scenes/data-management/events/eventDefinitionsTableLogic'
@@ -143,6 +144,7 @@ describe('eventDefinitionsTableLogic', () => {
describe('event definitions', () => {
it('load event definitions on navigate and cache', async () => {
+ const capture = jest.spyOn(posthog, 'capture')
const url = urls.eventDefinitions()
router.actions.push(url)
await expectLogic(logic)
@@ -160,6 +162,12 @@ describe('eventDefinitionsTableLogic', () => {
}),
})
+ expect(capture).toHaveBeenCalledWith(
+ 'event definitions page load succeeded',
+ expect.objectContaining({ num_results: 50 })
+ )
+ capture.mockRestore()
+
// Check cache directly
expect(logic.cache.apiCache).toMatchObject({
[startingUrl]: expect.objectContaining({
diff --git a/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts b/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts
index 09ea852eeb93..fef25d21c1f2 100644
--- a/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts
+++ b/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts
@@ -8,7 +8,6 @@ import { lemonToast } from '@posthog/lemon-ui'
import api, { PaginatedResponse } from 'lib/api'
import { convertPropertyGroupToProperties } from 'lib/components/PropertyFilters/utils'
import { EVENT_DEFINITIONS_PER_PAGE, PROPERTY_DEFINITIONS_PER_EVENT } from 'lib/constants'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { parseTagsFilter } from 'lib/utils/url'
import { projectLogic } from 'scenes/projectLogic'
@@ -683,44 +682,36 @@ export const eventDefinitionsTableLogic = kea<eventDefinitionsTableLogicType>([
},
loadEventDefinitionsSuccess: () => {
if (cache.eventsStartTime !== undefined) {
- if (eventUsageLogic.findMounted()) {
- posthog.capture('event definitions page load succeeded', {
- load_time: performance.now() - cache.eventsStartTime,
- num_results: values.eventDefinitions.results.length,
- })
- }
+ posthog.capture('event definitions page load succeeded', {
+ load_time: performance.now() - cache.eventsStartTime,
+ num_results: values.eventDefinitions.results.length,
+ })
cache.eventsStartTime = undefined
}
},
loadEventDefinitionsFailure: ({ error }) => {
if (cache.eventsStartTime !== undefined) {
- if (eventUsageLogic.findMounted()) {
- posthog.capture('event definitions page load failed', {
- load_time: performance.now() - cache.eventsStartTime,
- error: error ?? 'There was an unknown error fetching event definitions.',
- })
- }
+ posthog.capture('event definitions page load failed', {
+ load_time: performance.now() - cache.eventsStartTime,
+ error: error ?? 'There was an unknown error fetching event definitions.',
+ })
cache.eventsStartTime = undefined
}
},
loadPropertiesForEventSuccess: () => {
if (cache.propertiesStartTime !== undefined) {
- if (eventUsageLogic.findMounted()) {
- posthog.capture('event definitions page event nested properties load succeeded', {
- load_time: performance.now() - cache.propertiesStartTime,
- })
- }
+ posthog.capture('event definitions page event nested properties load succeeded', {
+ load_time: performance.now() - cache.propertiesStartTime,
+ })
cache.propertiesStartTime = undefined
}
},
loadPropertiesForEventFailure: ({ error }) => {
if (cache.propertiesStartTime !== undefined) {
- if (eventUsageLogic.findMounted()) {
- posthog.capture('event definitions page event nested properties load failed', {
- load_time: performance.now() - cache.propertiesStartTime,
- error: error ?? 'There was an unknown error fetching nested property definitions.',
- })
- }
+ posthog.capture('event definitions page event nested properties load failed', {
+ load_time: performance.now() - cache.propertiesStartTime,
+ error: error ?? 'There was an unknown error fetching nested property definitions.',
+ })
cache.propertiesStartTime = undefined
}
},
diff --git a/frontend/src/scenes/data-management/events/eventInsightsLogic.ts b/frontend/src/scenes/data-management/events/eventInsightsLogic.ts
index d90695fabcb1..93f372550fda 100644
--- a/frontend/src/scenes/data-management/events/eventInsightsLogic.ts
+++ b/frontend/src/scenes/data-management/events/eventInsightsLogic.ts
@@ -3,7 +3,6 @@ import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { Sorting } from 'lib/lemon-ui/LemonTable'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { toParams } from 'lib/utils/url'
import { InsightsResult, SavedInsightFilters, cleanFilters } from 'scenes/saved-insights/savedInsightsLogic'
@@ -86,7 +85,6 @@ export const eventInsightsLogic = kea<eventInsightsLogicType>([
key(({ event }) => event),
connect(() => ({
values: [teamLogic, ['currentTeamId']],
- logic: [eventUsageLogic],
})),
actions({
setFilters: (filters: Partial<SavedInsightFilters>) => ({ filters }),
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentWarningBanners.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentWarningBanners.tsx
index 6e47ebad648a..7876cce490b7 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentWarningBanners.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentWarningBanners.tsx
@@ -1,14 +1,24 @@
-import { useActions, useValues } from 'kea'
+import { useValues } from 'kea'
+import posthog from 'posthog-js'
import { useEffect } from 'react'
import { LemonBanner, Link } from '@posthog/lemon-ui'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { getEventPropertiesForExperiment } from 'lib/utils/eventUsageLogic'
import { urls } from 'scenes/urls'
+import type { Experiment } from '~/types'
+
import { experimentLogic } from '../experimentLogic'
import type { ExperimentWarning } from '../experimentLogic'
+function reportExperimentInconsistencyWarningShown(experiment: Experiment, warningKey: string): void {
+ posthog.capture('experiment inconsistency warning shown', {
+ ...getEventPropertiesForExperiment(experiment),
+ warning_key: warningKey,
+ })
+}
+
function warningCaption(key: ExperimentWarning['key']): string {
switch (key) {
case 'running_but_flag_disabled':
@@ -72,13 +82,12 @@ function WarningDetail({
export function ExperimentWarningBanner(): JSX.Element | null {
const { experimentWarning, experiment } = useValues(experimentLogic)
- const { reportExperimentInconsistencyWarningShown } = useActions(eventUsageLogic)
useEffect(() => {
if (experimentWarning) {
reportExperimentInconsistencyWarningShown(experiment, experimentWarning.key)
}
- }, [reportExperimentInconsistencyWarningShown, experimentWarning, experiment])
+ }, [experimentWarning, experiment])
if (!experimentWarning) {
return null
diff --git a/frontend/src/scenes/experiments/ExperimentView/MultiVariantBiasWarning.tsx b/frontend/src/scenes/experiments/ExperimentView/MultiVariantBiasWarning.tsx
index c0227be99a2f..4a0e0fe71ff9 100644
--- a/frontend/src/scenes/experiments/ExperimentView/MultiVariantBiasWarning.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/MultiVariantBiasWarning.tsx
@@ -1,9 +1,10 @@
import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
import { useEffect } from 'react'
import { LemonBanner, LemonButton, Link } from '@posthog/lemon-ui'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { getEventPropertiesForExperiment } from 'lib/utils/eventUsageLogic'
import { experimentLogic } from '../experimentLogic'
import { modalsLogic } from '../modalsLogic'
@@ -18,15 +19,14 @@ export function MultiVariantBiasWarning(): JSX.Element | null {
const { experiment, exposures, exposureCriteria } = useValues(experimentLogic)
const { openExposureCriteriaModal } = useActions(exposureCriteriaModalLogic)
const { openDistributionModal } = useActions(modalsLogic)
- const { reportExperimentBiasWarningShown } = useActions(eventUsageLogic)
const risk = exposures?.bias_risk
useEffect(() => {
if (risk) {
- reportExperimentBiasWarningShown(experiment)
+ posthog.capture('experiment bias warning shown', { ...getEventPropertiesForExperiment(experiment) })
}
- }, [reportExperimentBiasWarningShown, risk, experiment])
+ }, [risk, experiment])
if (!risk) {
return null
diff --git a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
index 4dc33552a61c..322eb0294983 100644
--- a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
@@ -16,6 +16,7 @@ import {
import type { BreakPointFunction } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
@@ -100,6 +101,16 @@ import {
parseExperimentRecordingsDeepLink,
} from './experimentRecordingsDeepLink'
+function reportExperimentRecordingsTabViewed(
+ experimentId: ExperimentIdType,
+ context: ExperimentRecordingsTabContext
+): void {
+ posthog.capture('experiment recordings tab viewed', {
+ experiment_id: experimentId,
+ ...context,
+ })
+}
+
export interface ExperimentReplayTabLogicProps {
experiment: Experiment
}
@@ -510,13 +521,6 @@ export interface experimentReplayTabLogicActions {
context: ExperimentRecordingsListRenderedContext
experimentId: ExperimentIdType
} // eventUsageLogic
- reportExperimentRecordingsTabViewed: (
- experimentId: ExperimentIdType,
- context: ExperimentRecordingsTabContext
- ) => {
- context: ExperimentRecordingsTabContext
- experimentId: ExperimentIdType
- } // eventUsageLogic
reportExperimentWatchCardSelected: (
experimentId: ExperimentIdType,
context: ExperimentWatchCardContext
@@ -887,7 +891,6 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
['loadSeenTogetherSuccess', 'loadSeenTogetherFailure'],
eventUsageLogic,
[
- 'reportExperimentRecordingsTabViewed',
'reportExperimentRecordingsBucketLoaded',
'reportExperimentRecordingsBucketFailed',
'reportExperimentRecordingsListRendered',
@@ -2189,7 +2192,7 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
return
}
cache.reportedTabView = true
- actions.reportExperimentRecordingsTabViewed(props.experiment.id, values.tabViewContext)
+ reportExperimentRecordingsTabViewed(props.experiment.id, values.tabViewContext)
},
scannerCrossSellClicked: () => {
void addProductIntentForCrossSell({
@@ -2309,7 +2312,7 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
// The dedup cache keeps an already-sent report from repeating.
if (!cache.reportedTabView) {
cache.reportedTabView = true
- actions.reportExperimentRecordingsTabViewed(props.experiment.id, values.tabViewContext)
+ reportExperimentRecordingsTabViewed(props.experiment.id, values.tabViewContext)
}
// A visit that ends before the first page arrives or fails is the largest part of the
// "tab viewed, no list" gap: the playlist waits out a debounce and then a request, and it
diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx
index fc5c19db1119..74fcd7df0384 100644
--- a/frontend/src/scenes/experiments/experimentLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentLogic.tsx
@@ -614,35 +614,6 @@ export interface experimentLogicActions {
isPrimary: boolean
metricUuid: string
} // eventUsageLogic
- reportExperimentMetricsRefreshed: (
- experiment: Experiment,
- forceRefresh: boolean,
- context?:
- | {
- auto_refresh_enabled?: boolean
- auto_refresh_interval?: number
- previous_refresh_age_ms?: number | null
- previous_refresh_id?: string | null
- previous_refresh_state?: string | null
- previous_refresh_triggered_by?: string | null
- triggered_by: 'auto-refresh' | 'manual'
- }
- | undefined
- ) => {
- context:
- | {
- auto_refresh_enabled?: boolean | undefined
- auto_refresh_interval?: number | undefined
- previous_refresh_age_ms?: number | null | undefined
- previous_refresh_id?: string | null | undefined
- previous_refresh_state?: string | null | undefined
- previous_refresh_triggered_by?: string | null | undefined
- triggered_by: 'auto-refresh' | 'manual'
- }
- | undefined
- experiment: Experiment
- forceRefresh: boolean
- } // eventUsageLogic
reportExperimentReleaseConditionsViewed: (experimentId: ExperimentIdType) => {
experimentId: ExperimentIdType
} // eventUsageLogic
@@ -949,6 +920,33 @@ export interface experimentLogicActions {
isSecondary: boolean
orderedUuids: string[]
}
+ reportExperimentMetricsRefreshed: (
+ experiment: Experiment,
+ forceRefresh: boolean,
+ context?: {
+ auto_refresh_enabled?: boolean
+ auto_refresh_interval?: number
+ previous_refresh_age_ms?: number | null
+ previous_refresh_id?: string | null
+ previous_refresh_state?: string | null
+ previous_refresh_triggered_by?: string | null
+ triggered_by: 'auto-refresh' | 'manual'
+ }
+ ) => {
+ context:
+ | {
+ auto_refresh_enabled?: boolean | undefined
+ auto_refresh_interval?: number | undefined
+ previous_refresh_age_ms?: number | null | undefined
+ previous_refresh_id?: string | null | undefined
+ previous_refresh_state?: string | null | undefined
+ previous_refresh_triggered_by?: string | null | undefined
+ triggered_by: 'auto-refresh' | 'manual'
+ }
+ | undefined
+ experiment: Experiment
+ forceRefresh: boolean
+ }
resetRunningExperiment: () => {
value: true
}
@@ -1350,7 +1348,6 @@ export const experimentLogic = kea<experimentLogicType>([
'reportExperimentTimeseriesViewed',
'reportExperimentTimeseriesRecalculated',
'reportExperimentAiSummaryRequested',
- 'reportExperimentMetricsRefreshed',
'reportExperimentMetricBreakdownAdded',
'reportExperimentMetricBreakdownRemoved',
],
@@ -1376,6 +1373,19 @@ export const experimentLogic = kea<experimentLogicType>([
],
})),
actions({
+ reportExperimentMetricsRefreshed: (
+ experiment: Experiment,
+ forceRefresh: boolean,
+ context?: {
+ triggered_by: 'manual' | 'auto-refresh'
+ auto_refresh_enabled?: boolean
+ auto_refresh_interval?: number
+ previous_refresh_id?: string | null
+ previous_refresh_age_ms?: number | null
+ previous_refresh_state?: string | null
+ previous_refresh_triggered_by?: string | null
+ }
+ ) => ({ experiment, forceRefresh, context }),
setExperimentMissing: true,
setExperiment: (experiment: Partial<Experiment>) => ({ experiment }),
setLaunchExperimentLoading: (loading: boolean) => ({ loading }),
@@ -2231,6 +2241,19 @@ export const experimentLogic = kea<experimentLogicType>([
],
}),
listeners(({ values, actions, asyncActions, cache, props }) => ({
+ reportExperimentMetricsRefreshed: ({ experiment, forceRefresh, context }) => {
+ posthog.capture('experiment metrics refreshed', {
+ ...getEventPropertiesForExperiment(experiment),
+ force_refresh: forceRefresh,
+ triggered_by: context?.triggered_by || 'manual',
+ auto_refresh_enabled: context?.auto_refresh_enabled,
+ auto_refresh_interval: context?.auto_refresh_interval,
+ previous_refresh_id: context?.previous_refresh_id ?? null,
+ previous_refresh_age_ms: context?.previous_refresh_age_ms ?? null,
+ previous_refresh_state: context?.previous_refresh_state ?? null,
+ previous_refresh_triggered_by: context?.previous_refresh_triggered_by ?? null,
+ })
+ },
beforeUnmount: () => {
clearTimeout(cache.notificationOfferTimer)
},
diff --git a/frontend/src/scenes/experiments/experimentMetricsLogic.ts b/frontend/src/scenes/experiments/experimentMetricsLogic.ts
index a10f1b19ddb1..7f8f2bbbe15b 100644
--- a/frontend/src/scenes/experiments/experimentMetricsLogic.ts
+++ b/frontend/src/scenes/experiments/experimentMetricsLogic.ts
@@ -1,10 +1,10 @@
import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { projectLogic } from 'scenes/projectLogic'
import type { FeatureFlagsSet } from '~/lib/logic/featureFlagLogic'
@@ -23,6 +23,23 @@ import type {
ExperimentMetricsRecalculationTriggerEnumApi,
} from 'products/experiments/frontend/generated/api.schemas'
+function reportExperimentMetricRecalculation(
+ status: 'triggered' | 'completed' | 'failed',
+ properties: {
+ experiment_id: number
+ recalculation_id: string | null
+ trigger?: ExperimentMetricsRecalculationTriggerEnumApi
+ is_existing?: boolean
+ total_metrics?: number
+ succeeded?: number
+ failed?: number
+ duration_ms?: number
+ poll_count?: number
+ }
+): void {
+ posthog.capture('experiment metric recalculation', { status, ...properties })
+}
+
type ExperimentSavedMetric = {
metadata: {
type: 'primary' | 'secondary'
@@ -199,33 +216,6 @@ export interface experimentMetricsLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface experimentMetricsLogicActions {
- reportExperimentMetricRecalculation: (
- status: 'completed' | 'failed' | 'triggered',
- properties: {
- duration_ms?: number
- experiment_id: number
- failed?: number
- is_existing?: boolean
- poll_count?: number
- recalculation_id: string | null
- succeeded?: number
- total_metrics?: number
- trigger?: ExperimentMetricsRecalculationTriggerEnumApi
- }
- ) => {
- properties: {
- duration_ms?: number | undefined
- experiment_id: number
- failed?: number | undefined
- is_existing?: boolean | undefined
- poll_count?: number | undefined
- recalculation_id: string | null
- succeeded?: number | undefined
- total_metrics?: number | undefined
- trigger?: ExperimentMetricsRecalculationTriggerEnumApi | undefined
- }
- status: 'completed' | 'failed' | 'triggered'
- } // eventUsageLogic
setFeatureFlags: (
flags: string[],
variants: Record<string, boolean | string>
@@ -307,7 +297,7 @@ export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
path((key) => ['scenes', 'experiment', 'experimentMetricsLogic', String(key)]),
connect(() => ({
values: [projectLogic, ['currentProjectId'], featureFlagLogic, ['featureFlags', 'receivedFeatureFlags']],
- actions: [eventUsageLogic, ['reportExperimentMetricRecalculation'], featureFlagLogic, ['setFeatureFlags']],
+ actions: [featureFlagLogic, ['setFeatureFlags']],
})),
actions({
setCurrentRecalculation: (recalculation: ExperimentMetricsRecalculationApi | null) => ({ recalculation }),
@@ -509,7 +499,7 @@ export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
*/
const emitTerminalEvent = (recalculation: ExperimentMetricsRecalculationApi): void => {
const startMs = cache.recalcStartMs ?? Date.now()
- actions.reportExperimentMetricRecalculation(
+ reportExperimentMetricRecalculation(
recalculation.status === RECALCULATION_STATUSES.completed ? 'completed' : 'failed',
{
experiment_id: props.experiment.id as number,
@@ -839,7 +829,7 @@ export const experimentMetricsLogic = kea<experimentMetricsLogicType>([
cache.pollCount = 0
cache.pollRetryCount = 0
actions.setCurrentRecalculation(recalculation)
- actions.reportExperimentMetricRecalculation('triggered', {
+ reportExperimentMetricRecalculation('triggered', {
experiment_id: experimentId,
recalculation_id: recalculation.id,
trigger,
diff --git a/frontend/src/scenes/experiments/experimentSceneLogic.tsx b/frontend/src/scenes/experiments/experimentSceneLogic.tsx
index 5a7e3c8eaa45..2cbabdab7769 100644
--- a/frontend/src/scenes/experiments/experimentSceneLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentSceneLogic.tsx
@@ -2,7 +2,6 @@ import {
MakeLogicType,
BuiltLogic,
actions,
- connect,
kea,
listeners,
path,
@@ -14,9 +13,9 @@ import {
import type { BreakPointFunction } from 'kea'
import { router, urlToAction } from 'kea-router'
import { subscriptions } from 'kea-subscriptions'
+import posthog from 'posthog-js'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -40,6 +39,13 @@ import { stepStorageKey } from './ExperimentWizard/experimentWizardLogic'
import { modalsLogic } from './modalsLogic'
import { isLegacyExperiment } from './utils'
+function reportExperimentTabViewed(experimentId: ExperimentIdType, tab: string): void {
+ posthog.capture('experiment tab viewed', {
+ experiment_id: experimentId,
+ tab,
+ })
+}
+
export const EXPERIMENT_TABS = ['metrics', 'settings', 'code', 'variants', 'recordings', 'feedback', 'history'] as const
export type ExperimentTab = (typeof EXPERIMENT_TABS)[number]
export const DEFAULT_EXPERIMENT_TAB: ExperimentTab = 'metrics'
@@ -123,13 +129,6 @@ export interface experimentSceneLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface experimentSceneLogicActions {
- reportExperimentTabViewed: (
- experimentId: ExperimentIdType,
- tab: string
- ) => {
- experimentId: ExperimentIdType
- tab: string
- } // eventUsageLogic
resetExperimentState: (experimentConfig: Experiment) => {
experimentConfig: Experiment
}
@@ -213,9 +212,6 @@ export type experimentSceneLogicType = MakeLogicType<
export const experimentSceneLogic = kea<experimentSceneLogicType>([
props({} as ExperimentSceneLogicProps),
path(['scenes', 'experiments', 'experimentSceneLogic']),
- connect(() => ({
- actions: [eventUsageLogic, ['reportExperimentTabViewed']],
- })),
actions({
setActiveTabKey: (activeTabKey: ExperimentTab) => ({ activeTabKey }),
setSceneState: (experimentId: Experiment['id'], formMode: FormModes) => ({ experimentId, formMode }),
@@ -418,12 +414,12 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
}
},
})),
- listeners(({ actions, selectors, sharedListeners, values }) => ({
+ listeners(({ selectors, sharedListeners, values }) => ({
// LemonTabs fires onChange on every tab click, including the already-active tab, so a
// dispatch that doesn't change the tab is not a view.
setActiveTabKey: ({ activeTabKey }, _breakpoint, _action, previousState) => {
if (values.experimentId !== 'new' && selectors.activeTabKey(previousState) !== activeTabKey) {
- actions.reportExperimentTabViewed(values.experimentId, activeTabKey)
+ reportExperimentTabViewed(values.experimentId, activeTabKey)
}
},
setSceneState: (payload, breakpoint, action, previousState) => {
@@ -528,7 +524,7 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
// The setActiveTabKey dispatch below reports tab changes; a landing on the
// already-active tab dispatches nothing, so it is reported here instead.
if (parsedId !== 'new' && targetTab === values.activeTabKey) {
- actions.reportExperimentTabViewed(parsedId, targetTab)
+ reportExperimentTabViewed(parsedId, targetTab)
}
if (parsedId === 'new') {
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
index d1015e8d30c5..b216e4e7f348 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
@@ -39,7 +39,6 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
import { deleteWithUndo } from 'lib/utils/deleteWithUndo'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { stringifyWithBigInts } from 'lib/utils/json'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { objectsEqual } from 'lib/utils/objects'
@@ -144,6 +143,18 @@ import {
} from './scheduleOccurrences'
import { flagToggleKey, updateFlagActiveInProject } from './updateFlagActiveInProject'
+function reportFailedToCreateFeatureFlagWithCohort(code: string, detail: string): void {
+ posthog.capture('failed to create feature flag with cohort', { detail, code })
+}
+
+function reportFeatureFlagCopyFailure(error: string): void {
+ posthog.capture('feature flag copy failure', { error })
+}
+
+function reportFeatureFlagScheduleSuccess(): void {
+ posthog.capture('feature flag scheduled')
+}
+
const VALID_INTENTS: FlagIntent[] = ['local-eval', 'first-page-load']
const TAB_SEARCH_PARAM = 'tab'
@@ -3166,7 +3177,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
return variantKeyToIndexFeatureFlagPayloads(savedFlag)
} catch (error: any) {
if (error.code === 'behavioral_cohort_found' || error.code === 'cohort_does_not_exist') {
- eventUsageLogic.actions.reportFailedToCreateFeatureFlagWithCohort(error.code, error.detail)
+ reportFailedToCreateFeatureFlagWithCohort(error.code, error.detail)
} else if (isAccessDeniedError(error)) {
// Mirror the load path's access-denied handling instead of the generic
// "Save feature flag failed: ..." toast. The global loaders handler
@@ -3210,7 +3221,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
return variantKeyToIndexFeatureFlagPayloads(savedFlag)
} catch (error: any) {
if (error.code === 'behavioral_cohort_found' || error.code === 'cohort_does_not_exist') {
- eventUsageLogic.actions.reportFailedToCreateFeatureFlagWithCohort(error.code, error.detail)
+ reportFailedToCreateFeatureFlagWithCohort(error.code, error.detail)
}
throw error
}
@@ -3767,7 +3778,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
lemonToast.success('Paired schedules created')
}
resetScheduleForm()
- eventUsageLogic.actions.reportFeatureFlagScheduleSuccess()
+ reportFeatureFlagScheduleSuccess()
},
showDependentFlagsConfirmation: sharedListeners.showDependentFlagsConfirmation,
enrichUsageDashboard: async (_, breakpoint) => {
@@ -4210,12 +4221,12 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
projectName ?? 'the destination project'
}; the copy will apply once approved.`
)
- eventUsageLogic.actions.reportFeatureFlagCopyFailure(failure.error_message ?? 'Approval pending')
+ reportFeatureFlagCopyFailure(failure.error_message ?? 'Approval pending')
} else {
const errorMessage =
failure?.error_message ?? stringifyWithBigInts(featureFlagCopy?.failed ?? featureFlagCopy)
lemonToast.error(`Error while copying feature flag: ${errorMessage}`)
- eventUsageLogic.actions.reportFeatureFlagCopyFailure(errorMessage)
+ reportFeatureFlagCopyFailure(errorMessage)
}
}
@@ -4266,7 +4277,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
actions.setCronExpression(null)
actions.setEndDate(null)
actions.loadScheduledChanges()
- eventUsageLogic.actions.reportFeatureFlagScheduleSuccess()
+ reportFeatureFlagScheduleSuccess()
}
},
setScheduledChangeOperation: ({ changeType }) => {
diff --git a/frontend/src/scenes/insights/insightLogic.tsx b/frontend/src/scenes/insights/insightLogic.tsx
index b3e3772d92df..d97664921f25 100644
--- a/frontend/src/scenes/insights/insightLogic.tsx
+++ b/frontend/src/scenes/insights/insightLogic.tsx
@@ -27,7 +27,7 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { accessLevelSatisfied } from 'lib/utils/accessControlUtils'
import { deleteInsightWithUndo } from 'lib/utils/deleteWithUndo'
-import { InsightEventSource, eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { InsightEventSource, sanitizeInsight, sanitizeQuery } from 'lib/utils/eventUsageLogic'
import { isEmptyObject, isObject } from 'lib/utils/guards'
import { objectsEqual } from 'lib/utils/objects'
import { isDashboardFilterOverrideEmpty } from 'scenes/dashboard/dashboardFilterEmpty'
@@ -90,6 +90,21 @@ import { insightDataLogic, isInsightSceneInstance } from './insightDataLogic'
import { getInsightId } from './utils'
import { insightsApi } from './utils/api'
+function reportInsightSaved(
+ insight: Partial<InsightModel> | null,
+ query: Node | null,
+ isNewInsight: boolean,
+ saveType: 'save' | 'save_as'
+): void {
+ // "insight saved" is a proxy for the new insight's results being valuable to the user
+ posthog.capture('insight saved', {
+ ...sanitizeQuery(query),
+ insight: sanitizeInsight(insight),
+ is_new_insight: isNewInsight,
+ save_type: saveType,
+ })
+}
+
export const UNSAVED_INSIGHT_MIN_REFRESH_INTERVAL_MINUTES = 3
export const createEmptyInsight = (shortId: InsightShortId | `new-${string}` | 'new'): Partial<InsightModel> => ({
@@ -573,7 +588,7 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
['activeSceneId'],
],
actions: [tagsModel, ['refreshTags'], teamLogic, ['addProductIntent']],
- logic: [eventUsageLogic, dashboardsModel],
+ logic: [dashboardsModel],
})),
actions({
@@ -1164,12 +1179,7 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
// and so we shouldn't copy the result from `values.insight` as it might be stale
const result = savedInsight.result || (values.query ? values.insight.result : null)
actions.setInsight({ ...savedInsight, result: result }, { fromPersistentApi: true, overrideQuery: true })
- eventUsageLogic.actions.reportInsightSaved(
- savedInsight,
- values.query,
- insightNumericId === undefined,
- 'save'
- )
+ reportInsightSaved(savedInsight, values.query, insightNumericId === undefined, 'save')
lemonToast.success(`Insight saved${dashboards?.length === 1 ? ' & added to dashboard' : ''}`, {
button: {
label: 'View Insights list',
@@ -1268,7 +1278,7 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
}
if (persist) {
- eventUsageLogic.actions.reportInsightSaved(insight, values.query, true, 'save_as')
+ reportInsightSaved(insight, values.query, true, 'save_as')
}
actions.reloadSavedInsights() // Load insights afresh
diff --git a/frontend/src/scenes/insights/insightSceneLogic.tsx b/frontend/src/scenes/insights/insightSceneLogic.tsx
index c25f396ab461..742a3705d6d6 100644
--- a/frontend/src/scenes/insights/insightSceneLogic.tsx
+++ b/frontend/src/scenes/insights/insightSceneLogic.tsx
@@ -18,7 +18,7 @@ import posthog from 'posthog-js'
import api from 'lib/api'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
-import { InsightEventSource, eventUsageLogic, sanitizeQuery } from 'lib/utils/eventUsageLogic'
+import { InsightEventSource, sanitizeQuery } from 'lib/utils/eventUsageLogic'
import { isEmptyObject, isObject } from 'lib/utils/guards'
import { isDashboardFilterOverrideEmpty } from 'scenes/dashboard/dashboardFilterEmpty'
import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'
@@ -321,7 +321,6 @@ export type insightSceneLogicType = MakeLogicType<
export const insightSceneLogic = kea<insightSceneLogicType>([
path(['scenes', 'insights', 'insightSceneLogic']),
connect(() => ({
- logic: [eventUsageLogic],
values: [
teamLogic,
['currentTeam', 'currentTeamId'],
diff --git a/frontend/src/scenes/insights/insightUsageLogic.ts b/frontend/src/scenes/insights/insightUsageLogic.ts
index b08f38253526..71c112cbed80 100644
--- a/frontend/src/scenes/insights/insightUsageLogic.ts
+++ b/frontend/src/scenes/insights/insightUsageLogic.ts
@@ -1,15 +1,18 @@
import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'
import { subscriptions } from 'kea-subscriptions'
+import posthog from 'posthog-js'
import api from 'lib/api'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
-import { objectsEqual } from 'lib/utils/objects'
+import { sanitizeInsight, sanitizeQuery } from 'lib/utils/eventUsageLogic'
+import { objectClean, objectsEqual } from 'lib/utils/objects'
import { projectLogic } from 'scenes/projectLogic'
+import { userLogic } from 'scenes/userLogic'
import { isSharedView } from '~/exporter/exporterViewLogic'
import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/insightVizKeys'
import { Node } from '~/queries/schema/schema-general'
+import { isNodeWithSource } from '~/queries/utils'
import { InsightLogicProps } from '~/types'
import type { DataNode } from '../../queries/schema/schema-general'
@@ -18,6 +21,41 @@ import { insightLogic } from './insightLogic'
import { insightSceneLogic } from './insightSceneLogic'
import { keyForInsightLogicProps } from './sharedUtils'
+function reportInsightViewed(
+ insightModel: Partial<InsightModel>,
+ query: Node | null,
+ isFirstLoad: boolean,
+ delay?: number
+): void {
+ const payload: Record<string, any> = {
+ report_delay: delay,
+ is_first_component_load: isFirstLoad,
+ viewer_is_creator:
+ insightModel.created_by?.uuid && userLogic.values.user?.uuid
+ ? insightModel.created_by?.uuid === userLogic.values.user?.uuid
+ : undefined,
+ is_saved: insightModel.saved,
+ description_length: insightModel.description?.length ?? 0,
+ tags_count: insightModel.tags?.length ?? 0,
+ insight: sanitizeInsight(insightModel),
+ insight_id: insightModel.id,
+ insight_short_id: insightModel.short_id,
+ ...sanitizeQuery(query),
+ }
+
+ // The view path passes a bare source node, so sanitizeQuery's `query_kind`/`query_source_kind`
+ // describe the source rather than the wrapper. Override them from the full stored query so
+ // `query_kind` consistently means the top-level node, matching every other insight event.
+ const modelQuery = insightModel.query as Node | null | undefined
+ if (modelQuery) {
+ payload.query_kind = modelQuery.kind
+ payload.query_source_kind = isNodeWithSource(modelQuery) ? modelQuery.source.kind : undefined
+ }
+
+ const eventName = delay ? 'insight analyzed' : 'insight viewed'
+ posthog.capture(eventName, objectClean({ ...payload, source: 'web' }))
+}
+
const IS_TEST_MODE = process.env.NODE_ENV === 'test'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -30,17 +68,6 @@ export interface insightUsageLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface insightUsageLogicActions {
- reportInsightViewed: (
- insightModel: Partial<InsightModel<Node<Record<string, any>>>>,
- query: Node<Record<string, any>> | null,
- isFirstLoad: boolean,
- delay?: number | undefined
- ) => {
- delay: number | undefined
- insightModel: Partial<InsightModel<Node<Record<string, any>>>>
- isFirstLoad: boolean
- query: Node<Record<string, any>> | null
- } // eventUsageLogic
onQueryChange: (
query: Node | null,
previousQuery?: Node | null
@@ -78,7 +105,6 @@ export const insightUsageLogic = kea<insightUsageLogicType>([
dataNodeLogic({ key: insightVizDataNodeKey(props) } as DataNodeLogicProps),
['query'],
],
- actions: [eventUsageLogic, ['reportInsightViewed']],
})),
actions({
onQueryChange: (query: Node | null, previousQuery?: Node | null) => ({
@@ -118,13 +144,13 @@ export const insightUsageLogic = kea<insightUsageLogicType>([
// Debounce to avoid noisy events from the query changing multiple times.
await breakpoint(IS_TEST_MODE ? 1 : 500)
- actions.reportInsightViewed(values.insight, query, values.isFirstLoad, 0)
+ reportInsightViewed(values.insight, query, values.isFirstLoad, 0)
actions.setNotFirstLoad()
// Record a second view after 10 seconds.
await breakpoint(IS_TEST_MODE ? 1 : 10000)
- actions.reportInsightViewed(values.insight, query, values.isFirstLoad, 10)
+ reportInsightViewed(values.insight, query, values.isFirstLoad, 10)
},
})),
subscriptions(({ actions }) => ({
diff --git a/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.ts b/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.ts
index a78dfff43ee4..357471028e4b 100644
--- a/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.ts
+++ b/frontend/src/scenes/onboarding/legacy/productSelection/productSelectionLogic.ts
@@ -1,5 +1,6 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { router } from 'kea-router'
+import posthog from 'posthog-js'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { getRelativeNextPath } from 'lib/utils/url'
@@ -25,6 +26,22 @@ import {
mapBrowsingHistoryToProducts,
} from './browsingHistoryMapping'
+function reportOnboardingProductSelectionPath(
+ path: 'ai' | 'use_case' | 'browsing_history' | 'manual',
+ properties?: {
+ useCase?: string
+ recommendedProducts?: string[]
+ hasBrowsingHistory?: boolean
+ }
+): void {
+ posthog.capture('onboarding product selection path', {
+ path,
+ use_case: properties?.useCase,
+ recommended_products: properties?.recommendedProducts,
+ has_browsing_history: properties?.hasBrowsingHistory,
+ })
+}
+
export type OnboardingStep = 'choose_path' | 'product_selection'
export type RecommendationSource = 'use_case' | 'browsing_history' | 'manual' | 'simplified' | 'multiproduct'
@@ -51,25 +68,6 @@ export interface productSelectionLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface productSelectionLogicActions {
- reportOnboardingProductSelectionPath: (
- path: 'ai' | 'browsing_history' | 'manual' | 'use_case',
- properties?:
- | {
- hasBrowsingHistory?: boolean
- recommendedProducts?: string[]
- useCase?: string
- }
- | undefined
- ) => {
- path: 'ai' | 'browsing_history' | 'manual' | 'use_case'
- properties:
- | {
- hasBrowsingHistory?: boolean | undefined
- recommendedProducts?: string[] | undefined
- useCase?: string | undefined
- }
- | undefined
- } // eventUsageLogic
reportOnboardingProductToggled: (
productKey: string,
selected: boolean,
@@ -161,7 +159,7 @@ export const productSelectionLogic = kea<productSelectionLogicType>([
onboardingLogic,
['setOnCompleteOnboardingRedirectUrl'],
eventUsageLogic,
- ['reportOnboardingStarted', 'reportOnboardingProductSelectionPath', 'reportOnboardingProductToggled'],
+ ['reportOnboardingStarted', 'reportOnboardingProductToggled'],
],
values: [teamLogic, ['currentTeam']],
})),
@@ -339,7 +337,7 @@ export const productSelectionLogic = kea<productSelectionLogicType>([
actions.setStep('product_selection')
// Analytics
- actions.reportOnboardingProductSelectionPath(hasBrowsingHistory ? 'browsing_history' : 'manual', {
+ reportOnboardingProductSelectionPath(hasBrowsingHistory ? 'browsing_history' : 'manual', {
recommendedProducts: hasBrowsingHistory ? values.browsingHistoryProducts : [],
hasBrowsingHistory,
})
@@ -357,7 +355,7 @@ export const productSelectionLogic = kea<productSelectionLogicType>([
actions.setStep('product_selection')
// Analytics
- actions.reportOnboardingProductSelectionPath('use_case', {
+ reportOnboardingProductSelectionPath('use_case', {
useCase,
recommendedProducts: mergedProducts,
hasBrowsingHistory: values.hasBrowsingHistory,
diff --git a/frontend/src/scenes/settings/user/PersonalIntegrations.tsx b/frontend/src/scenes/settings/user/PersonalIntegrations.tsx
index bfa207ed2475..16ffee888d0a 100644
--- a/frontend/src/scenes/settings/user/PersonalIntegrations.tsx
+++ b/frontend/src/scenes/settings/user/PersonalIntegrations.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
import { IconGithub, IconPlus, IconTrash } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonDialog, LemonSkeleton } from '@posthog/lemon-ui'
@@ -10,7 +11,6 @@ import { GitHubInstallRequestsBanner } from 'lib/integrations/GitHubInstallReque
import { GitHubRepoSummary } from 'lib/integrations/GitHubRepoSummary'
import { userGithubIntegrationLogic } from 'lib/integrations/userGithubIntegrationLogic'
import { IconSlack } from 'lib/lemon-ui/icons'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import {
LinkableSlackWorkspace,
@@ -19,6 +19,13 @@ import {
PersonalSlackIntegration,
} from './personalIntegrationsLogic'
+// Personal integrations are a separate table with their own connect surface, so they get
+// their own event: saved insights already count `integration_connect_clicked` unfiltered and
+// would silently start including personal links.
+function reportPersonalIntegrationConnectClicked(kind: string): void {
+ posthog.capture('personal integration connect clicked', { integration_kind: kind })
+}
+
function GitHubInstallationRow({ integration }: { integration: PersonalGitHubIntegration }): JSX.Element {
const { disconnectGitHub } = useActions(personalIntegrationsLogic)
@@ -181,7 +188,6 @@ function SlackLinkRow({ integration }: { integration: PersonalSlackIntegration }
export function PersonalGitHubIntegrations(): JSX.Element {
const { integrations, integrationsLoading, githubConnecting } = useValues(personalIntegrationsLogic)
const { connectGitHub, startPolling, stopPolling } = useActions(personalIntegrationsLogic)
- const { reportPersonalIntegrationConnectClicked } = useActions(eventUsageLogic)
// Refresh the personal rows while this section stays mounted, so an App removed on GitHub shows
// its unavailable notice without a manual reload.
diff --git a/frontend/src/scenes/surveys/forms/surveyFormBuilderLogic.ts b/frontend/src/scenes/surveys/forms/surveyFormBuilderLogic.ts
index 2f9292d96e8a..fa016c2ffdc8 100644
--- a/frontend/src/scenes/surveys/forms/surveyFormBuilderLogic.ts
+++ b/frontend/src/scenes/surveys/forms/surveyFormBuilderLogic.ts
@@ -1,10 +1,8 @@
import { MakeLogicType, connect, kea, key, path, props } from 'kea'
import { router, urlToAction } from 'kea-router'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { urls } from 'scenes/urls'
-import type { Survey } from '../../../types'
import { surveysLogic } from '../surveysLogic'
export interface SurveyFormBuilderLogicProps {
@@ -18,32 +16,6 @@ export interface surveyFormBuilderLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface surveyFormBuilderLogicActions {
- reportSurveyCreated: (
- survey: Survey,
- isDuplicate?: boolean | undefined,
- creationSource?:
- | 'form_builder'
- | 'full_editor'
- | 'llm_analytics'
- | 'quick_create'
- | 'template'
- | 'wizard'
- | undefined
- ) => {
- creationSource:
- | 'form_builder'
- | 'full_editor'
- | 'llm_analytics'
- | 'quick_create'
- | 'template'
- | 'wizard'
- | undefined
- isDuplicate: boolean | undefined
- survey: Survey
- } // eventUsageLogic
- reportSurveyEdited: (survey: Survey) => {
- survey: Survey
- } // eventUsageLogic
loadSurveys: () => any // surveysLogic
}
@@ -67,7 +39,7 @@ export const surveyFormBuilderLogic = kea<surveyFormBuilderLogicType>([
key((props) => props.id),
connect(() => ({
- actions: [surveysLogic, ['loadSurveys'], eventUsageLogic, ['reportSurveyCreated', 'reportSurveyEdited']],
+ actions: [surveysLogic, ['loadSurveys']],
values: [surveysLogic, ['formBuilderEnabled']],
})),
diff --git a/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.test.ts b/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.test.ts
index b75f937db199..9aca8bfcb7f5 100644
--- a/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.test.ts
+++ b/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.test.ts
@@ -4,6 +4,7 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { webAnalyticsLogic } from 'scenes/web-analytics/webAnalyticsLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -236,8 +237,17 @@ describe('webAnalyticsAchievementsLogic', () => {
] as const)('records a data interaction when %s fires', async (report) => {
enableAchievements()
await expectLogic(logic, () => {
- eventUsageLogic.mount()
- eventUsageLogic.actions[report]({} as any)
+ if (report === 'reportWebAnalyticsDateRangeChanged') {
+ webAnalyticsLogic.mount()
+ webAnalyticsLogic.actions.reportWebAnalyticsDateRangeChanged({
+ date_from: null,
+ date_to: null,
+ interval: 'day',
+ })
+ } else {
+ eventUsageLogic.mount()
+ eventUsageLogic.actions[report]({} as any)
+ }
})
.toDispatchActions(['recordInteraction'])
.toFinishAllListeners()
diff --git a/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.ts b/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.ts
index 97235c23f6d6..47e271710143 100644
--- a/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.ts
+++ b/frontend/src/scenes/web-analytics/achievements/webAnalyticsAchievementsLogic.ts
@@ -8,6 +8,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
+import { webAnalyticsLogic } from 'scenes/web-analytics/webAnalyticsLogic'
import {
webAnalyticsAchievementsAcknowledgeCelebration,
@@ -361,7 +362,7 @@ export const webAnalyticsAchievementsLogic = kea<webAnalyticsAchievementsLogicTy
[eventUsageLogic.actionTypes.reportWebAnalyticsFilterRemoved]: () => {
actions.recordInteraction(InteractionKindEnumApi.Data)
},
- [eventUsageLogic.actionTypes.reportWebAnalyticsDateRangeChanged]: () => {
+ [webAnalyticsLogic.actionTypes.reportWebAnalyticsDateRangeChanged]: () => {
actions.recordInteraction(InteractionKindEnumApi.Data)
},
[eventUsageLogic.actionTypes.reportWebAnalyticsCompareToggled]: () => {
diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
index 900af19d1100..404e605d33f1 100644
--- a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
+++ b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
@@ -398,6 +398,17 @@ export interface webAnalyticsLogicActions {
removeIncompatibleFilters: () => {
value: true
}
+ reportWebAnalyticsDateRangeChanged: (props: {
+ date_from: string | null
+ date_to: string | null
+ interval: string
+ }) => {
+ props: {
+ date_from: string | null
+ date_to: string | null
+ interval: string
+ }
+ }
resetTileVisibility: () => boolean
resetZoom: () => {
value: true
@@ -780,6 +791,11 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna
],
})),
actions({
+ reportWebAnalyticsDateRangeChanged: (props: {
+ date_from: string | null
+ date_to: string | null
+ interval: string
+ }) => ({ props }),
removeIncompatibleFilters: true,
setGraphsTab: (tab: string) => ({ tab }),
setSourceTab: (tab: string) => ({ tab }),
@@ -3756,7 +3772,7 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna
return {
setDates: ({ dateFrom, dateTo }) => {
- eventUsageLogic.actions.reportWebAnalyticsDateRangeChanged({
+ actions.reportWebAnalyticsDateRangeChanged({
date_from: dateFrom,
date_to: dateTo,
interval: values.dateFilter.interval,
@@ -3764,13 +3780,16 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna
globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.FilterWebAnalytics)
},
setDatesAndInterval: ({ dateFrom, dateTo, interval }) => {
- eventUsageLogic.actions.reportWebAnalyticsDateRangeChanged({
+ actions.reportWebAnalyticsDateRangeChanged({
date_from: dateFrom,
date_to: dateTo,
interval,
})
globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.FilterWebAnalytics)
},
+ reportWebAnalyticsDateRangeChanged: ({ props }) => {
+ posthog.capture('web analytics date range changed', props)
+ },
zoomIntoPeriod: ({ dateFrom, dateTo }) => {
if (values.preZoomDateFilter === null) {
actions.setPreZoomDateFilter({
diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/CustomerAnalyticsDashboardEvents.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/CustomerAnalyticsDashboardEvents.tsx
index 4a97e867653d..baa6b4e36239 100644
--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/CustomerAnalyticsDashboardEvents.tsx
+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/CustomerAnalyticsDashboardEvents.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
import { IconPlusSmall } from '@posthog/icons'
import { LemonButton, LemonLabel, Link } from '@posthog/lemon-ui'
@@ -23,6 +24,10 @@ import { isPageviewWithoutFilters } from 'products/customer_analytics/frontend/u
import { customerAnalyticsDashboardEventsLogic } from './customerAnalyticsDashboardEventsLogic'
+function reportCustomerAnalyticsDashboardEventPickerClicked({ event }: { event: string }): void {
+ posthog.capture('customer analytics dashboard event picker clicked', { event })
+}
+
export interface EventSelectorProps {
caption?: string
filters: FilterType | null
@@ -35,7 +40,7 @@ export interface EventSelectorProps {
function EventSelector({ filters, setFilters, title, caption, prompt }: EventSelectorProps): JSX.Element {
const { eventsToHighlight } = useValues(customerAnalyticsDashboardEventsLogic)
const highlight = eventsToHighlight.includes(title) ? 'border rounded border-dashed border-danger' : ''
- const { reportCustomerAnalyticsDashboardEventPickerClicked } = useActions(eventUsageLogic)
+
const restrictedReason = useRestrictedArea({
scope: RestrictionScope.Project,
minimumAccessLevel: TeamMembershipLevel.Admin,
diff --git a/products/groups/frontend/logics/groupLogic.ts b/products/groups/frontend/logics/groupLogic.ts
index 863d3da46fc9..40b91ae2dfba 100644
--- a/products/groups/frontend/logics/groupLogic.ts
+++ b/products/groups/frontend/logics/groupLogic.ts
@@ -7,7 +7,6 @@ import api, { ApiConfig } from 'lib/api'
import { FEATURE_FLAGS } from 'lib/constants'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { capitalizeFirstLetter } from 'lib/utils/strings'
import { getRelativeNextPath } from 'lib/utils/url'
@@ -29,6 +28,19 @@ import type { Noun } from '../../../../frontend/src/models/groupsModel'
import type { GroupType } from '../../../../frontend/src/types'
import { groupsFindRetrieve } from '../generated/api'
+function reportGroupPropertyUpdated(
+ action: 'added' | 'updated' | 'removed',
+ totalProperties: number,
+ oldPropertyType?: string,
+ newPropertyType?: string
+): void {
+ posthog.capture(`group property ${action}`, {
+ old_property_type: oldPropertyType !== 'undefined' ? oldPropertyType : undefined,
+ new_property_type: newPropertyType !== 'undefined' ? newPropertyType : undefined,
+ total_properties: totalProperties,
+ })
+}
+
function getGroupEventsQuery(groupTypeIndex: number, groupKey: string): DataTableNode {
return {
kind: NodeKind.DataTableNode,
@@ -351,7 +363,7 @@ export const groupLogic = kea<groupLogicType>([
await api.groups.updateProperty(group.group_type_index, group.group_key, key, parsedValue)
lemonToast.success(`Group property ${action}`)
- eventUsageLogic.actions.reportGroupPropertyUpdated(
+ reportGroupPropertyUpdated(
action,
Object.keys(group.group_properties).length,
oldPropertyType,
@@ -370,7 +382,7 @@ export const groupLogic = kea<groupLogicType>([
await api.groups.deleteProperty(group.group_type_index, group.group_key, key)
lemonToast.success(`Group property deleted`)
- eventUsageLogic.actions.reportGroupPropertyUpdated('removed', 1, undefined, undefined)
+ reportGroupPropertyUpdated('removed', 1, undefined, undefined)
}
},
})),
diff --git a/products/persons/frontend/logics/personsLogic.tsx b/products/persons/frontend/logics/personsLogic.tsx
index f733a1b62e54..4e7589866b5c 100644
--- a/products/persons/frontend/logics/personsLogic.tsx
+++ b/products/persons/frontend/logics/personsLogic.tsx
@@ -12,7 +12,6 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
import { delay } from 'lib/utils/async'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { isAbortedRequest } from 'lib/utils/requests'
import { toParams } from 'lib/utils/url'
@@ -48,6 +47,19 @@ import {
pickBestPersonDistinctId,
} from '../person-utils'
+function reportPersonPropertyUpdated(
+ action: 'added' | 'updated' | 'removed',
+ totalProperties: number,
+ oldPropertyType?: string,
+ newPropertyType?: string
+): void {
+ posthog.capture(`person property ${action}`, {
+ old_property_type: oldPropertyType !== 'undefined' ? oldPropertyType : undefined,
+ new_property_type: newPropertyType !== 'undefined' ? newPropertyType : undefined,
+ total_properties: totalProperties,
+ })
+}
+
export interface PersonsLogicProps {
cohort?: number | 'new'
syncWithUrl?: boolean
@@ -157,17 +169,6 @@ export interface personsLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface personsLogicActions {
- reportPersonPropertyUpdated: (
- action: 'added' | 'removed' | 'updated',
- totalProperties: number,
- oldPropertyType?: string | undefined,
- newPropertyType?: string | undefined
- ) => {
- action: 'added' | 'removed' | 'updated'
- newPropertyType: string | undefined
- oldPropertyType: string | undefined
- totalProperties: number
- } // eventUsageLogic
deleteProperty: (key: string) => {
key: string
}
@@ -359,7 +360,6 @@ export const personsLogic = kea<personsLogicType>([
}),
path((key) => ['scenes', 'persons', 'personsLogic', key]),
connect(() => ({
- actions: [eventUsageLogic, ['reportPersonPropertyUpdated']],
values: [teamLogic, ['currentTeam'], featureFlagLogic, ['featureFlags']],
})),
actions({
@@ -727,7 +727,7 @@ export const personsLogic = kea<personsLogicType>([
await api.persons.updateProperty(person.id, key, parsedValue)
lemonToast.success(`Person property ${action}`)
- actions.reportPersonPropertyUpdated(
+ reportPersonPropertyUpdated(
action,
Object.keys(updatedProperties).length,
oldPropertyType,
@@ -751,7 +751,7 @@ export const personsLogic = kea<personsLogicType>([
await api.persons.deleteProperty(person.id, key)
lemonToast.success(`Person property deleted`)
- actions.reportPersonPropertyUpdated('removed', 1, undefined, undefined)
+ reportPersonPropertyUpdated('removed', 1, undefined, undefined)
} catch {
actions.setPerson({ ...person })
lemonToast.error(`Failed to delete person property`)