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): inline single-use event usage actions (#107461)

Paul D'Ambra8a0aafad4e59
diff --git a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
index 925db6970bdb..0aab941296e3 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
@@ -32,7 +32,6 @@ import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { ContextMenuGroup, ContextMenuItem } from 'lib/ui/ContextMenu/ContextMenu'
import { DropdownMenuGroup } from 'lib/ui/DropdownMenu/DropdownMenu'
import { cn } from 'lib/utils/css-classes'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { sceneConfigurations } from 'scenes/scenes'
@@ -305,10 +304,10 @@ export function ProjectTree(props: ProjectTreeProps): JSX.Element {
}
if (item?.id.startsWith('shortcuts')) {
- eventUsageLogic.actions.reportNavbarStarredItemClicked(
- item?.record?.type || 'unknown',
- item?.name || 'unknown'
- )
+ posthog.capture('navbar starred item clicked', {
+ item_type: item?.record?.type || 'unknown',
+ item_name: item?.name || 'unknown',
+ })
}
// False, because we handle focus of content in LemonTree with mainContentRef prop
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
index eec3377e6984..cfd5a1d12cb2 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
@@ -15,7 +15,6 @@ import { Spinner } from 'lib/lemon-ui/Spinner'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { getEntryAccessDisabledReason, getProductAccessDisabledReason } from 'lib/utils/accessControlUtils'
import { withTimeout } from 'lib/utils/async'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { getCurrentTeamIdOrNone, getCurrentUserIdOrNone } from 'lib/utils/getAppContext'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { capitalizeFirstLetter, humanList, identifierToHuman, pluralize } from 'lib/utils/strings'
@@ -1067,7 +1066,10 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
href: item.href,
}
const response = await api.fileSystemShortcuts.create(shortcutItem)
- eventUsageLogic.actions.reportNavbarStarredItemAdded(shortcutItem.type ?? 'unknown', shortcutPath)
+ posthog.capture('navbar starred item added', {
+ item_type: shortcutItem.type ?? 'unknown',
+ item_name: shortcutPath,
+ })
lemonToast.success('Added to starred')
return [...values.shortcutData, response]
},
@@ -1086,10 +1088,10 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
deleteShortcut: async ({ id }) => {
const shortcut = values.shortcutData.find((s) => s.id === id)
await api.fileSystemShortcuts.delete(id)
- eventUsageLogic.actions.reportNavbarStarredItemRemoved(
- shortcut?.type ?? 'unknown',
- shortcut?.path ?? 'unknown'
- )
+ posthog.capture('navbar starred item removed', {
+ item_type: shortcut?.type ?? 'unknown',
+ item_name: shortcut?.path ?? 'unknown',
+ })
lemonToast.success('Removed from starred')
return values.shortcutData.filter((s) => s.id !== id)
},
@@ -1821,7 +1823,10 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
actions.reorderShortcuts(next)
},
reorderShortcutsSuccess: ({ shortcutData }) => {
- eventUsageLogic.actions.reportNavbarStarredItemsReordered(shortcutData.length, true)
+ posthog.capture('navbar starred items reordered', {
+ item_count: shortcutData.length,
+ is_ai_first: true,
+ })
},
reorderShortcutsFailure: () => {
actions.loadShortcuts()
diff --git a/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts b/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts
index 77c294d0d1b6..3949635a9270 100644
--- a/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts
+++ b/frontend/src/lib/components/DefinitionPopover/definitionPopoverLogic.ts
@@ -2,6 +2,7 @@ import { deepEqual as equal } from 'fast-equals'
import { MakeLogicType, actions, connect, events, kea, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { getSingularType } from 'lib/components/DefinitionPopover/utils'
@@ -465,24 +466,24 @@ export const definitionPopoverLogic = kea<definitionPopoverLogicType>([
},
handleSaveSuccess: () => {
if (cache.startTime !== undefined) {
- eventUsageLogic
- .findMounted()
- ?.actions?.reportDataManagementDefinitionSaveSucceeded(
- values.type,
- performance.now() - cache.startTime
- )
+ if (eventUsageLogic.findMounted()) {
+ posthog.capture('definition save succeeded', {
+ type: values.type,
+ load_time: performance.now() - cache.startTime,
+ })
+ }
cache.startTime = undefined
}
},
handleSaveFailure: ({ error }) => {
if (cache.startTime !== undefined) {
- eventUsageLogic
- .findMounted()
- ?.actions?.reportDataManagementDefinitionSaveFailed(
- values.type,
- performance.now() - cache.startTime,
- error
- )
+ if (eventUsageLogic.findMounted()) {
+ posthog.capture('definition save failed', {
+ type: values.type,
+ load_time: performance.now() - cache.startTime,
+ error: error,
+ })
+ }
cache.startTime = undefined
}
},
@@ -490,13 +491,18 @@ export const definitionPopoverLogic = kea<definitionPopoverLogicType>([
actions.setPopoverState(DefinitionPopoverState.View)
actions.setLocalDefinition(values.definition)
props?.onCancel?.()
- eventUsageLogic.findMounted()?.actions?.reportDataManagementDefinitionCancel(values.type)
+ if (eventUsageLogic.findMounted()) {
+ 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
- eventUsageLogic
- .findMounted()
- ?.actions?.reportDataManagementDefinitionHovered(values.type, values.mediaPreviews.length)
+ if (eventUsageLogic.findMounted()) {
+ posthog.capture('definition hovered', {
+ type: values.type,
+ media_preview_count: values.mediaPreviews.length ?? 0,
+ })
+ }
},
})),
events(({ actions }) => ({
diff --git a/frontend/src/lib/components/ExportButton/exportsLogic.ts b/frontend/src/lib/components/ExportButton/exportsLogic.ts
index 2983055db973..7b5316b2ffe5 100644
--- a/frontend/src/lib/components/ExportButton/exportsLogic.ts
+++ b/frontend/src/lib/components/ExportButton/exportsLogic.ts
@@ -18,7 +18,6 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { ToastButton } from 'lib/lemon-ui/LemonToast/LemonToast'
import { delay } from 'lib/utils/async'
import { uuid } from 'lib/utils/dom'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import type { SessionRecordingPlayerMode } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
import { urls } from 'scenes/urls'
@@ -278,7 +277,10 @@ export const exportsLogic = kea<exportsLogicType>([
// Fires for every dashboard export entry point (menu bar, dropdown, export button)
// regardless of edit permission. Format is a property so PNG is filterable.
if (exportData.dashboard && exportData.export_format) {
- eventUsageLogic.actions.reportDashboardExported(exportData.dashboard, exportData.export_format)
+ posthog.capture('dashboard exported', {
+ dashboard_id: exportData.dashboard,
+ export_format: exportData.export_format,
+ })
}
if (isLocalExport(exportData.export_context)) {
diff --git a/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts b/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts
index 07cefa149847..fdbb14118dc8 100644
--- a/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts
+++ b/frontend/src/lib/components/PropertyFilters/components/taxonomicPropertyFilterLogic.ts
@@ -1,4 +1,5 @@
import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import posthog from 'posthog-js'
import { TaxonomicPropertyFilterLogicProps } from 'lib/components/PropertyFilters/types'
import { isValidPropertyFilter } from 'lib/components/PropertyFilters/utils'
@@ -153,7 +154,7 @@ export const taxonomicPropertyFilterLogic = kea<taxonomicPropertyFilterLogicType
const existingFilter = props.filters[props.filterIndex]
if (!existingFilter || !isValidPropertyFilter(existingFilter)) {
if (eventUsageLogic.isMounted()) {
- eventUsageLogic.actions.reportTaxonomicFilterAddFilterClicked(props.eventNames?.[0])
+ posthog.capture('taxonomic filter add filter clicked', { eventName: props.eventNames?.[0] })
}
}
},
diff --git a/frontend/src/lib/components/Sharing/sharingLogic.ts b/frontend/src/lib/components/Sharing/sharingLogic.ts
index 571b8d4e42be..3aea5c1c2edd 100644
--- a/frontend/src/lib/components/Sharing/sharingLogic.ts
+++ b/frontend/src/lib/components/Sharing/sharingLogic.ts
@@ -2,10 +2,10 @@ import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path,
import { forms } from 'kea-forms'
import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { preflightLogic } from 'lib/logic/preflightLogic'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { getInsightId } from 'scenes/insights/utils'
import { organizationLogic } from 'scenes/organizationLogic'
import { urls } from 'scenes/urls'
@@ -386,7 +386,7 @@ export const sharingLogic = kea<sharingLogicType>([
listeners(({ props, values, actions }) => ({
setIsEnabled: (enabled) => {
if (props.dashboardId) {
- eventUsageLogic.actions.reportDashboardShareToggled(props.dashboardId, enabled)
+ posthog.capture(`dashboard share toggled`, { dashboard_id: props.dashboardId, is_shared: enabled })
}
},
setIsEnabledSuccess: () => {
@@ -396,10 +396,13 @@ export const sharingLogic = kea<sharingLogicType>([
},
setSharingSettingsValue: ({ name, value }) => {
if (name === 'whitelabel' && props.dashboardId) {
- eventUsageLogic.actions.reportDashboardWhitelabelToggled(props.dashboardId, value)
+ posthog.capture(`dashboard whitelabel toggled`, {
+ dashboard_id: props.dashboardId,
+ is_whitelabelled: value,
+ })
}
if (name === 'whitelabel' && props.insightShortId) {
- eventUsageLogic.actions.reportInsightWhitelabelToggled(value)
+ posthog.capture(`insight whitelabel toggled`, { is_whitelabelled: value })
}
// Auto-save all embed config changes to settings
if (values.sharingConfiguration) {
diff --git a/frontend/src/lib/components/UpgradeModal/upgradeModalLogic.ts b/frontend/src/lib/components/UpgradeModal/upgradeModalLogic.ts
index 90a98c29fc94..656e182adf13 100644
--- a/frontend/src/lib/components/UpgradeModal/upgradeModalLogic.ts
+++ b/frontend/src/lib/components/UpgradeModal/upgradeModalLogic.ts
@@ -1,7 +1,7 @@
import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import posthog from 'posthog-js'
import { preflightLogic } from 'lib/logic/preflightLogic'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { billingLogic } from 'scenes/billing/billingLogic'
import { userLogic } from 'scenes/userLogic'
@@ -178,7 +178,7 @@ export const upgradeModalLogic = kea<upgradeModalLogicType>([
})),
listeners(() => ({
showUpgradeModal: ({ featureKey }) => {
- eventUsageLogic.actions.reportUpgradeModalShown(featureKey)
+ posthog.capture('upgrade modal shown', { featureName: featureKey })
},
})),
])
diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.ts
index da78b9db7240..239270862dbb 100644
--- a/frontend/src/lib/utils/eventUsageLogic.ts
+++ b/frontend/src/lib/utils/eventUsageLogic.ts
@@ -55,20 +55,14 @@ import {
CohortType,
DashboardTileSpacing,
DashboardMode,
- DashboardTemplateScope,
DashboardTile,
- DashboardWidgetType,
DashboardType,
- EntityType,
Experiment,
ExperimentHoldoutType,
ExperimentIdType,
ExperimentStatsMethod,
- ExporterFormat,
- FilterLogicalOperator,
FunnelCorrelation,
HelpType,
- InsightShortId,
MultipleSurveyQuestion,
OnboardingStepKey,
ProductTour,
@@ -629,7 +623,7 @@ function sanitizeTile(tile: DashboardTile | null): object | undefined {
}
}
-function sanitizeDashboard(dashboard: DashboardType | null): object | null {
+export function sanitizeDashboard(dashboard: DashboardType | null): object | null {
if (!dashboard) {
return null
}
@@ -868,29 +862,6 @@ export interface eventUsageLogicActions {
reportBounceRatePageViewModeUpdated: (mode: string) => {
mode: string
}
- reportChangeInnerPropertyGroupFiltersType: (
- type: FilterLogicalOperator,
- filtersLength: number
- ) => {
- filtersLength: number
- type: FilterLogicalOperator
- }
- reportChangeOuterPropertyGroupFiltersType: (
- type: FilterLogicalOperator,
- groupsLength: number
- ) => {
- groupsLength: number
- type: FilterLogicalOperator
- }
- reportCopiedDashboardTileToDashboard: (
- fromDashboardId: number,
- toDashboardId: number,
- tileType: DashboardWidgetType
- ) => {
- fromDashboardId: number
- tileType: DashboardWidgetType
- toDashboardId: number
- }
reportCorrelationInteraction: (
correlationType: FunnelCorrelation['result_type'],
action: string,
@@ -965,15 +936,6 @@ export interface eventUsageLogicActions {
reportCustomerJourneyExistingFunnelSelected: (insightId: number) => {
insightId: number
}
- reportCustomerJourneyPathExpanded: (
- pathType: string,
- dropOff: boolean,
- stepIndex: number
- ) => {
- dropOff: boolean
- pathType: string
- stepIndex: number
- }
reportCustomerJourneyStepAddedFromPath: (
eventName: string,
pathType: string,
@@ -1020,24 +982,6 @@ export interface eventUsageLogicActions {
dashboardId: number
source: 'header'
}
- reportDashboardBreakdownColorsSaved: (
- dashboard: DashboardType | null,
- manualCount: number,
- autoCount: number,
- breakdownTypes: string[]
- ) => {
- autoCount: number
- breakdownTypes: string[]
- dashboard: DashboardType | null
- manualCount: number
- }
- reportDashboardColorThemeSet: (
- dashboard: DashboardType | null,
- themeId: number | null
- ) => {
- dashboard: DashboardType | null
- themeId: number | null
- }
reportDashboardDateRangeChanged: (
dashboard: DashboardType | null,
dateFrom?: string | Dayjs | null,
@@ -1076,13 +1020,6 @@ export interface eventUsageLogicActions {
reportDashboardEmptyWebAnalyticsClicked: (dashboardId: number | undefined) => {
dashboardId: number | undefined
}
- reportDashboardExported: (
- dashboardId: number,
- exportFormat: ExporterFormat
- ) => {
- dashboardId: number
- exportFormat: ExporterFormat
- }
reportDashboardFiltersChanged: (
dashboard: DashboardType | null,
changeType: DashboardFilterChangeType,
@@ -1092,17 +1029,6 @@ export interface eventUsageLogicActions {
dashboard: DashboardType | null
properties: Record<string, boolean | number | string | null | undefined>
}
- reportDashboardFrontEndUpdate: (
- dashboardId: number | undefined,
- attribute: 'description' | 'name' | 'tags',
- originalLength: number,
- newLength: number
- ) => {
- attribute: 'description' | 'name' | 'tags'
- dashboardId: number | undefined
- newLength: number
- originalLength: number
- }
reportDashboardInsightAnnotationsToggled: (
dashboardId: number | undefined,
insightId: number,
@@ -1115,9 +1041,6 @@ export interface eventUsageLogicActions {
reportDashboardInsightDeleteAfterRemovalClicked: (otherDashboardCount: number) => {
otherDashboardCount: number
}
- reportDashboardInsightDeleteAfterRemovalConfirmed: (otherDashboardCount: number) => {
- otherDashboardCount: number
- }
reportDashboardInsightLegendToggled: (
dashboardId: number | undefined,
insightId: number,
@@ -1154,22 +1077,6 @@ export interface eventUsageLogicActions {
layoutZoom: number | null
source: DashboardEventSource
}
- reportDashboardLayoutZoomChanged: (
- dashboard: DashboardType | null,
- layoutZoom: number,
- source: 'button' | 'shortcut'
- ) => {
- dashboard: DashboardType | null
- layoutZoom: number
- source: 'button' | 'shortcut'
- }
- reportDashboardLoadingTime: (
- loadingMilliseconds: number,
- dashboardId: number
- ) => {
- dashboardId: number
- loadingMilliseconds: number
- }
reportDashboardModeToggled: (
dashboard: DashboardType | null,
mode: DashboardMode | null,
@@ -1202,56 +1109,9 @@ export interface eventUsageLogicActions {
reportDashboardPropertiesChanged: (dashboard: DashboardType | null) => {
dashboard: DashboardType | null
}
- reportDashboardRefreshed: (
- dashboardId: number,
- filters: Record<string, any>,
- variables: Record<string, any>,
- lastRefreshed: string | Dayjs | null,
- action: string,
- forceRefresh: boolean,
- insightsRefreshedInfo: {
- refreshDurationMs: number
- tilesAbortedCount: number
- tilesErroredCount: number
- tilesRefreshedCount: number
- tilesStaleCount: number
- totalTileCount: number
- }
- ) => {
- action: string
- dashboardId: number
- filters: Record<string, any>
- forceRefresh: boolean
- insightsRefreshedInfo: {
- refreshDurationMs: number
- tilesAbortedCount: number
- tilesErroredCount: number
- tilesRefreshedCount: number
- tilesStaleCount: number
- totalTileCount: number
- }
- lastRefreshed: string | Dayjs | null
- variables: Record<string, any>
- }
- reportDashboardShareToggled: (
- dashboardId: number | undefined,
- isShared: boolean
- ) => {
- dashboardId: number | undefined
- isShared: boolean
- }
reportDashboardTileDensityConfigured: (tileDensity: DashboardTileSpacing) => {
tileDensity: DashboardTileSpacing
}
- reportDashboardTileIgnoreDashboardFiltersToggled: (
- dashboardId: number | undefined,
- insightId: number | null,
- ignored: boolean
- ) => {
- dashboardId: number | undefined
- ignored: boolean
- insightId: number | null
- }
reportDashboardTileRefreshed: (
dashboardId: number,
tile: DashboardTile,
@@ -1285,95 +1145,15 @@ export interface eventUsageLogicActions {
delay: number | undefined
lastRefreshed: Dayjs | null
}
- reportDashboardWhitelabelToggled: (
- dashboardId: number | undefined,
- isWhiteLabelled: boolean
- ) => {
- dashboardId: number | undefined
- isWhiteLabelled: boolean
- }
- reportDataManagementDefinitionCancel: (type: TaxonomicFilterGroupType) => {
- type: TaxonomicFilterGroupType
- }
reportDataManagementDefinitionClickEdit: (type: TaxonomicFilterGroupType) => {
type: TaxonomicFilterGroupType
}
reportDataManagementDefinitionClickView: (type: TaxonomicFilterGroupType) => {
type: TaxonomicFilterGroupType
}
- reportDataManagementDefinitionHovered: (
- type: TaxonomicFilterGroupType,
- mediaPreviewCount?: number
- ) => {
- mediaPreviewCount: number | undefined
- type: TaxonomicFilterGroupType
- }
- reportDataManagementDefinitionSaveFailed: (
- type: TaxonomicFilterGroupType,
- loadTime: number,
- error: string
- ) => {
- error: string
- loadTime: number
- type: TaxonomicFilterGroupType
- }
- reportDataManagementDefinitionSaveSucceeded: (
- type: TaxonomicFilterGroupType,
- loadTime: number
- ) => {
- loadTime: number
- type: TaxonomicFilterGroupType
- }
- reportDataManagementEventDefinitionsPageLoadFailed: (
- loadTime: number,
- error: string
- ) => {
- error: string
- loadTime: number
- }
- reportDataManagementEventDefinitionsPageLoadSucceeded: (
- loadTime: number,
- resultsLength: number
- ) => {
- loadTime: number
- resultsLength: number
- }
- reportDataManagementEventDefinitionsPageNestedPropertiesLoadFailed: (
- loadTime: number,
- error: string
- ) => {
- error: string
- loadTime: number
- }
- reportDataManagementEventDefinitionsPageNestedPropertiesLoadSucceeded: (loadTime: number) => {
- loadTime: number
- }
- reportDataManagementEventPropertyDefinitionsPageLoadFailed: (
- loadTime: number,
- error: string
- ) => {
- error: string
- loadTime: number
- }
- reportDataManagementEventPropertyDefinitionsPageLoadSucceeded: (
- loadTime: number,
- resultsLength: number
- ) => {
- loadTime: number
- resultsLength: number
- }
reportDataTableColumnsUpdated: (context_type: string) => {
context_type: string
}
- reportEntityFilterVisibilitySet: (
- index: number,
- visible: boolean,
- entityName?: string
- ) => {
- entityName: string | undefined
- index: number
- visible: boolean
- }
reportExperimentAiSummaryRequested: (experiment: Experiment) => {
experiment: Experiment
}
@@ -1423,13 +1203,6 @@ export interface eventUsageLogicActions {
dashboardId: number
experiment: Experiment
}
- reportExperimentEndDateChange: (
- experiment: Experiment,
- newEndDate: string
- ) => {
- experiment: Experiment
- newEndDate: string
- }
reportExperimentExposureCohortCreated: (
experiment: Experiment,
cohort: CohortType
@@ -1638,52 +1411,12 @@ export interface eventUsageLogicActions {
context: ExperimentRecordingsTabContext
experimentId: ExperimentIdType
}
- reportExperimentReleaseConditionsUpdated: (experimentId: ExperimentIdType) => {
- experimentId: ExperimentIdType
- }
reportExperimentReleaseConditionsViewed: (experimentId: ExperimentIdType) => {
experimentId: ExperimentIdType
}
reportExperimentResultsLoadingTimeout: (experimentId: ExperimentIdType) => {
experimentId: ExperimentIdType
}
- reportExperimentResultsRefreshCompleted: (
- experimentId: ExperimentIdType,
- teamId: number | null | undefined,
- context: {
- cached_count: number
- errored_count: number
- execution_mode: 'async' | 'sync'
- experiment_duration_hours: number | null
- experiment_status: string | null
- force_refresh: boolean
- primary_metrics_count: number
- refresh_id: string
- secondary_metrics_count: number
- successful_count: number
- total_duration_ms: number
- total_metrics_count: number
- triggered_by: 'auto_refresh' | 'experiment_config_change' | 'manual' | 'metric_config_change' | 'page_load'
- }
- ) => {
- context: {
- cached_count: number
- errored_count: number
- execution_mode: 'async' | 'sync'
- experiment_duration_hours: number | null
- experiment_status: string | null
- force_refresh: boolean
- primary_metrics_count: number
- refresh_id: string
- secondary_metrics_count: number
- successful_count: number
- total_duration_ms: number
- total_metrics_count: number
- triggered_by: 'auto_refresh' | 'experiment_config_change' | 'manual' | 'metric_config_change' | 'page_load'
- }
- experimentId: ExperimentIdType
- teamId: number | null | undefined
- }
reportExperimentSharedMetricAssigned: (
experimentId: ExperimentIdType,
sharedMetric: SharedMetric
@@ -1694,13 +1427,6 @@ export interface eventUsageLogicActions {
reportExperimentSharedMetricCreated: (sharedMetric: SharedMetric) => {
sharedMetric: SharedMetric
}
- reportExperimentStartDateChange: (
- experiment: Experiment,
- newStartDate: string
- ) => {
- experiment: Experiment
- newStartDate: string
- }
reportExperimentTabViewed: (
experimentId: ExperimentIdType,
tab: string
@@ -1785,25 +1511,6 @@ export interface eventUsageLogicActions {
reportFeatureFlagCopyFailure: (error: any) => {
error: any
}
- reportFeatureFlagCopySuccess: () => {
- value: true
- }
- reportFeatureFlagCreatedInAdditionalProjects: (
- targetCount: number,
- createdCount: number,
- overwrittenCount: number,
- pendingApprovalCount: number,
- failedCount: number
- ) => {
- createdCount: number
- failedCount: number
- overwrittenCount: number
- pendingApprovalCount: number
- targetCount: number
- }
- reportFeatureFlagScheduleFailure: (error: any) => {
- error: any
- }
reportFeatureFlagScheduleSuccess: () => {
value: true
}
@@ -1885,12 +1592,6 @@ export interface eventUsageLogicActions {
reportIngestionContinueWithoutVerifying: () => {
value: true
}
- reportInsightBreakdownChanged: (queryKind: string | undefined) => {
- queryKind: string | undefined
- }
- reportInsightCompareChanged: (queryKind: string | undefined) => {
- queryKind: string | undefined
- }
reportInsightDateExclusionsChanged: (
queryKind: string | undefined,
excludeIncompletePeriods: boolean,
@@ -1903,9 +1604,6 @@ export interface eventUsageLogicActions {
reportInsightDatePickerOpened: (queryKind: string | undefined) => {
queryKind: string | undefined
}
- reportInsightDateRangeChanged: (queryKind: string | undefined) => {
- queryKind: string | undefined
- }
reportInsightDraftDiscarded: (draftAgeSeconds: number) => {
draftAgeSeconds: number
}
@@ -1916,9 +1614,6 @@ export interface eventUsageLogicActions {
draftAgeSeconds: number
surface: 'insight_editor' | 'saved_insights'
}
- reportInsightDragToZoomed: (queryKind: string | undefined) => {
- queryKind: string | undefined
- }
reportInsightFilterAdded: (
newLength: number,
source: GraphSeriesAddedSource
@@ -1926,36 +1621,9 @@ export interface eventUsageLogicActions {
newLength: number
source: GraphSeriesAddedSource
}
- reportInsightFilterRemoved: (index: number) => {
- index: number
- }
- reportInsightFilterSet: (
- filters: Array<{
- id: number | string | null
- type?: EntityType
- }>
- ) => {
- filters: {
- id: number | string | null
- type?: EntityType | undefined
- }[]
- }
- reportInsightMetadataAiGenerated: (queryKind: NodeKind) => {
- queryKind: NodeKind
- }
- reportInsightMetadataAiGenerationFailed: (queryKind: NodeKind) => {
- queryKind: NodeKind
- }
reportInsightOpenedFromRecentInsightList: () => {
value: true
}
- reportInsightRefreshTime: (
- loadingMilliseconds: number,
- insightShortId: InsightShortId
- ) => {
- insightShortId: InsightShortId
- loadingMilliseconds: number
- }
reportInsightResultsCopiedToClipboard: (
format: string,
insightId: number | null,
@@ -1976,9 +1644,6 @@ export interface eventUsageLogicActions {
query: Node<Record<string, any>> | null
saveType: 'save' | 'save_as'
}
- reportInsightStarted: (query: Node | null) => {
- query: Node<Record<string, any>> | null
- }
reportInsightViewed: (
insightModel: Partial<InsightModel>,
query: Node | null,
@@ -1990,19 +1655,9 @@ export interface eventUsageLogicActions {
isFirstLoad: boolean
query: Node<Record<string, any>> | null
}
- reportInsightWhitelabelToggled: (isWhiteLabelled: boolean) => {
- isWhiteLabelled: boolean
- }
reportInsightsTableCalcToggled: (mode: string) => {
mode: string
}
- reportInstanceSettingChange: (
- name: string,
- value: boolean | number | string
- ) => {
- name: string
- value: boolean | number | string
- }
reportIntegrationConnectClicked: (
integration: string,
kind: string,
@@ -2062,34 +1717,6 @@ export interface eventUsageLogicActions {
itemType: string | null | undefined
section: string
}
- reportNavbarStarredItemAdded: (
- itemType: string,
- itemName: string
- ) => {
- itemName: string
- itemType: string
- }
- reportNavbarStarredItemClicked: (
- itemType: string,
- itemName: string
- ) => {
- itemName: string
- itemType: string
- }
- reportNavbarStarredItemRemoved: (
- itemType: string,
- itemName: string
- ) => {
- itemName: string
- itemType: string
- }
- reportNavbarStarredItemsReordered: (
- itemCount: number,
- isAIFirst: boolean
- ) => {
- isAIFirst: boolean
- itemCount: number
- }
reportOnboardingAIReportRemoved: (
role: string | null,
reportKey: string,
@@ -2189,9 +1816,6 @@ export interface eventUsageLogicActions {
oldPropertyType: string | undefined
totalProperties: number
}
- reportPersonSplit: (merge_count: number) => {
- merge_count: number
- }
reportPersonalIntegrationConnectClicked: (kind: string) => {
kind: string
}
@@ -2239,22 +1863,6 @@ export interface eventUsageLogicActions {
reportProjectNoticeShown: (variant: string) => {
variant: string
}
- reportProjectSettingChange: (
- name: string,
- value: any
- ) => {
- name: string
- value: any
- }
- reportPropertyGroupFilterAdded: () => {
- value: true
- }
- reportPropertyGroupFilterDuplicated: () => {
- value: true
- }
- reportPropertyGroupFilterRemoved: () => {
- value: true
- }
reportPropertySelectOpened: () => {
value: true
}
@@ -2284,9 +1892,6 @@ export interface eventUsageLogicActions {
reportRevenueAnalyticsTestAccountFilterUpdated: (filterTestAccounts: boolean) => {
filterTestAccounts: boolean
}
- reportRoleCreated: (role: string) => {
- role: string
- }
reportSDKSelected: (sdk: SDK) => {
sdk: SDK
}
@@ -2297,9 +1902,6 @@ export interface eventUsageLogicActions {
sdkKey: string
surface: SDKSetupInstructionsSurface
}
- reportSavedInsightFilterUsed: (filterKeys: string[]) => {
- filterKeys: string[]
- }
reportSavedInsightNewInsightClicked: (
insightType: string,
presetKey?: string
@@ -2307,9 +1909,6 @@ export interface eventUsageLogicActions {
insightType: string
presetKey: string | undefined
}
- reportSavedInsightTabChanged: (tab: string) => {
- tab: string
- }
reportSavedInsightToDashboard: (
insight: Partial<InsightModel> | null,
dashboardId: number | null
@@ -2320,9 +1919,6 @@ export interface eventUsageLogicActions {
reportSessionTableVersionUpdated: (version: string) => {
version: string
}
- reportSubscribedDuringOnboarding: (productKey: string) => {
- productKey: string
- }
reportSurveyAiPromptSubmitted: (source: string) => {
source: string
}
@@ -2379,9 +1975,6 @@ export interface eventUsageLogicActions {
reportSurveyViewed: (survey: Survey) => {
survey: Survey
}
- reportTaxonomicFilterAddFilterClicked: (eventName?: string) => {
- eventName: string | undefined
- }
reportTaxonomicFilterCategorySelected: (
groupType: TaxonomicFilterGroupType,
eventName?: string
@@ -2389,13 +1982,6 @@ export interface eventUsageLogicActions {
eventName: string | undefined
groupType: TaxonomicFilterGroupType
}
- reportTeamSettingChange: (
- name: string,
- value: any
- ) => {
- name: string
- value: any
- }
reportTestAccountFiltersUpdated: (filters: Record<string, any>[]) => {
filters: Record<string, any>[]
}
@@ -2411,9 +1997,6 @@ export interface eventUsageLogicActions {
device_timezone: string | null | undefined
project_timezone: string | undefined
}
- reportUpgradeModalShown: (featureName: string) => {
- featureName: string
- }
reportUsageMetricCreated: () => boolean
reportUsageMetricDeleted: () => boolean
reportUsageMetricUpdated: () => boolean
@@ -2432,11 +2015,6 @@ export interface eventUsageLogicActions {
enabled: boolean
}
}
- reportWebAnalyticsConversionGoalSet: (props: { goal_type: string | null }) => {
- props: {
- goal_type: string | null
- }
- }
reportWebAnalyticsDateRangeChanged: (props: {
date_from: string | null
date_to: string | null
@@ -2470,20 +2048,6 @@ export interface eventUsageLogicActions {
total_filter_count: number
}
}
- reportWebAnalyticsFocusModeOnboardingCompleted: (props: { concern_count: number }) => {
- props: {
- concern_count: number
- }
- }
- reportWebAnalyticsFocusModeOnboardingShown: () => {
- value: true
- }
- reportWebAnalyticsFocusModeOnboardingSkipped: () => {
- value: true
- }
- reportWebAnalyticsFocusModeOnboardingStarted: () => {
- value: true
- }
reportWebAnalyticsHealthActionClicked: (props: {
category: string
check_id: string
@@ -2546,19 +2110,6 @@ export interface eventUsageLogicActions {
enabled: boolean
}
}
- reportWebDashboardCreatedFromTemplate: (payload: {
- dashboard_id: number
- template_id: string
- template_name: string
- template_scope: DashboardTemplateScope | null
- template_variable_count: number
- }) => {
- dashboard_id: number
- template_id: string
- template_name: string
- template_scope: DashboardTemplateScope | null
- template_variable_count: number
- }
reportWizardSyncSessionDetected: (props: {
runPhase: string
skillId: string
@@ -2634,9 +2185,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
newPropertyType?: string
) => ({ action, totalProperties, oldPropertyType, newPropertyType }),
// insights
- reportInsightMetadataAiGenerated: (queryKind: NodeKind) => ({ queryKind }),
- reportInsightMetadataAiGenerationFailed: (queryKind: NodeKind) => ({ queryKind }),
- reportInsightStarted: (query: Node | null) => ({ query }),
reportInsightSaved: (
insight: Partial<InsightModel> | null,
query: Node | null,
@@ -2672,42 +2220,14 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportDataTableColumnsUpdated: (context_type: string) => ({ context_type }),
// insight filters
reportFunnelStepReordered: true,
- reportInsightFilterRemoved: (index: number) => ({ index }),
reportInsightFilterAdded: (newLength: number, source: GraphSeriesAddedSource) => ({ newLength, source }),
- reportInsightFilterSet: (
- filters: Array<{
- id: string | number | null
- type?: EntityType
- }>
- ) => ({ filters }),
- reportInsightWhitelabelToggled: (isWhiteLabelled: boolean) => ({ isWhiteLabelled }),
- reportEntityFilterVisibilitySet: (index: number, visible: boolean, entityName?: string) => ({
- index,
- visible,
- entityName,
- }),
reportInsightsTableCalcToggled: (mode: string) => ({ mode }),
- reportPropertyGroupFilterAdded: true,
- reportPropertyGroupFilterRemoved: true,
- reportPropertyGroupFilterDuplicated: true,
- reportInsightDateRangeChanged: (queryKind: string | undefined) => ({ queryKind }),
reportInsightDateExclusionsChanged: (
queryKind: string | undefined,
excludeIncompletePeriods: boolean,
excludedDaysOfWeekCount: number
) => ({ queryKind, excludeIncompletePeriods, excludedDaysOfWeekCount }),
reportInsightDatePickerOpened: (queryKind: string | undefined) => ({ queryKind }),
- reportInsightDragToZoomed: (queryKind: string | undefined) => ({ queryKind }),
- reportInsightBreakdownChanged: (queryKind: string | undefined) => ({ queryKind }),
- reportInsightCompareChanged: (queryKind: string | undefined) => ({ queryKind }),
- reportChangeOuterPropertyGroupFiltersType: (type: FilterLogicalOperator, groupsLength: number) => ({
- type,
- groupsLength,
- }),
- reportChangeInnerPropertyGroupFiltersType: (type: FilterLogicalOperator, filtersLength: number) => ({
- type,
- filtersLength,
- }),
// insight funnel correlation
reportCorrelationViewed: (query: Node | null, delay?: number, propertiesTable?: boolean) => ({
query,
@@ -2750,55 +2270,11 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
changeType: DashboardFilterChangeType,
properties: Record<string, string | number | boolean | null | undefined>
) => ({ dashboard, changeType, properties }),
- reportDashboardTileIgnoreDashboardFiltersToggled: (
- dashboardId: number | undefined,
- insightId: number | null,
- ignored: boolean
- ) => ({ dashboardId, insightId, ignored }),
- reportDashboardLayoutZoomChanged: (
- dashboard: DashboardType | null,
- layoutZoom: number,
- source: 'button' | 'shortcut'
- ) => ({ dashboard, layoutZoom, source }),
reportDashboardTileDensityConfigured: (tileDensity: DashboardTileSpacing) => ({ tileDensity }),
reportDashboardEditModeDiscardPrompt: (
dashboard: DashboardType | null,
action: 'shown' | 'discarded' | 'kept_editing'
) => ({ dashboard, action }),
- reportDashboardBreakdownColorsSaved: (
- dashboard: DashboardType | null,
- manualCount: number,
- autoCount: number,
- breakdownTypes: string[]
- ) => ({ dashboard, manualCount, autoCount, breakdownTypes }),
- reportDashboardColorThemeSet: (dashboard: DashboardType | null, themeId: number | null) => ({
- dashboard,
- themeId,
- }),
- reportDashboardRefreshed: (
- dashboardId: number,
- filters: Record<string, any>,
- variables: Record<string, any>,
- lastRefreshed: string | Dayjs | null,
- action: string,
- forceRefresh: boolean,
- insightsRefreshedInfo: {
- totalTileCount: number
- tilesStaleCount: number
- tilesRefreshedCount: number
- tilesErroredCount: number
- tilesAbortedCount: number
- refreshDurationMs: number
- }
- ) => ({
- dashboardId,
- filters,
- variables,
- lastRefreshed,
- action,
- forceRefresh,
- insightsRefreshedInfo,
- }),
reportDashboardTileRefreshed: (
dashboardId: number,
tile: DashboardTile,
@@ -2830,22 +2306,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
source,
}),
reportDashboardMoveInitiated: (method: 'single' | 'bulk', count: number) => ({ method, count }),
- reportDashboardFrontEndUpdate: (
- dashboardId: number | undefined,
- attribute: 'name' | 'description' | 'tags',
- originalLength: number,
- newLength: number
- ) => ({ dashboardId, attribute, originalLength, newLength }),
reportDashboardInsightDeleteAfterRemovalClicked: (otherDashboardCount: number) => ({ otherDashboardCount }),
- reportDashboardInsightDeleteAfterRemovalConfirmed: (otherDashboardCount: number) => ({ otherDashboardCount }),
- reportDashboardShareToggled: (dashboardId: number | undefined, isShared: boolean) => ({
- dashboardId,
- isShared,
- }),
- reportDashboardWhitelabelToggled: (dashboardId: number | undefined, isWhiteLabelled: boolean) => ({
- dashboardId,
- isWhiteLabelled,
- }),
reportDashboardTileRepositioned: (dashboardId: number, action: 'moved' | 'resized', layoutZoom: number) => ({
dashboardId,
action,
@@ -2887,11 +2348,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
) => ({ dashboardId, promptType }),
reportDashboardEmptyAddChartClicked: (dashboardId: number | undefined) => ({ dashboardId }),
reportDashboardEmptyWebAnalyticsClicked: (dashboardId: number | undefined) => ({ dashboardId }),
- reportDashboardExported: (dashboardId: number, exportFormat: ExporterFormat) => ({
- dashboardId,
- exportFormat,
- }),
- reportUpgradeModalShown: (featureName: string) => ({ featureName }),
reportTimezoneComponentViewed: (
component: 'label' | 'indicator',
project_timezone?: string,
@@ -2907,13 +2363,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportCreatedDashboardFromModal: true,
reportDashboardAddMenuOpened: (source: 'header', dashboardId: number) => ({ source, dashboardId }),
/** Dashboard created via PostHog web app from a template (new dashboard modal / template chooser). */
- reportWebDashboardCreatedFromTemplate: (payload: {
- dashboard_id: number
- template_id: string
- template_name: string
- template_variable_count: number
- template_scope: DashboardTemplateScope | null
- }) => payload,
reportSavedInsightToDashboard: (insight: Partial<InsightModel> | null, dashboardId: number | null) => ({
insight,
dashboardId,
@@ -2922,18 +2371,11 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
insight,
dashboardId,
}),
- reportCopiedDashboardTileToDashboard: (
- fromDashboardId: number,
- toDashboardId: number,
- tileType: DashboardWidgetType
- ) => ({ fromDashboardId, toDashboardId, tileType }),
reportInsightResultsCopiedToClipboard: (
format: string,
insightId: number | null,
dashboardId: number | null
) => ({ format, insightId, dashboardId }),
- reportSavedInsightTabChanged: (tab: string) => ({ tab }),
- reportSavedInsightFilterUsed: (filterKeys: string[]) => ({ filterKeys }),
reportSavedInsightNewInsightClicked: (insightType: string, presetKey?: string) => ({
insightType,
presetKey,
@@ -2943,7 +2385,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
draftAgeSeconds,
}),
reportInsightDraftDiscarded: (draftAgeSeconds: number) => ({ draftAgeSeconds }),
- reportPersonSplit: (merge_count: number) => ({ merge_count }),
reportHelpButtonViewed: true,
reportHelpButtonUsed: (help_type: HelpType) => ({ help_type }),
reportExperimentWizardStarted: (guideVisible: boolean) => ({ guideVisible }),
@@ -3000,14 +2441,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
index,
isPrimary,
}),
- reportExperimentStartDateChange: (experiment: Experiment, newStartDate: string) => ({
- experiment,
- newStartDate,
- }),
- reportExperimentEndDateChange: (experiment: Experiment, newEndDate: string) => ({
- experiment,
- newEndDate,
- }),
reportExperimentExposureCohortCreated: (experiment: Experiment, cohort: CohortType) => ({ experiment, cohort }),
reportExperimentExposureCohortEdited: (existingCohort: CohortType, newCohort: CohortType) => ({
existingCohort,
@@ -3017,7 +2450,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportExperimentVariantScreenshotUploaded: (experimentId: ExperimentIdType) => ({ experimentId }),
reportExperimentResultsLoadingTimeout: (experimentId: ExperimentIdType) => ({ experimentId }),
reportExperimentReleaseConditionsViewed: (experimentId: ExperimentIdType) => ({ experimentId }),
- reportExperimentReleaseConditionsUpdated: (experimentId: ExperimentIdType) => ({ experimentId }),
reportExperimentHoldoutCreated: (holdout: ExperimentHoldoutType) => ({ holdout }),
reportExperimentHoldoutAssigned: ({
experimentId,
@@ -3057,34 +2489,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
queryId,
context,
}),
- reportExperimentResultsRefreshCompleted: (
- experimentId: ExperimentIdType,
- teamId: number | null | undefined,
- context: {
- total_duration_ms: number
- primary_metrics_count: number
- secondary_metrics_count: number
- successful_count: number
- errored_count: number
- cached_count: number
- triggered_by:
- | 'page_load'
- | 'manual'
- | 'auto_refresh'
- | 'experiment_config_change'
- | 'metric_config_change'
- force_refresh: boolean
- refresh_id: string
- experiment_duration_hours: number | null
- experiment_status: string | null
- total_metrics_count: number
- execution_mode: 'sync' | 'async'
- }
- ) => ({
- experimentId,
- teamId,
- context,
- }),
// 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.
@@ -3175,12 +2579,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
groupType,
eventName,
}),
- reportTaxonomicFilterAddFilterClicked: (eventName?: string) => ({ eventName }),
// Definition Popover
- reportDataManagementDefinitionHovered: (type: TaxonomicFilterGroupType, mediaPreviewCount?: number) => ({
- type,
- mediaPreviewCount,
- }),
reportMediaPreviewUploaded: (source: string) => ({ source }),
reportDataManagementDefinitionClickView: (type: TaxonomicFilterGroupType) => ({ type }),
reportDataManagementDefinitionClickEdit: (type: TaxonomicFilterGroupType) => ({ type }),
@@ -3189,44 +2588,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
groupTypeIndex,
shortcutName,
}),
- reportDataManagementDefinitionSaveSucceeded: (type: TaxonomicFilterGroupType, loadTime: number) => ({
- type,
- loadTime,
- }),
- reportDataManagementDefinitionSaveFailed: (
- type: TaxonomicFilterGroupType,
- loadTime: number,
- error: string
- ) => ({ type, loadTime, error }),
- reportDataManagementDefinitionCancel: (type: TaxonomicFilterGroupType) => ({ type }),
// Data Management Pages
- reportDataManagementEventDefinitionsPageLoadSucceeded: (loadTime: number, resultsLength: number) => ({
- loadTime,
- resultsLength,
- }),
- reportDataManagementEventDefinitionsPageLoadFailed: (loadTime: number, error: string) => ({
- loadTime,
- error,
- }),
- reportDataManagementEventDefinitionsPageNestedPropertiesLoadSucceeded: (loadTime: number) => ({
- loadTime,
- }),
- reportDataManagementEventDefinitionsPageNestedPropertiesLoadFailed: (loadTime: number, error: string) => ({
- loadTime,
- error,
- }),
- reportDataManagementEventPropertyDefinitionsPageLoadSucceeded: (loadTime: number, resultsLength: number) => ({
- loadTime,
- resultsLength,
- }),
- reportDataManagementEventPropertyDefinitionsPageLoadFailed: (loadTime: number, error: string) => ({
- loadTime,
- error,
- }),
- reportInsightRefreshTime: (loadingMilliseconds: number, insightShortId: InsightShortId) => ({
- loadingMilliseconds,
- insightShortId,
- }),
reportInsightOpenedFromRecentInsightList: true,
reportPersonOpenedFromNewlySeenPersonsList: true,
reportIngestionContinueWithoutVerifying: true,
@@ -3237,36 +2599,20 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
receive_org_level_activity_logs,
}),
reportFailedToCreateFeatureFlagWithCohort: (code: string, detail: string) => ({ code, detail }),
- reportFeatureFlagCopySuccess: true,
reportFeatureFlagCopyFailure: (error) => ({ error }),
reportFeatureFlagBulkCopy: (flagCount: number, projectCount: number, failedCount: number) => ({
flagCount,
projectCount,
failedCount,
}),
- reportFeatureFlagCreatedInAdditionalProjects: (
- targetCount: number,
- createdCount: number,
- overwrittenCount: number,
- pendingApprovalCount: number,
- failedCount: number
- ) => ({ targetCount, createdCount, overwrittenCount, pendingApprovalCount, failedCount }),
reportFeatureFlagsBulkArchived: (archivedCount: number, pendingApprovalCount: number, failedCount: number) => ({
archivedCount,
pendingApprovalCount,
failedCount,
}),
reportFeatureFlagScheduleSuccess: true,
- reportFeatureFlagScheduleFailure: (error) => ({ error }),
reportInviteMembersButtonClicked: true,
- reportDashboardLoadingTime: (loadingMilliseconds: number, dashboardId: number) => ({
- loadingMilliseconds,
- dashboardId,
- }),
- reportInstanceSettingChange: (name: string, value: string | boolean | number) => ({ name, value }),
reportAxisUnitsChanged: (properties: Record<string, any>) => ({ ...properties }),
- reportTeamSettingChange: (name: string, value: any) => ({ name, value }),
- reportProjectSettingChange: (name: string, value: any) => ({ name, value }),
reportActivationSideBarTaskClicked: (key: string) => ({ key }),
reportBillingUpgradeClicked: (plan: string) => ({ plan }),
reportBillingDowngradeClicked: (plan: string) => ({ plan }),
@@ -3279,7 +2625,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
toProduct,
reason,
}),
- reportRoleCreated: (role: string) => ({ role }),
reportFlagsCodeExampleInteraction: (optionType: string) => ({
optionType,
}),
@@ -3316,7 +2661,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
}),
reportProductTourListViewed: true,
reportProductUnsubscribed: (product: string) => ({ product }),
- reportSubscribedDuringOnboarding: (productKey: string) => ({ productKey }),
reportOnboardingStarted: (properties?: OnboardingEventProperties) => ({
properties,
}),
@@ -3457,11 +2801,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
interval: string
}) => ({ props }),
reportWebAnalyticsCompareToggled: (props: { enabled: boolean }) => ({ props }),
- reportWebAnalyticsConversionGoalSet: (props: { goal_type: string | null }) => ({ props }),
- reportWebAnalyticsFocusModeOnboardingShown: true,
- reportWebAnalyticsFocusModeOnboardingStarted: true,
- reportWebAnalyticsFocusModeOnboardingSkipped: true,
- reportWebAnalyticsFocusModeOnboardingCompleted: (props: { concern_count: number }) => ({ props }),
reportWebAnalyticsPathCleaningToggled: (props: { enabled: boolean }) => ({ props }),
// Customer Analytics
reportCustomerAnalyticsDashboardBusinessModeChanged: ({ business_mode }) => ({ business_mode }),
@@ -3493,11 +2832,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportCustomerJourneyDeleted: (journeyId: string) => ({ journeyId }),
reportCustomerJourneyTemplateSelected: (templateKey: string) => ({ templateKey }),
reportCustomerJourneyExistingFunnelSelected: (insightId: number) => ({ insightId }),
- reportCustomerJourneyPathExpanded: (pathType: string, dropOff: boolean, stepIndex: number) => ({
- pathType,
- dropOff,
- stepIndex,
- }),
reportCustomerJourneyStepAddedFromPath: (eventName: string, pathType: string, stepIndex: number) => ({
eventName,
pathType,
@@ -3524,22 +2858,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
itemType,
}),
// navbar starred
- reportNavbarStarredItemAdded: (itemType: string, itemName: string) => ({
- itemType,
- itemName,
- }),
- reportNavbarStarredItemRemoved: (itemType: string, itemName: string) => ({
- itemType,
- itemName,
- }),
- reportNavbarStarredItemClicked: (itemType: string, itemName: string) => ({
- itemType,
- itemName,
- }),
- reportNavbarStarredItemsReordered: (itemCount: number, isAIFirst: boolean) => ({
- itemCount,
- isAIFirst,
- }),
// MCP hints
reportMCPHintShown: (surfaceKey: string) => ({ surfaceKey }),
reportMCPHintDismissed: (dismissType: 'surface' | 'all', surfaceKey?: string) => ({
@@ -3560,9 +2878,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportAxisUnitsChanged: (properties) => {
posthog.capture('axis units changed', properties)
},
- reportInstanceSettingChange: ({ name, value }) => {
- posthog.capture('instance setting change', { name, value })
- },
reportIntegrationConnectClicked: ({ integration, kind, surface, selfDriving }) => {
posthog.capture('integration_connect_clicked', {
integration,
@@ -3614,12 +2929,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportPersonalIntegrationConnectClicked: ({ kind }) => {
posthog.capture('personal integration connect clicked', { integration_kind: kind })
},
- reportDashboardLoadingTime: async ({ loadingMilliseconds, dashboardId }) => {
- posthog.capture('dashboard loading time', { loadingMilliseconds, dashboardId })
- },
- reportInsightRefreshTime: async ({ loadingMilliseconds, insightShortId }) => {
- posthog.capture('insight refresh time', { loadingMilliseconds, insightShortId })
- },
reportTimeToSeeData: async ({ payload }) => {
posthog.capture('time to see data', payload)
},
@@ -3633,19 +2942,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
total_properties: totalProperties,
})
},
- reportInsightStarted: async ({ query }, breakpoint) => {
- // "insight started" means the user opened a blank insight editor (intent — it may never be
- // persisted). The actual creation is tracked server-side as "insight created".
- await breakpoint(500) // Debounce to avoid multiple quick "New insight" clicks being reported
-
- posthog.capture('insight started', { ...sanitizeQuery(query), source: 'web' })
- },
- reportInsightMetadataAiGenerated: async ({ queryKind }) => {
- posthog.capture('insight metadata ai generated', { query_kind: queryKind })
- },
- reportInsightMetadataAiGenerationFailed: async ({ queryKind }) => {
- posthog.capture('insight metadata ai generation failed', { query_kind: queryKind })
- },
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', {
@@ -3759,22 +3055,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
layout_zoom: layoutZoom ?? undefined,
})
},
- reportDashboardBreakdownColorsSaved: async ({ dashboard, manualCount, autoCount, breakdownTypes }) => {
- posthog.capture('dashboard breakdown colors saved', {
- dashboard_id: dashboard?.id,
- dashboard: sanitizeDashboard(dashboard),
- manual_count: manualCount,
- auto_count: autoCount,
- breakdown_types: breakdownTypes,
- })
- },
- reportDashboardColorThemeSet: async ({ dashboard, themeId }) => {
- posthog.capture('dashboard color theme set', {
- dashboard_id: dashboard?.id,
- dashboard: sanitizeDashboard(dashboard),
- theme_id: themeId,
- })
- },
reportDashboardFiltersChanged: async ({ dashboard, changeType, properties }) => {
posthog.capture('dashboard filters changed', {
dashboard_id: dashboard?.id,
@@ -3782,21 +3062,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
...properties,
})
},
- reportDashboardTileIgnoreDashboardFiltersToggled: async ({ dashboardId, insightId, ignored }) => {
- posthog.capture('dashboard tile ignore dashboard filters toggled', {
- dashboard_id: dashboardId,
- insight_id: insightId,
- ignored,
- })
- },
- reportDashboardLayoutZoomChanged: async ({ dashboard, layoutZoom, source }) => {
- posthog.capture('dashboard layout zoom changed', {
- dashboard_id: dashboard?.id,
- dashboard: sanitizeDashboard(dashboard),
- layout_zoom: layoutZoom,
- source,
- })
- },
reportDashboardTileDensityConfigured: async ({ tileDensity }) => {
posthog.capture('dashboard tile density configured', { tile_density: tileDensity })
},
@@ -3807,31 +3072,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
action,
})
},
- reportDashboardRefreshed: async ({
- dashboardId,
- filters,
- variables,
- lastRefreshed,
- action,
- forceRefresh,
- insightsRefreshedInfo,
- }) => {
- posthog.capture(`dashboard refreshed`, {
- dashboard_id: dashboardId,
- filters,
- variables,
- last_refreshed: lastRefreshed?.toString(),
- refreshAge: lastRefreshed ? now().diff(lastRefreshed, 'seconds') : undefined,
- action: action,
- force_refresh: forceRefresh,
- refresh_duration_ms: insightsRefreshedInfo.refreshDurationMs,
- total_tile_count: insightsRefreshedInfo.totalTileCount,
- tiles_stale_count: insightsRefreshedInfo.tilesStaleCount,
- tiles_refreshed_count: insightsRefreshedInfo.tilesRefreshedCount,
- tiles_errored_count: insightsRefreshedInfo.tilesErroredCount,
- tiles_aborted_count: insightsRefreshedInfo.tilesAbortedCount,
- })
- },
reportDashboardTileRefreshed: async ({
dashboardId,
tile,
@@ -3881,23 +3121,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportDashboardMoveInitiated: async ({ method, count }) => {
posthog.capture('dashboard move initiated', { method, count })
},
- reportDashboardFrontEndUpdate: async ({ dashboardId, attribute, originalLength, newLength }) => {
- posthog.capture(`dashboard frontend updated`, {
- dashboard_id: dashboardId,
- attribute,
- original_length: originalLength,
- new_length: newLength,
- })
- },
- reportDashboardShareToggled: async ({ dashboardId, isShared }) => {
- posthog.capture(`dashboard share toggled`, { dashboard_id: dashboardId, is_shared: isShared })
- },
- reportDashboardWhitelabelToggled: async ({ dashboardId, isWhiteLabelled }) => {
- posthog.capture(`dashboard whitelabel toggled`, {
- dashboard_id: dashboardId,
- is_whitelabelled: isWhiteLabelled,
- })
- },
reportDashboardTileRepositioned: async ({ dashboardId, action, layoutZoom }) => {
posthog.capture('dashboard tile repositioned', {
dashboard_id: dashboardId,
@@ -3917,11 +3140,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
other_dashboard_count: otherDashboardCount,
})
},
- reportDashboardInsightDeleteAfterRemovalConfirmed: async ({ otherDashboardCount }) => {
- posthog.capture('dashboard insight delete after removal confirmed', {
- other_dashboard_count: otherDashboardCount,
- })
- },
reportDashboardInsightValuesOnSeriesToggled: async ({ dashboardId, insightId, source }) => {
posthog.capture('dashboard insight values on series toggled', {
dashboard_id: dashboardId,
@@ -3970,15 +3188,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
source: 'web',
})
},
- reportDashboardExported: async ({ dashboardId, exportFormat }) => {
- posthog.capture('dashboard exported', {
- dashboard_id: dashboardId,
- export_format: exportFormat,
- })
- },
- reportUpgradeModalShown: async (payload) => {
- posthog.capture('upgrade modal shown', payload)
- },
reportTimezoneComponentViewed: async (payload) => {
posthog.capture('timezone component viewed', payload)
},
@@ -4006,21 +3215,9 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportCustomChannelTypeRulesUpdated: async ({ numRules }) => {
posthog.capture('custom channel type rules updated', { numRules })
},
- reportInsightFilterRemoved: async ({ index }) => {
- posthog.capture('local filter removed', { index })
- },
reportInsightFilterAdded: async ({ newLength }) => {
posthog.capture('filter added', { newLength })
},
- reportInsightFilterSet: async ({ filters }) => {
- posthog.capture('filters set', { filters })
- },
- reportInsightWhitelabelToggled: async ({ isWhiteLabelled }) => {
- posthog.capture(`insight whitelabel toggled`, { is_whitelabelled: isWhiteLabelled })
- },
- reportEntityFilterVisibilitySet: async ({ index, visible, entityName }) => {
- posthog.capture('entity filter visbility set', { index, visible, entityName })
- },
reportPropertySelectOpened: async () => {
posthog.capture('property select toggle opened')
},
@@ -4030,11 +3227,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportDashboardAddMenuOpened: async ({ source, dashboardId }) => {
posthog.capture('dashboard add menu opened', { source, dashboard_id: dashboardId })
},
- reportWebDashboardCreatedFromTemplate: async (payload) => {
- posthog.capture('dashboard created from template', {
- ...payload,
- })
- },
reportSavedInsightToDashboard: async ({ insight, dashboardId }) => {
posthog.capture('saved insight to dashboard', {
insight: sanitizeInsight(insight),
@@ -4047,13 +3239,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
dashboard_id: dashboardId,
})
},
- reportCopiedDashboardTileToDashboard: async ({ fromDashboardId, toDashboardId, tileType }) => {
- posthog.capture('dashboard widget copied to other dashboard', {
- from_dashboard_id: fromDashboardId,
- to_dashboard_id: toDashboardId,
- tile_type: tileType,
- })
- },
reportInsightResultsCopiedToClipboard: async ({ format, insightId, dashboardId }) => {
posthog.capture('insight results copied to clipboard', {
format,
@@ -4064,12 +3249,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportInsightsTableCalcToggled: async (payload) => {
posthog.capture('insights table calc toggled', payload)
},
- reportSavedInsightFilterUsed: ({ filterKeys }) => {
- posthog.capture('saved insights list page filter used', { filter_keys: filterKeys })
- },
- reportSavedInsightTabChanged: ({ tab }) => {
- posthog.capture('saved insights list page tab changed', { tab })
- },
reportInsightDraftRestored: ({ surface, draftAgeSeconds }) => {
posthog.capture('insight draft restored', { surface, draft_age_seconds: draftAgeSeconds })
},
@@ -4082,9 +3261,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
...(presetKey ? { preset_key: presetKey } : {}),
})
},
- reportPersonSplit: (props) => {
- posthog.capture('split person started', props)
- },
reportHelpButtonViewed: () => {
posthog.capture('help button viewed')
},
@@ -4179,20 +3355,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
is_primary_metric: isPrimary,
})
},
- reportExperimentStartDateChange: ({ experiment, newStartDate }) => {
- posthog.capture('experiment start date changed', {
- ...getEventPropertiesForExperiment(experiment),
- old_start_date: experiment.start_date,
- new_start_date: newStartDate,
- })
- },
- reportExperimentEndDateChange: ({ experiment, newEndDate }) => {
- posthog.capture('experiment end date changed', {
- ...getEventPropertiesForExperiment(experiment),
- old_end_date: experiment.end_date,
- new_end_date: newEndDate,
- })
- },
reportExperimentExposureCohortCreated: ({ experiment, cohort }) => {
posthog.capture('experiment exposure cohort created', {
experiment_id: experiment.id,
@@ -4224,11 +3386,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
experiment_id: experimentId,
})
},
- reportExperimentReleaseConditionsUpdated: ({ experimentId }) => {
- posthog.capture('experiment release conditions updated', {
- experiment_id: experimentId,
- })
- },
reportExperimentHoldoutCreated: ({ holdout }) => {
posthog.capture('experiment holdout created', {
name: holdout.name,
@@ -4274,13 +3431,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
...context,
})
},
- reportExperimentResultsRefreshCompleted: ({ experimentId, teamId, context }) => {
- posthog.capture('experiment results refresh completed', {
- experiment_id: experimentId,
- team_id: teamId,
- ...context,
- })
- },
reportExperimentMetricRecalculation: ({ status, properties }) => {
posthog.capture('experiment metric recalculation', { status, ...properties })
},
@@ -4406,18 +3556,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
...context,
})
},
- reportPropertyGroupFilterAdded: () => {
- posthog.capture('property group filter added')
- },
- reportPropertyGroupFilterRemoved: () => {
- posthog.capture('property group filter removed')
- },
- reportPropertyGroupFilterDuplicated: () => {
- posthog.capture('property group filter duplicated')
- },
- reportInsightDateRangeChanged: ({ queryKind }) => {
- posthog.capture('insight date range changed', { query_kind: queryKind })
- },
reportInsightDateExclusionsChanged: ({ queryKind, excludeIncompletePeriods, excludedDaysOfWeekCount }) => {
posthog.capture('insight date exclusions changed', {
query_kind: queryKind,
@@ -4428,30 +3566,9 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportInsightDatePickerOpened: ({ queryKind }) => {
posthog.capture('insight date picker opened', { query_kind: queryKind })
},
- reportInsightDragToZoomed: ({ queryKind }) => {
- posthog.capture('insight drag to zoomed', { query_kind: queryKind })
- },
- reportInsightBreakdownChanged: ({ queryKind }) => {
- posthog.capture('insight breakdown changed', { query_kind: queryKind })
- },
- reportInsightCompareChanged: ({ queryKind }) => {
- posthog.capture('insight compare changed', { query_kind: queryKind })
- },
- reportChangeOuterPropertyGroupFiltersType: ({ type, groupsLength }) => {
- posthog.capture('outer match property groups type changed', { type, groupsLength })
- },
- reportChangeInnerPropertyGroupFiltersType: ({ type, filtersLength }) => {
- posthog.capture('inner match property group filters type changed', { type, filtersLength })
- },
reportTaxonomicFilterCategorySelected: ({ groupType, eventName }) => {
posthog.capture('taxonomic filter category selected', { groupType, eventName })
},
- reportTaxonomicFilterAddFilterClicked: ({ eventName }) => {
- posthog.capture('taxonomic filter add filter clicked', { eventName })
- },
- reportDataManagementDefinitionHovered: ({ type, mediaPreviewCount }) => {
- posthog.capture('definition hovered', { type, media_preview_count: mediaPreviewCount ?? 0 })
- },
reportMediaPreviewUploaded: ({ source }) => {
posthog.capture('media preview uploaded', { source })
},
@@ -4461,45 +3578,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportDataManagementDefinitionClickEdit: ({ type }) => {
posthog.capture('definition click edit', { type })
},
- reportDataManagementDefinitionSaveSucceeded: ({ type, loadTime }) => {
- posthog.capture('definition save succeeded', { type, load_time: loadTime })
- },
- reportDataManagementDefinitionSaveFailed: ({ type, loadTime, error }) => {
- posthog.capture('definition save failed', { type, load_time: loadTime, error })
- },
- reportDataManagementDefinitionCancel: ({ type }) => {
- posthog.capture('definition cancelled', { type })
- },
- reportDataManagementEventDefinitionsPageLoadSucceeded: ({ loadTime, resultsLength }) => {
- posthog.capture('event definitions page load succeeded', {
- load_time: loadTime,
- num_results: resultsLength,
- })
- },
- reportDataManagementEventDefinitionsPageLoadFailed: ({ loadTime, error }) => {
- posthog.capture('event definitions page load failed', { load_time: loadTime, error })
- },
- reportDataManagementEventDefinitionsPageNestedPropertiesLoadSucceeded: ({ loadTime }) => {
- posthog.capture('event definitions page event nested properties load succeeded', { load_time: loadTime })
- },
- reportDataManagementEventDefinitionsPageNestedPropertiesLoadFailed: ({ loadTime, error }) => {
- posthog.capture('event definitions page event nested properties load failed', {
- load_time: loadTime,
- error,
- })
- },
- reportDataManagementEventPropertyDefinitionsPageLoadSucceeded: ({ loadTime, resultsLength }) => {
- posthog.capture('event property definitions page load succeeded', {
- load_time: loadTime,
- num_results: resultsLength,
- })
- },
- reportDataManagementEventPropertyDefinitionsPageLoadFailed: ({ loadTime, error }) => {
- posthog.capture('event property definitions page load failed', {
- load_time: loadTime,
- error,
- })
- },
reportInsightOpenedFromRecentInsightList: () => {
posthog.capture('insight opened from recent insight list')
},
@@ -4532,9 +3610,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportFailedToCreateFeatureFlagWithCohort: ({ detail, code }) => {
posthog.capture('failed to create feature flag with cohort', { detail, code })
},
- reportFeatureFlagCopySuccess: () => {
- posthog.capture('feature flag copied')
- },
reportFeatureFlagCopyFailure: ({ error }) => {
posthog.capture('feature flag copy failure', { error })
},
@@ -4545,21 +3620,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
failed_count: failedCount,
})
},
- reportFeatureFlagCreatedInAdditionalProjects: ({
- targetCount,
- createdCount,
- overwrittenCount,
- pendingApprovalCount,
- failedCount,
- }) => {
- posthog.capture('feature flag created in additional projects', {
- target_count: targetCount,
- created_count: createdCount,
- overwritten_count: overwrittenCount,
- pending_approval_count: pendingApprovalCount,
- failed_count: failedCount,
- })
- },
reportFeatureFlagsBulkArchived: ({ archivedCount, pendingApprovalCount, failedCount }) => {
posthog.capture('feature flags bulk archived', {
archived_count: archivedCount,
@@ -4570,24 +3630,9 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportFeatureFlagScheduleSuccess: () => {
posthog.capture('feature flag scheduled')
},
- reportFeatureFlagScheduleFailure: ({ error }) => {
- posthog.capture('feature flag schedule failure', { error })
- },
reportInviteMembersButtonClicked: () => {
posthog.capture('invite members button clicked')
},
- reportTeamSettingChange: ({ name, value }) => {
- posthog.capture(`${name} team setting updated`, {
- setting: name,
- value,
- })
- },
- reportProjectSettingChange: ({ name, value }) => {
- posthog.capture(`${name} project setting updated`, {
- setting: name,
- value,
- })
- },
reportActivationSideBarTaskClicked: ({ key }) => {
posthog.capture('activation sidebar task clicked', {
key,
@@ -4613,11 +3658,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
to_product: toProduct,
})
},
- reportRoleCreated: ({ role }) => {
- posthog.capture('new role created', {
- role,
- })
- },
reportResourceAccessLevelUpdated: ({ resourceType, roleName, accessLevel }) => {
posthog.capture('resource access level updated', {
resource_type: resourceType,
@@ -4804,11 +3844,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
})
},
// onboarding
- reportSubscribedDuringOnboarding: ({ productKey }) => {
- posthog.capture('subscribed during onboarding', {
- product_key: productKey,
- })
- },
reportOnboardingStarted: ({ properties }) => {
posthog.capture('onboarding started', {
...LEGACY_ONBOARDING_EVENT_PROPS,
@@ -5016,21 +4051,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportWebAnalyticsCompareToggled: ({ props }) => {
posthog.capture('web analytics compare toggled', props)
},
- reportWebAnalyticsConversionGoalSet: ({ props }) => {
- posthog.capture('web analytics conversion goal set', props)
- },
- reportWebAnalyticsFocusModeOnboardingShown: () => {
- posthog.capture('web analytics focus mode onboarding shown')
- },
- reportWebAnalyticsFocusModeOnboardingStarted: () => {
- posthog.capture('web analytics focus mode onboarding started')
- },
- reportWebAnalyticsFocusModeOnboardingSkipped: () => {
- posthog.capture('web analytics focus mode onboarding skipped')
- },
- reportWebAnalyticsFocusModeOnboardingCompleted: ({ props }) => {
- posthog.capture('web analytics focus mode onboarding completed', props)
- },
reportWebAnalyticsPathCleaningToggled: ({ props }) => {
posthog.capture('web analytics path cleaning toggled', props)
},
@@ -5122,13 +4142,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportCustomerJourneyExistingFunnelSelected: async ({ insightId }) => {
posthog.capture('customer journey existing funnel selected', { insight_id: insightId })
},
- reportCustomerJourneyPathExpanded: async ({ pathType, dropOff, stepIndex }) => {
- posthog.capture('customer journey path expanded', {
- path_type: pathType,
- drop_off: dropOff,
- step_index: stepIndex,
- })
- },
reportCustomerJourneyStepAddedFromPath: async ({ eventName, pathType, stepIndex }) => {
posthog.capture('customer journey step added from path', {
event_name: eventName,
@@ -5175,30 +4188,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
item_type: itemType ?? null,
})
},
- reportNavbarStarredItemAdded: ({ itemType, itemName }) => {
- posthog.capture('navbar starred item added', {
- item_type: itemType,
- item_name: itemName,
- })
- },
- reportNavbarStarredItemRemoved: ({ itemType, itemName }) => {
- posthog.capture('navbar starred item removed', {
- item_type: itemType,
- item_name: itemName,
- })
- },
- reportNavbarStarredItemClicked: ({ itemType, itemName }) => {
- posthog.capture('navbar starred item clicked', {
- item_type: itemType,
- item_name: itemName,
- })
- },
- reportNavbarStarredItemsReordered: ({ itemCount, isAIFirst }) => {
- posthog.capture('navbar starred items reordered', {
- item_count: itemCount,
- is_ai_first: isAIFirst,
- })
- },
reportMCPHintShown: ({ surfaceKey }) => {
posthog.capture('mcp hint shown', {
surface_key: surfaceKey,
diff --git a/frontend/src/models/dashboardsModel.tsx b/frontend/src/models/dashboardsModel.tsx
index 43e0f3dd5c68..603a7b8760f5 100644
--- a/frontend/src/models/dashboardsModel.tsx
+++ b/frontend/src/models/dashboardsModel.tsx
@@ -1,6 +1,7 @@
import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
+import posthog from 'posthog-js'
import api, { PaginatedResponse } from 'lib/api'
import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'
@@ -459,12 +460,12 @@ export const dashboardsModel = kea<dashboardsModelType>([
refreshTreeItem('dashboard', id)
const updatedAttribute = Object.keys(payload)[0]
if (updatedAttribute === 'name' || updatedAttribute === 'description' || updatedAttribute === 'tags') {
- eventUsageLogic.actions.reportDashboardFrontEndUpdate(
- id,
- updatedAttribute,
- values.rawDashboards[id]?.[updatedAttribute]?.length || 0,
- payload[updatedAttribute].length
- )
+ posthog.capture(`dashboard frontend updated`, {
+ dashboard_id: id,
+ attribute: updatedAttribute,
+ original_length: values.rawDashboards[id]?.[updatedAttribute]?.length || 0,
+ new_length: payload[updatedAttribute].length,
+ })
if (updatedAttribute === 'tags') {
actions.loadTags()
}
diff --git a/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts b/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts
index 21630f18dd8b..31e85dbb5527 100644
--- a/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts
+++ b/frontend/src/queries/nodes/InsightViz/PropertyGroupFilters/propertyGroupFilterLogic.ts
@@ -1,7 +1,7 @@
import { MakeLogicType, actions, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import posthog from 'posthog-js'
import { convertPropertiesToPropertyGroup, isValidPropertyFilter } from 'lib/components/PropertyFilters/utils'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { ProductAnalyticsInsightQueryNode } from '~/queries/schema/schema-general'
@@ -149,25 +149,28 @@ export const propertyGroupFilterLogic = kea<propertyGroupFilterLogicType>([
setFilters: () => actions.update(),
setPropertyFilters: () => actions.update(),
setInnerPropertyGroupType: ({ type, index }) => {
- eventUsageLogic.actions.reportChangeInnerPropertyGroupFiltersType(
- type,
- values.filters.values[index].values.length
- )
+ posthog.capture('inner match property group filters type changed', {
+ type: type,
+ filtersLength: values.filters.values[index].values.length,
+ })
actions.update()
},
setOuterPropertyGroupsType: ({ type }) => {
- eventUsageLogic.actions.reportChangeOuterPropertyGroupFiltersType(type, values.filters.values.length)
+ posthog.capture('outer match property groups type changed', {
+ type: type,
+ groupsLength: values.filters.values.length,
+ })
actions.update()
},
removeFilterGroup: () => {
- eventUsageLogic.actions.reportPropertyGroupFilterRemoved()
+ posthog.capture('property group filter removed')
actions.update()
},
addFilterGroup: () => {
- eventUsageLogic.actions.reportPropertyGroupFilterAdded()
+ posthog.capture('property group filter added')
},
duplicateFilterGroup: () => {
- eventUsageLogic.actions.reportPropertyGroupFilterDuplicated()
+ posthog.capture('property group filter duplicated')
},
update: () => {
// Don't persist empty PropertyGroupFilter structures — they cause ghost
diff --git a/frontend/src/scenes/dashboard/DashboardZoomControl.tsx b/frontend/src/scenes/dashboard/DashboardZoomControl.tsx
index 498b057bb31e..5edd66d5fb80 100644
--- a/frontend/src/scenes/dashboard/DashboardZoomControl.tsx
+++ b/frontend/src/scenes/dashboard/DashboardZoomControl.tsx
@@ -1,9 +1,10 @@
import { useValues } from 'kea'
+import posthog from 'posthog-js'
import { LemonButton } from '@posthog/lemon-ui'
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { sanitizeDashboard } from 'lib/utils/eventUsageLogic'
import { Scene } from 'scenes/sceneTypes'
import { dashboardLogic } from './dashboardLogic'
@@ -36,7 +37,12 @@ export function DashboardZoomControl({ layoutZoom, setLayoutZoom }: DashboardZoo
onClick={() => {
const nextZoom = layoutZoom < 1 ? 1 : 0.25
setLayoutZoom(nextZoom)
- eventUsageLogic.actions.reportDashboardLayoutZoomChanged(dashboard ?? null, nextZoom, 'button')
+ posthog.capture('dashboard layout zoom changed', {
+ dashboard_id: (dashboard ?? null)?.id,
+ dashboard: sanitizeDashboard(dashboard ?? null),
+ layout_zoom: nextZoom,
+ source: 'button',
+ })
}}
tooltip="Collapse/Expand view. Makes it easier to edit the layout for busier dashboards."
>
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsx
index 0d6e2d55d44b..1c69c4f4c5d0 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx
+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx
@@ -45,7 +45,7 @@ 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 } from 'lib/utils/eventUsageLogic'
+import { DashboardEventSource, eventUsageLogic, sanitizeDashboard } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { shouldCancelQuery } from 'lib/utils/requests'
import { toParams } from 'lib/utils/url'
@@ -1728,18 +1728,23 @@ export const dashboardLogic = kea<dashboardLogicType>([
updatedDashboard.persisted_filters = latestDashboard.persisted_filters
updatedDashboard.persisted_variables = latestDashboard.persisted_variables
if (scope === 'colors' && breakdownColorsChanged) {
- eventUsageLogic.actions.reportDashboardBreakdownColorsSaved(
- values.dashboard,
- breakdownColorsToSave.filter((c) => c.source !== 'auto').length,
- breakdownColorsToSave.filter((c) => c.source === 'auto').length,
- Array.from(new Set(breakdownColorsToSave.map((c) => String(c.breakdownType))))
- )
+ const autoCount = breakdownColorsToSave.filter((color) => color.source === 'auto').length
+ posthog.capture('dashboard breakdown colors saved', {
+ dashboard_id: values.dashboard?.id,
+ dashboard: sanitizeDashboard(values.dashboard),
+ manual_count: breakdownColorsToSave.length - autoCount,
+ auto_count: autoCount,
+ breakdown_types: Array.from(
+ new Set(breakdownColorsToSave.map((c) => String(c.breakdownType)))
+ ),
+ })
}
if (scope === 'colors' && themeChanged) {
- eventUsageLogic.actions.reportDashboardColorThemeSet(
- values.dashboard,
- values.dataColorThemeId
- )
+ posthog.capture('dashboard color theme set', {
+ dashboard_id: values.dashboard?.id,
+ dashboard: sanitizeDashboard(values.dashboard),
+ theme_id: values.dataColorThemeId,
+ })
}
cache.dashboardChangesPersisted = true
return getQueryBasedDashboard(updatedDashboard)
@@ -1881,11 +1886,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
])
}
- eventUsageLogic.actions.reportCopiedDashboardTileToDashboard(
- fromDashboard,
- toDashboard,
- widgetType
- )
+ posthog.capture('dashboard widget copied to other dashboard', {
+ from_dashboard_id: fromDashboard,
+ to_dashboard_id: toDashboard,
+ tile_type: widgetType,
+ })
lemonToast.success(
<>
@@ -3521,13 +3526,19 @@ export const dashboardLogic = kea<dashboardLogicType>([
if (refreshStatus?.timer) {
const loadingMilliseconds = new Date().getTime() - refreshStatus.timer.getTime()
- eventUsageLogic.actions.reportInsightRefreshTime(loadingMilliseconds, shortId)
+ posthog.capture('insight refresh time', {
+ loadingMilliseconds: loadingMilliseconds,
+ insightShortId: shortId,
+ })
}
},
reportLoadTiming: () => {
if (values.loadTimer) {
const loadingMilliseconds = new Date().getTime() - values.loadTimer.getTime()
- eventUsageLogic.actions.reportDashboardLoadingTime(loadingMilliseconds, props.id)
+ posthog.capture('dashboard loading time', {
+ loadingMilliseconds: loadingMilliseconds,
+ dashboardId: props.id,
+ })
}
},
handleDashboardLoadComplete: () => {
@@ -3802,9 +3813,9 @@ export const dashboardLogic = kea<dashboardLogicType>([
children: 'Delete insight everywhere',
status: 'danger',
onClick: () => {
- eventUsageLogic.actions.reportDashboardInsightDeleteAfterRemovalConfirmed(
- otherDashboardCount
- )
+ posthog.capture('dashboard insight delete after removal confirmed', {
+ other_dashboard_count: otherDashboardCount,
+ })
return deleteInsightWithUndo({
object: { ...tile.insight!, dashboards: dashboardIds },
endpoint: `projects/${values.currentTeamId}/insights`,
@@ -4321,22 +4332,22 @@ export const dashboardLogic = kea<dashboardLogicType>([
})
}
- eventUsageLogic.actions.reportDashboardRefreshed(
- dashboardId,
- urlFilters,
- urlVariables,
- lastDashboardRefresh,
- action,
- !!forceRefresh,
- {
- totalTileCount,
- tilesStaleCount,
- tilesRefreshedCount,
- tilesErroredCount,
- tilesAbortedCount,
- refreshDurationMs: Math.floor(performance.now() - dashboardRefreshStartTime),
- }
- )
+ const refreshDurationMs = Math.floor(performance.now() - dashboardRefreshStartTime)
+ posthog.capture(`dashboard refreshed`, {
+ dashboard_id: dashboardId,
+ filters: urlFilters,
+ variables: urlVariables,
+ last_refreshed: lastDashboardRefresh?.toString(),
+ refreshAge: lastDashboardRefresh ? now().diff(lastDashboardRefresh, 'seconds') : undefined,
+ action: action,
+ force_refresh: !!forceRefresh,
+ refresh_duration_ms: refreshDurationMs,
+ total_tile_count: totalTileCount,
+ tiles_stale_count: tilesStaleCount,
+ tiles_refreshed_count: tilesRefreshedCount,
+ tiles_errored_count: tilesErroredCount,
+ tiles_aborted_count: tilesAbortedCount,
+ })
if (
(previewUnsavedFilters || initialUrlOverridesArePreviewed) &&
@@ -5009,11 +5020,11 @@ export const dashboardLogic = kea<dashboardLogicType>([
tile.filters_overrides = tileFilterOverrides
if (wasIgnored !== isIgnored) {
- eventUsageLogic.actions.reportDashboardTileIgnoreDashboardFiltersToggled(
- props.id,
- tile.insight?.id ?? null,
- isIgnored
- )
+ posthog.capture('dashboard tile ignore dashboard filters toggled', {
+ dashboard_id: props.id,
+ insight_id: tile.insight?.id ?? null,
+ ignored: isIgnored,
+ })
}
actions.refreshDashboardItem({ tile })
lemonToast.success('Tile filters saved')
diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.ts b/frontend/src/scenes/dashboard/newDashboardLogic.ts
index b3204d2a4f21..134a19868bd2 100644
--- a/frontend/src/scenes/dashboard/newDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/newDashboardLogic.ts
@@ -14,6 +14,7 @@ import {
import { forms } from 'kea-forms'
import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
import { actionToUrl, router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { tryShowMCPHint } from 'lib/components/MCPHint/mcpHintLogic'
@@ -421,7 +422,7 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
queryBasedDashboard && dashboardsModel.actions.addDashboardSuccess(queryBasedDashboard)
actions.submitNewDashboardSuccessWithResult(result, variables)
- eventUsageLogic.actions.reportWebDashboardCreatedFromTemplate({
+ posthog.capture('dashboard created from template', {
dashboard_id: result.id,
template_id: template.id,
template_name: template.template_name,
diff --git a/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts b/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts
index fe188379d230..09ea852eeb93 100644
--- a/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts
+++ b/frontend/src/scenes/data-management/events/eventDefinitionsTableLogic.ts
@@ -1,6 +1,7 @@
import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, combineUrl, router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
@@ -682,44 +683,44 @@ export const eventDefinitionsTableLogic = kea<eventDefinitionsTableLogicType>([
},
loadEventDefinitionsSuccess: () => {
if (cache.eventsStartTime !== undefined) {
- eventUsageLogic
- .findMounted()
- ?.actions.reportDataManagementEventDefinitionsPageLoadSucceeded(
- performance.now() - cache.eventsStartTime,
- values.eventDefinitions.results.length
- )
+ if (eventUsageLogic.findMounted()) {
+ 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) {
- eventUsageLogic
- .findMounted()
- ?.actions.reportDataManagementEventDefinitionsPageLoadFailed(
- performance.now() - cache.eventsStartTime,
- error ?? 'There was an unknown error fetching event definitions.'
- )
+ 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.',
+ })
+ }
cache.eventsStartTime = undefined
}
},
loadPropertiesForEventSuccess: () => {
if (cache.propertiesStartTime !== undefined) {
- eventUsageLogic
- .findMounted()
- ?.actions.reportDataManagementEventDefinitionsPageNestedPropertiesLoadSucceeded(
- performance.now() - cache.propertiesStartTime
- )
+ if (eventUsageLogic.findMounted()) {
+ 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) {
- eventUsageLogic
- .findMounted()
- ?.actions.reportDataManagementEventDefinitionsPageNestedPropertiesLoadFailed(
- performance.now() - cache.propertiesStartTime,
- error ?? 'There was an unknown error fetching nested property definitions.'
- )
+ 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.',
+ })
+ }
cache.propertiesStartTime = undefined
}
},
diff --git a/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.test.ts b/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.test.ts
index 6f086246145f..36627759de3b 100644
--- a/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.test.ts
+++ b/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.test.ts
@@ -2,6 +2,7 @@ import { MOCK_GROUP_TYPES, 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_PROPERTY_DEFINITIONS_PER_PAGE } from 'lib/constants'
import { propertyDefinitionsTableLogic } from 'scenes/data-management/properties/propertyDefinitionsTableLogic'
@@ -107,6 +108,43 @@ describe('propertyDefinitionsTableLogic', () => {
expect(api.get).toHaveBeenCalledTimes(1)
})
+ it.each([
+ {
+ outcome: 'succeeded',
+ error: null,
+ action: 'loadPropertyDefinitionsSuccess',
+ event: 'event property definitions page load succeeded',
+ expectedProperties: { num_results: 50 },
+ },
+ {
+ outcome: 'failed',
+ error: 'request failed',
+ action: 'loadPropertyDefinitionsFailure',
+ event: 'event property definitions page load failed',
+ expectedProperties: { error: 'There was an unknown error fetching property definitions.' },
+ },
+ ])(
+ 'captures when loading property definitions $outcome',
+ async ({ error, action, event, expectedProperties }) => {
+ const capture = jest.spyOn(posthog, 'capture').mockImplementation()
+ try {
+ if (error) {
+ api.get.mockRejectedValueOnce(error)
+ }
+ await expectLogic(logic, () =>
+ logic.actions.loadPropertyDefinitions(startingUrl)
+ ).toDispatchActions([action])
+
+ expect(capture).toHaveBeenCalledWith(
+ event,
+ expect.objectContaining({ load_time: expect.any(Number), ...expectedProperties })
+ )
+ } finally {
+ capture.mockRestore()
+ }
+ }
+ )
+
it('pagination forwards and backwards', async () => {
const url = urls.propertyDefinitions()
router.actions.push(url)
diff --git a/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.ts b/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.ts
index a5cd7bab06d7..4adbe39a3d61 100644
--- a/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.ts
+++ b/frontend/src/scenes/data-management/properties/propertyDefinitionsTableLogic.ts
@@ -1,11 +1,11 @@
import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, combineUrl, router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { EVENT_PROPERTY_DEFINITIONS_PER_PAGE } from 'lib/constants'
import { LemonSelectOption } from 'lib/lemon-ui/LemonSelect'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { capitalizeFirstLetter } from 'lib/utils/strings'
import {
@@ -279,23 +279,19 @@ export const propertyDefinitionsTableLogic = kea<propertyDefinitionsTableLogicTy
},
loadPropertyDefinitionsSuccess: () => {
if (cache.propertiesStartTime !== undefined) {
- eventUsageLogic
- .findMounted()
- ?.actions.reportDataManagementEventPropertyDefinitionsPageLoadSucceeded(
- performance.now() - cache.propertiesStartTime,
- values.propertyDefinitions.results.length
- )
+ posthog.capture('event property definitions page load succeeded', {
+ load_time: performance.now() - cache.propertiesStartTime,
+ num_results: values.propertyDefinitions.results.length,
+ })
cache.propertiesStartTime = undefined
}
},
loadPropertyDefinitionsFailure: ({ error }) => {
if (cache.propertiesStartTime !== undefined) {
- eventUsageLogic
- .findMounted()
- ?.actions.reportDataManagementEventPropertyDefinitionsPageLoadFailed(
- performance.now() - cache.propertiesStartTime,
- error ?? 'There was an unknown error fetching property definitions.'
- )
+ posthog.capture('event property definitions page load failed', {
+ load_time: performance.now() - cache.propertiesStartTime,
+ error: error ?? 'There was an unknown error fetching property definitions.',
+ })
cache.propertiesStartTime = undefined
}
},
diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx
index 69e33abff71d..99aca4e85298 100644
--- a/frontend/src/scenes/experiments/experimentLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentLogic.tsx
@@ -13,6 +13,7 @@ import {
} from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { isApprovalRequiredError } from 'lib/api-error'
@@ -22,7 +23,7 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic, type FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
+import { eventUsageLogic, getEventPropertiesForExperiment } from 'lib/utils/eventUsageLogic'
import { addProjectIdIfMissing } from 'lib/utils/kea-router'
import { showApprovalRequiredToast } from 'scenes/approvals/ApprovalRequiredBanner'
import { dispatchChangeRequestCreated } from 'scenes/approvals/utils'
@@ -2320,13 +2321,25 @@ export const experimentLogic = kea<experimentLogicType>([
changeExperimentStartDate: async ({ startDate }) => {
await asyncActions.updateExperiment({ start_date: startDate, update_feature_flag_params: false })
// eslint-disable-next-line no-unused-expressions
- values.experiment && eventUsageLogic.actions.reportExperimentStartDateChange(values.experiment, startDate)
+ if (values.experiment) {
+ posthog.capture('experiment start date changed', {
+ ...getEventPropertiesForExperiment(values.experiment),
+ old_start_date: values.experiment.start_date,
+ new_start_date: startDate,
+ })
+ }
actions.refreshExperimentResults(true, 'experiment_config_change')
},
changeExperimentEndDate: async ({ endDate }) => {
await asyncActions.updateExperiment({ end_date: endDate, update_feature_flag_params: false })
// eslint-disable-next-line no-unused-expressions
- values.experiment && eventUsageLogic.actions.reportExperimentEndDateChange(values.experiment, endDate)
+ if (values.experiment) {
+ posthog.capture('experiment end date changed', {
+ ...getEventPropertiesForExperiment(values.experiment),
+ old_end_date: values.experiment.end_date,
+ new_end_date: endDate,
+ })
+ }
actions.refreshExperimentResults(true, 'experiment_config_change')
},
endExperiment: async ({ openCleanupPr, repository, setRepositoryAsTeamDefault }) => {
@@ -2534,29 +2547,27 @@ export const experimentLogic = kea<experimentLogicType>([
const erroredCount = refreshSummaries.reduce((sum, s) => sum + s.erroredCount, 0)
const cachedCount = refreshSummaries.reduce((sum, s) => sum + s.cachedCount, 0)
- eventUsageLogic.actions.reportExperimentResultsRefreshCompleted(
- values.experimentId,
- values.currentTeamId,
- {
- total_duration_ms: totalDurationMs,
- primary_metrics_count: primaryCount,
- secondary_metrics_count: secondaryCount,
- successful_count: successfulCount,
- errored_count: erroredCount,
- cached_count: cachedCount,
- triggered_by: triggeredBy ?? 'manual',
- force_refresh: !!forceRefresh,
- refresh_id: refreshId,
- experiment_duration_hours: values.experiment?.start_date
- ? Math.round(
- (Date.now() - new Date(values.experiment.start_date).getTime()) / (1000 * 60 * 60)
- )
- : null,
- experiment_status: values.experiment?.status ?? null,
- total_metrics_count: primaryCount + secondaryCount,
- execution_mode: getExperimentExecutionMode(values.featureFlags),
- }
- )
+ posthog.capture('experiment results refresh completed', {
+ experiment_id: values.experimentId,
+ team_id: values.currentTeamId,
+ total_duration_ms: totalDurationMs,
+ primary_metrics_count: primaryCount,
+ secondary_metrics_count: secondaryCount,
+ successful_count: successfulCount,
+ errored_count: erroredCount,
+ cached_count: cachedCount,
+ triggered_by: triggeredBy ?? 'manual',
+ force_refresh: !!forceRefresh,
+ refresh_id: refreshId,
+ experiment_duration_hours: values.experiment?.start_date
+ ? Math.round(
+ (Date.now() - new Date(values.experiment.start_date).getTime()) / (1000 * 60 * 60)
+ )
+ : null,
+ experiment_status: values.experiment?.status ?? null,
+ total_metrics_count: primaryCount + secondaryCount,
+ execution_mode: getExperimentExecutionMode(values.featureFlags),
+ })
const finalState: FinishedRefreshState = caughtError
? 'errored'
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
index fb70cbc89931..d1015e8d30c5 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
@@ -20,6 +20,7 @@ import type { DeepPartial, FieldName } from 'kea-forms'
import { loaders } from 'kea-loaders'
import { beforeUnload, router, urlToAction } from 'kea-router'
import { CombinedLocation } from 'kea-router/lib/utils'
+import posthog from 'posthog-js'
import { createElement } from 'react'
import { toast } from 'react-toastify'
@@ -594,13 +595,13 @@ async function copyNewFlagToAdditionalProjects(
),
].filter((part): part is string => part !== null)
- eventUsageLogic.actions.reportFeatureFlagCreatedInAdditionalProjects(
- targetProjectIds.length,
- created.length,
- overwritten.length,
- pendingApproval.length,
- hardFailures.length
- )
+ posthog.capture('feature flag created in additional projects', {
+ target_count: targetProjectIds.length,
+ created_count: created.length,
+ overwritten_count: overwritten.length,
+ pending_approval_count: pendingApproval.length,
+ failed_count: hardFailures.length,
+ })
const level =
aggregated.failed.length === 0 && overwritten.length === 0
@@ -4038,7 +4039,9 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
const experimentId = currentPath.split('/').pop()
if (experimentId) {
- eventUsageLogic.actions.reportExperimentReleaseConditionsUpdated(parseInt(experimentId))
+ posthog.capture('experiment release conditions updated', {
+ experiment_id: parseInt(experimentId),
+ })
experimentLogic({ experimentId: parseInt(experimentId) }).actions.loadExperiment()
}
},
@@ -4185,7 +4188,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
? `Feature flag ${operation} successfully with ${copiedDependencyCount} dependenc${copiedDependencyCount === 1 ? 'y' : 'ies'}!`
: `Feature flag ${operation} successfully!`
)
- eventUsageLogic.actions.reportFeatureFlagCopySuccess()
+ posthog.capture('feature flag copied')
// Surface any warnings the copy returned (e.g. a flag dependency dropped because it
// doesn't exist in the target, or scheduled changes that failed to copy).
@@ -4311,7 +4314,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
}
},
createScheduledChangeFailure: ({ error }) => {
- eventUsageLogic.actions.reportFeatureFlagScheduleFailure({ error })
+ posthog.capture('feature flag schedule failure', { error: { error } })
},
deleteScheduledChangeSuccess: ({ scheduledChange }) => {
if (scheduledChange) {
diff --git a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts
index 92818f934a3e..a2784a46d2cc 100644
--- a/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts
+++ b/frontend/src/scenes/insights/filters/ActionFilter/entityFilterLogic.ts
@@ -1,5 +1,6 @@
import { deepEqual as equal } from 'fast-equals'
import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import posthog from 'posthog-js'
import { convertPropertyGroupToProperties } from 'lib/components/PropertyFilters/utils'
import { defaultDataWarehousePopoverFields } from 'lib/components/TaxonomicFilter/taxonomicFilterLogic'
@@ -612,7 +613,7 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
const newFilters = values.localFilters.filter((_, i) => i !== index)
actions.setFilters(newFilters)
actions.setLocalFilters(toFilters(newFilters))
- eventUsageLogic.actions.reportInsightFilterRemoved(index)
+ posthog.capture('local filter removed', { index: index })
},
splitLocalFilter: ({ index }) => {
const filter = values.localFilters[index]
@@ -695,11 +696,11 @@ export const entityFilterLogic = kea<entityFilterLogicType>([
props.setFilters(toFilters(filters))
}
const sanitizedFilters = filters?.map(({ id, type }) => ({ id, type }))
- eventUsageLogic.actions.reportInsightFilterSet(sanitizedFilters)
+ posthog.capture('filters set', { filters: sanitizedFilters })
},
setEntityFilterVisibility: async ({ index, value }) => {
const entityName = values.localFilters[index]?.name || undefined
- eventUsageLogic.actions.reportEntityFilterVisibilitySet(index, value, entityName)
+ posthog.capture('entity filter visbility set', { index: index, visible: value, entityName: entityName })
},
})),
events(({ actions, props, values }) => ({
diff --git a/frontend/src/scenes/insights/insightDataLogic.tsx b/frontend/src/scenes/insights/insightDataLogic.tsx
index 5a1ed0bad071..3a3d25df6f52 100644
--- a/frontend/src/scenes/insights/insightDataLogic.tsx
+++ b/frontend/src/scenes/insights/insightDataLogic.tsx
@@ -20,7 +20,6 @@ import posthog from 'posthog-js'
import api from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { PromiseTimeoutError, withTimeout } from 'lib/utils/async'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { insightsApi } from 'scenes/insights/utils/api'
@@ -644,11 +643,11 @@ export const insightDataLogic = kea<insightDataLogicType>([
: { kind: NodeKind.InsightVizNode, source: insightQuery }
const response = await api.insights.generateMetadata(query)
- eventUsageLogic.actions.reportInsightMetadataAiGenerated(insightQuery.kind)
+ posthog.capture('insight metadata ai generated', { query_kind: insightQuery.kind })
return { name: response.name, description: response.description }
} catch (e) {
- eventUsageLogic.actions.reportInsightMetadataAiGenerationFailed(insightQuery.kind)
+ posthog.capture('insight metadata ai generation failed', { query_kind: insightQuery.kind })
throw e
}
},
diff --git a/frontend/src/scenes/insights/insightSceneLogic.test.ts b/frontend/src/scenes/insights/insightSceneLogic.test.ts
index c7d784515e5e..9590b1dc27b1 100644
--- a/frontend/src/scenes/insights/insightSceneLogic.test.ts
+++ b/frontend/src/scenes/insights/insightSceneLogic.test.ts
@@ -49,6 +49,32 @@ describe('insightSceneLogic', () => {
sceneLogic.mount()
})
+ it('captures an insight start after the logic unmounts during the debounce', async () => {
+ const capture = jest.spyOn(posthog, 'capture').mockImplementation()
+ jest.useFakeTimers()
+ try {
+ router.actions.push(urls.insightNew())
+ logic = insightSceneLogic()
+ logic.mount()
+ await jest.advanceTimersByTimeAsync(0)
+
+ expect(capture.mock.calls.filter(([event]) => event === 'insight started')).toHaveLength(0)
+ logic.unmount()
+ expect(logic.isMounted()).toBe(false)
+ await jest.advanceTimersByTimeAsync(499)
+ expect(capture.mock.calls.filter(([event]) => event === 'insight started')).toHaveLength(0)
+ await jest.advanceTimersByTimeAsync(1)
+
+ const insightStarts = capture.mock.calls.filter(([event]) => event === 'insight started')
+ expect(insightStarts).toEqual([
+ ['insight started', expect.objectContaining({ source: 'web', uses_data_warehouse_source: false })],
+ ])
+ } finally {
+ jest.useRealTimers()
+ capture.mockRestore()
+ }
+ })
+
it('keeps url /insight/new', async () => {
router.actions.push(urls.insightNew())
logic = insightSceneLogic()
diff --git a/frontend/src/scenes/insights/insightSceneLogic.tsx b/frontend/src/scenes/insights/insightSceneLogic.tsx
index 3550a3b5e5e5..c25f396ab461 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 } from 'lib/utils/eventUsageLogic'
+import { InsightEventSource, eventUsageLogic, sanitizeQuery } from 'lib/utils/eventUsageLogic'
import { isEmptyObject, isObject } from 'lib/utils/guards'
import { isDashboardFilterOverrideEmpty } from 'scenes/dashboard/dashboardFilterEmpty'
import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'
@@ -81,6 +81,7 @@ import type { insightDataLogicType } from './insightDataLogic'
import { getInsightIconTypeFromQuery, parseDraftQueryFromURL } from './utils'
const NEW_INSIGHT = 'new' as const
+let insightStartedTimeout: ReturnType<typeof setTimeout> | undefined
export type InsightId = InsightShortId | typeof NEW_INSIGHT | null
function normalizeItemId(itemId: string | undefined): number | null {
if (!itemId) {
@@ -170,6 +171,9 @@ export interface insightSceneLogicActions {
setScenePanelIsPresent: (active: boolean) => {
active: boolean
} // sceneLayoutLogic
+ reportInsightStarted: (query: Node | null) => {
+ query: Node<Record<string, any>> | null
+ }
setFreshQuery: (freshQuery: boolean) => {
freshQuery: boolean
}
@@ -335,6 +339,7 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
actions: [sceneLayoutLogic, ['setScenePanelIsPresent']],
})),
actions({
+ reportInsightStarted: (query: Node | null) => ({ query }),
setInsightId: (insightId: InsightShortId) => ({ insightId }),
setInsightMode: (insightMode: ItemMode, source: InsightEventSource | null) => ({ insightMode, source }),
setSceneState: (
@@ -752,6 +757,15 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
},
})),
listeners(({ sharedListeners, values }) => ({
+ reportInsightStarted: ({ query }) => {
+ // "insight started" means the user opened a blank insight editor (intent — it may never be
+ // persisted). The actual creation is tracked server-side as "insight created".
+ // Debounce to avoid multiple quick "New insight" clicks being reported
+ clearTimeout(insightStartedTimeout)
+ insightStartedTimeout = setTimeout(() => {
+ posthog.capture('insight started', { ...sanitizeQuery(query), source: 'web' })
+ }, 500)
+ },
setInsightMode: sharedListeners.reloadInsightLogic,
setSceneState: [
sharedListeners.reloadInsightLogic,
@@ -957,7 +971,7 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
actions.setFreshQuery(true)
}
- eventUsageLogic.actions.reportInsightStarted(query)
+ actions.reportInsightStarted(query)
} else {
// queryFromUrl can also come from the insightType hash param (above), so only
// treat it as a shared link's query when q itself is present.
diff --git a/frontend/src/scenes/insights/insightVizDataLogic.ts b/frontend/src/scenes/insights/insightVizDataLogic.ts
index 9946c725e62c..09525bacd780 100644
--- a/frontend/src/scenes/insights/insightVizDataLogic.ts
+++ b/frontend/src/scenes/insights/insightVizDataLogic.ts
@@ -19,7 +19,6 @@ import {
import { dayjs } from 'lib/dayjs'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { dateMapping, is12HoursOrLess, isLessThan2Days } from 'lib/utils/dateFilters'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { objectsEqual } from 'lib/utils/objects'
import { databaseTableListLogic } from 'scenes/data-management/database/databaseTableListLogic'
import { dataThemeLogic } from 'scenes/dataThemeLogic'
@@ -2693,7 +2692,7 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
},
zoomDateRange: ({ dateFrom, dateTo }) => {
- eventUsageLogic.actions.reportInsightDragToZoomed(values.querySource?.kind)
+ posthog.capture('insight drag to zoomed', { query_kind: values.querySource?.kind })
// Charts emit bucket starts — widen the end to the last selected bucket's end, so
// e.g. dragging over the "May" bar of a monthly chart zooms to all of May.
// Sub-day buckets carry a time component; explicitDate stops the backend from
@@ -2720,7 +2719,7 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
cache.pendingFilterUpdateCancelled = false
return
}
- eventUsageLogic.actions.reportInsightDateRangeChanged(values.querySource?.kind)
+ posthog.capture('insight date range changed', { query_kind: values.querySource?.kind })
const updates = {
dateRange: {
...values.dateRange,
@@ -2750,13 +2749,13 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
},
updateBreakdownFilter: async ({ breakdownFilter }, breakpoint) => {
await breakpoint(500) // extra debounce time because of number input
- eventUsageLogic.actions.reportInsightBreakdownChanged(values.querySource?.kind)
+ posthog.capture('insight breakdown changed', { query_kind: values.querySource?.kind })
const update: Partial<TrendsQuery> = { breakdownFilter: { ...values.breakdownFilter, ...breakdownFilter } }
actions.updateQuerySource(update)
},
updateCompareFilter: async ({ compareFilter }, breakpoint) => {
await breakpoint(500) // extra debounce time because of number input
- eventUsageLogic.actions.reportInsightCompareChanged(values.querySource?.kind)
+ posthog.capture('insight compare changed', { query_kind: values.querySource?.kind })
const update: Partial<TrendsQuery> = { compareFilter: { ...values.compareFilter, ...compareFilter } }
actions.updateQuerySource(update)
},
diff --git a/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts b/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts
index 88aef9615c48..f7408c465fd1 100644
--- a/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts
+++ b/frontend/src/scenes/instance/SystemStatus/systemStatusLogic.ts
@@ -1,10 +1,10 @@
import { MakeLogicType, actions, events, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import api from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { isUserLoggedIn } from 'lib/utils/getAppContext'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { userLogic } from 'scenes/userLogic'
@@ -309,7 +309,7 @@ export const systemStatusLogic = kea<systemStatusLogicType>([
await api.update(`api/instance_settings/${key}`, {
value,
})
- eventUsageLogic.actions.reportInstanceSettingChange(key, value)
+ posthog.capture('instance setting change', { name: key, value: value })
actions.increaseUpdatedInstanceConfigCount()
})
)
diff --git a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
index 0cbe02a440a2..a0a04d170f11 100644
--- a/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
+++ b/frontend/src/scenes/onboarding/legacy/onboardingLogic.tsx
@@ -1,5 +1,6 @@
import { MakeLogicType, actions, connect, kea, listeners, path, props, reducers, selectors } from 'kea'
import { actionToUrl, router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
@@ -714,7 +715,9 @@ export const onboardingLogic = kea<onboardingLogicType>([
if (!productKey || !isKeyOf(productKey, availableOnboardingProducts)) {
return
}
- eventUsageLogic.actions.reportSubscribedDuringOnboarding(productKey)
+ posthog.capture('subscribed during onboarding', {
+ product_key: productKey,
+ })
},
completeOnboarding: async ({ redirectUrlOverride }) => {
// Idempotency guard. Without this, a double-click on Finish, a re-render
diff --git a/frontend/src/scenes/projectLogic.test.ts b/frontend/src/scenes/projectLogic.test.ts
index 543a391caef9..6ebe82cb41cd 100644
--- a/frontend/src/scenes/projectLogic.test.ts
+++ b/frontend/src/scenes/projectLogic.test.ts
@@ -1,6 +1,7 @@
import { MOCK_DEFAULT_PROJECT, MOCK_ORGANIZATION_ID } from 'lib/api.mock'
import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -9,6 +10,31 @@ import { organizationLogic } from './organizationLogic'
import { projectLogic } from './projectLogic'
describe('projectLogic', () => {
+ it('captures project setting changes without event usage logic', async () => {
+ useMocks({
+ patch: {
+ '/api/projects/:id': () => [200, { ...MOCK_DEFAULT_PROJECT, name: 'New project name' }],
+ },
+ })
+ initKeaTests()
+ const logic = projectLogic()
+ logic.mount()
+ logic.actions.loadCurrentProjectSuccess(MOCK_DEFAULT_PROJECT)
+ const capture = jest.spyOn(posthog, 'capture').mockImplementation()
+ try {
+ await expectLogic(logic, () => {
+ logic.actions.updateCurrentProject({ name: 'New project name' })
+ }).toDispatchActions(['updateCurrentProjectSuccess'])
+
+ expect(capture).toHaveBeenCalledWith('name project setting updated', {
+ setting: 'name',
+ value: 'New project name',
+ })
+ } finally {
+ capture.mockRestore()
+ }
+ })
+
it('cancels project deletion in the current organization when the project has no organization_id', async () => {
const requestedOrganizationIds: string[] = []
useMocks({
diff --git a/frontend/src/scenes/projectLogic.ts b/frontend/src/scenes/projectLogic.ts
index 2c4bee70c9a1..c18e8dacaf71 100644
--- a/frontend/src/scenes/projectLogic.ts
+++ b/frontend/src/scenes/projectLogic.ts
@@ -1,10 +1,10 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
+import posthog from 'posthog-js'
import api, { ApiConfig } from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { isUserLoggedIn } from 'lib/utils/getAppContext'
import { getAppContext } from 'lib/utils/getAppContext'
import { identifierToHuman } from 'lib/utils/strings'
@@ -245,8 +245,11 @@ export const projectLogic = kea<projectLogicType>([
actions.loadCurrentOrganization()
actions.loadUser()
- Object.keys(payload).map((property) => {
- eventUsageLogic.findMounted()?.actions?.reportProjectSettingChange(property, payload[property])
+ Object.keys(payload).forEach((property) => {
+ posthog.capture(`${property} project setting updated`, {
+ setting: property,
+ value: payload[property],
+ })
})
if (!window.location.pathname.match(/\/(onboarding|products)/)) {
diff --git a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts b/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
index 49f4035b13f8..4d6b8034911a 100644
--- a/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
+++ b/frontend/src/scenes/saved-insights/savedInsightsLogic.ts
@@ -1,6 +1,7 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import api, { CountedPaginatedResponse } from 'lib/api'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -641,10 +642,10 @@ export const savedInsightsLogic = kea<savedInsightsLogicType>([
let keys = Object.keys(objectDiffShallow(oldFilters, filters))
if (keys.includes('tab')) {
keys = keys.filter((k) => k !== 'tab')
- eventUsageLogic.actions.reportSavedInsightTabChanged(filters.tab)
+ posthog.capture('saved insights list page tab changed', { tab: filters.tab })
}
if (keys.length > 0) {
- eventUsageLogic.actions.reportSavedInsightFilterUsed(keys)
+ posthog.capture('saved insights list page filter used', { filter_keys: keys })
}
}
},
diff --git a/frontend/src/scenes/settings/organization/Permissions/Roles/rolesLogic.tsx b/frontend/src/scenes/settings/organization/Permissions/Roles/rolesLogic.tsx
index 42316386c33c..7c79ad13dde3 100644
--- a/frontend/src/scenes/settings/organization/Permissions/Roles/rolesLogic.tsx
+++ b/frontend/src/scenes/settings/organization/Permissions/Roles/rolesLogic.tsx
@@ -1,8 +1,8 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
import api from 'lib/api'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { membersLogic } from 'scenes/organization/membersLogic'
import { RoleMemberType, RoleType, UserBasicType } from '~/types'
@@ -201,7 +201,9 @@ export const rolesLogic = kea<rolesLogicType>([
const { roles, roleMembersToAdd } = values
const newRole = await api.roles.create(roleName)
await asyncActions.addRoleMembers({ role: newRole, membersToAdd: roleMembersToAdd })
- eventUsageLogic.actions.reportRoleCreated(roleName)
+ posthog.capture('new role created', {
+ role: roleName,
+ })
actions.setRoleMembersInFocus([])
actions.setRoleMembersToAdd([])
actions.setCreateRoleModalShown(false)
diff --git a/frontend/src/scenes/teamLogic.test.ts b/frontend/src/scenes/teamLogic.test.ts
index 894746fc02c0..a215c5c44b6b 100644
--- a/frontend/src/scenes/teamLogic.test.ts
+++ b/frontend/src/scenes/teamLogic.test.ts
@@ -1,6 +1,7 @@
import { MOCK_DEFAULT_PROJECT, MOCK_DEFAULT_TEAM, MOCK_TEAM_ID } from 'lib/api.mock'
import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
import { useMocks } from '~/mocks/jest'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
@@ -83,15 +84,24 @@ describe('teamLogic', () => {
})
it('renames the parent project and syncs it into projectLogic', async () => {
- await expectLogic(logic).toDispatchActions(['loadCurrentTeamSuccess'])
- expect(projectLogic.values.currentProject).toBeNull()
-
- await expectLogic(logic, () => {
- logic.actions.updateCurrentTeam({ name: 'Renamed project' })
- }).toDispatchActions([projectLogic.actionTypes.loadCurrentProjectSuccess, 'updateCurrentTeamSuccess'])
-
- expect(logic.values.currentTeam?.name).toBe('Renamed project')
- expect(projectLogic.values.currentProject?.name).toBe('Renamed project')
+ const capture = jest.spyOn(posthog, 'capture').mockImplementation()
+ try {
+ await expectLogic(logic).toDispatchActions(['loadCurrentTeamSuccess'])
+ expect(projectLogic.values.currentProject).toBeNull()
+
+ await expectLogic(logic, () => {
+ logic.actions.updateCurrentTeam({ name: 'Renamed project' })
+ }).toDispatchActions([projectLogic.actionTypes.loadCurrentProjectSuccess, 'updateCurrentTeamSuccess'])
+
+ expect(logic.values.currentTeam?.name).toBe('Renamed project')
+ expect(projectLogic.values.currentProject?.name).toBe('Renamed project')
+ expect(capture).toHaveBeenCalledWith('name team setting updated', {
+ setting: 'name',
+ value: 'Renamed project',
+ })
+ } finally {
+ capture.mockRestore()
+ }
})
})
diff --git a/frontend/src/scenes/teamLogic.tsx b/frontend/src/scenes/teamLogic.tsx
index 49f2c13aecad..588e3cb885f9 100644
--- a/frontend/src/scenes/teamLogic.tsx
+++ b/frontend/src/scenes/teamLogic.tsx
@@ -10,7 +10,6 @@ import { IconSwapHoriz } from 'lib/lemon-ui/icons'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { DEFAULT_CURRENCY } from 'lib/utils/currency'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { isUserLoggedIn } from 'lib/utils/getAppContext'
import { getAppContext } from 'lib/utils/getAppContext'
import {
@@ -460,10 +459,11 @@ export const teamLogic = kea<teamLogicType>([
message = `${parseUpdatedAttributeName(updatedAttribute)} updated successfully!`
}
- Object.keys(payload).map((property) => {
- eventUsageLogic
- .findMounted()
- ?.actions?.reportTeamSettingChange(property, payload[property as keyof TeamType])
+ Object.keys(payload).forEach((property) => {
+ posthog.capture(`${property} team setting updated`, {
+ setting: property,
+ value: payload[property as keyof TeamType],
+ })
})
const isUpdatingOnboardingTasks = Object.keys(payload).every((key) => key === 'onboarding_tasks')
diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
index 7fa3abebce1e..900af19d1100 100644
--- a/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
+++ b/frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
@@ -3859,12 +3859,12 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna
},
startFocusModeOnboarding: () => {
actions.markFocusModeOnboardingSeen()
- eventUsageLogic.actions.reportWebAnalyticsFocusModeOnboardingStarted()
+ posthog.capture('web analytics focus mode onboarding started')
actions.openFocusModeModal(true)
},
dismissFocusModeOnboarding: () => {
actions.markFocusModeOnboardingSeen()
- eventUsageLogic.actions.reportWebAnalyticsFocusModeOnboardingSkipped()
+ posthog.capture('web analytics focus mode onboarding skipped')
},
enterFocusMode: () => {
if (!values.showFocusMode || values.focusModeConcerns.length === 0) {
@@ -3889,7 +3889,7 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna
actions.setFocusModeEnabled(true)
actions.closeFocusModeModal()
if (wasOnboarding) {
- eventUsageLogic.actions.reportWebAnalyticsFocusModeOnboardingCompleted({
+ posthog.capture('web analytics focus mode onboarding completed', {
concern_count: concernCount,
})
}
@@ -3914,7 +3914,7 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna
} else if (conversionGoal && 'customEventName' in conversionGoal) {
goalType = 'custom_event'
}
- eventUsageLogic.actions.reportWebAnalyticsConversionGoalSet({ goal_type: goalType })
+ posthog.capture('web analytics conversion goal set', { goal_type: goalType })
},
({ conversionGoal }) => {
if (conversionGoal) {
@@ -3953,7 +3953,7 @@ export const webAnalyticsLogic: LogicWrapper<webAnalyticsLogicType> = kea<webAna
shouldAutoOpenFocusModeOnboarding: (shouldOpen: boolean) => {
if (shouldOpen && !values.focusModeOnboardingModalOpen) {
actions.openFocusModeOnboarding()
- eventUsageLogic.actions.reportWebAnalyticsFocusModeOnboardingShown()
+ posthog.capture('web analytics focus mode onboarding shown')
}
},
})),
diff --git a/products/persons/frontend/logics/mergeSplitPersonLogic.ts b/products/persons/frontend/logics/mergeSplitPersonLogic.ts
index bcd7b12a43f3..63f4359163ec 100644
--- a/products/persons/frontend/logics/mergeSplitPersonLogic.ts
+++ b/products/persons/frontend/logics/mergeSplitPersonLogic.ts
@@ -1,11 +1,11 @@
import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
+import posthog from 'posthog-js'
import api from 'lib/api'
import type { CountedPaginatedResponse } from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { PersonType } from '~/types'
import type { PersonListParams } from '~/types'
@@ -124,7 +124,7 @@ export const mergeSplitPersonLogic = kea<mergeSplitPersonLogicType>([
lemonToast.success(
'Person succesfully split. This may take up to a couple of minutes to complete.'
)
- eventUsageLogic.actions.reportPersonSplit(values.person.distinct_ids.length)
+ posthog.capture('split person started', { merge_count: values.person.distinct_ids.length })
actions.setSplitMergeModalShown(false)
router.actions.push('/persons')
return true
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts b/products/product_analytics/frontend/insights/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts
index b727fd807077..0f56b021704d 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts
+++ b/products/product_analytics/frontend/insights/funnels/FunnelFlowGraph/funnelPathsExpansionLogic.ts
@@ -1,8 +1,8 @@
import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import posthog from 'posthog-js'
import { lemonToast } from '@posthog/lemon-ui'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { performQuery } from '~/queries/query'
@@ -115,11 +115,11 @@ export const funnelPathsExpansionLogic = kea<funnelPathsExpansionLogicType>([
listeners(({ actions, values }) => ({
expandPath: async ({ expansion }, breakpoint) => {
- eventUsageLogic.actions.reportCustomerJourneyPathExpanded(
- expansion.pathType,
- expansion.dropOff,
- expansion.stepIndex
- )
+ posthog.capture('customer journey path expanded', {
+ path_type: expansion.pathType,
+ drop_off: expansion.dropOff,
+ step_index: expansion.stepIndex,
+ })
if (values.expandedPathCacheKey && values.expandedPathResults) {
actions.setPathsResults(values.expandedPathCacheKey, values.expandedPathResults)
return