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.

feat(dashboards): capture event on dashboard export (#74713)

Mike Warren60610bd0be76
diff --git a/frontend/src/lib/components/ExportButton/exportsLogic.ts b/frontend/src/lib/components/ExportButton/exportsLogic.ts
index 8a03a007b9f4..72f131192e15 100644
--- a/frontend/src/lib/components/ExportButton/exportsLogic.ts
+++ b/frontend/src/lib/components/ExportButton/exportsLogic.ts
@@ -8,6 +8,7 @@ import { isLongRunningExportFormat } from 'lib/components/ExportButton/exportSta
import { lemonToast } from 'lib/lemon-ui/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'
@@ -238,6 +239,12 @@ export const exportsLogic = kea<exportsLogicType>([
listeners(({ actions, values, cache }) => ({
startExport: async ({ exportData }) => {
+ // 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)
+ }
+
if (isLocalExport(exportData.export_context)) {
try {
const blob = new Blob([exportData.export_context.localData], {
diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.ts
index 1055cc8b2275..99dd9a3ee0d4 100644
--- a/frontend/src/lib/utils/eventUsageLogic.ts
+++ b/frontend/src/lib/utils/eventUsageLogic.ts
@@ -60,6 +60,7 @@ import {
ExperimentHoldoutType,
ExperimentIdType,
ExperimentStatsMethod,
+ ExporterFormat,
FilterLogicalOperator,
FunnelCorrelation,
HelpType,
@@ -613,6 +614,13 @@ export interface eventUsageLogicActions {
dashboardId: number | undefined
promptLabel: string
}
+ reportDashboardExported: (
+ dashboardId: number,
+ exportFormat: ExporterFormat
+ ) => {
+ dashboardId: number
+ exportFormat: ExporterFormat
+ }
reportDashboardFiltersChanged: (
dashboard: DashboardType<QueryBasedInsightModel> | null,
changeType: DashboardFilterChangeType,
@@ -2232,6 +2240,10 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
promptLabel,
dashboardId,
}),
+ reportDashboardExported: (dashboardId: number, exportFormat: ExporterFormat) => ({
+ dashboardId,
+ exportFormat,
+ }),
reportUpgradeModalShown: (featureName: string) => ({ featureName }),
reportTimezoneComponentViewed: (
component: 'label' | 'indicator',
@@ -3236,6 +3248,12 @@ 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)
},