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(insights): time how long a page waits for all its tiles (#104097)

Mike Warrend2c2aac22a1c
diff --git a/frontend/src/lib/internalMetrics.ts b/frontend/src/lib/internalMetrics.ts
index b92eea88948e..98e7197f7f96 100644
--- a/frontend/src/lib/internalMetrics.ts
+++ b/frontend/src/lib/internalMetrics.ts
@@ -1,9 +1,7 @@
import posthog from 'posthog-js'
-export interface TimeToSeeDataPayload {
+interface TimeToSeeDataFields {
team_id?: number | null
- type: 'dashboard_load' | 'insight_load' | 'properties_timeline_load' | 'property_values_load' | 'properties_load'
- context: 'dashboard' | 'insight' | 'actors_modal' | 'filters'
time_to_see_data_ms: number
primary_interaction_id: string
query_id?: string
@@ -20,6 +18,31 @@ export interface TimeToSeeDataPayload {
is_primary_interaction?: boolean
}
+export interface PageLoadTimeToSeeData extends TimeToSeeDataFields {
+ type: 'page_load'
+ context: string
+ scene: string | null
+ time_since_mount_ms: number
+ failed_tile_count?: number
+ last_tile_id?: string | null
+ last_tile_kind?: string | null
+ last_tile_status?: string | null
+ tiles_still_loading?: number
+ cancel_reason?: 'navigated_away' | 'left_app' | 'refreshed'
+}
+
+export type TimeToSeeDataPayload =
+ | (TimeToSeeDataFields & {
+ type:
+ | 'dashboard_load'
+ | 'insight_load'
+ | 'properties_timeline_load'
+ | 'property_values_load'
+ | 'properties_load'
+ context: 'dashboard' | 'insight' | 'actors_modal' | 'filters'
+ })
+ | PageLoadTimeToSeeData
+
export function currentSessionId(): string | undefined {
const sessionDetails = posthog.sessionManager?.checkAndGetSessionAndWindowId?.(true)
return sessionDetails?.sessionId
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.test.ts b/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.test.ts
index e9af9bb964f3..bf16d045a03f 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.test.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.test.ts
@@ -1,17 +1,38 @@
import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
import { dataNodeCollectionLogic } from '~/queries/nodes/DataNode/dataNodeCollectionLogic'
+import { pageCollectionId } from '~/queries/nodes/DataNode/pageCollections'
import { initKeaTests } from '~/test/init'
+jest.mock('posthog-js')
+
+const PAGE_COLLECTION_KEY = pageCollectionId('test-collection')
+
describe('dataNodeCollectionLogic', () => {
let logic: ReturnType<typeof dataNodeCollectionLogic.build>
beforeEach(() => {
initKeaTests()
- logic = dataNodeCollectionLogic({ key: 'test-collection' })
+ ;(posthog.capture as jest.Mock).mockClear()
+ logic = dataNodeCollectionLogic({ key: PAGE_COLLECTION_KEY })
logic.mount()
})
+ const capturedLoads = (): Record<string, any>[] =>
+ (posthog.capture as jest.Mock).mock.calls
+ .filter(([name, properties]) => name === 'time to see data' && properties.type === 'page_load')
+ .map(([, properties]) => properties)
+
+ const mountTile = (id: string): void => {
+ logic.actions.mountDataNode(id, {
+ id,
+ loadData: jest.fn(),
+ cancelQuery: jest.fn(),
+ kind: 'TrendsQuery',
+ })
+ }
+
afterEach(() => {
logic?.unmount()
})
@@ -77,6 +98,10 @@ describe('dataNodeCollectionLogic', () => {
logic.actions.collectionNodeLoadDataSuccess('tile-a')
await expectLogic(logic).toMatchValues({ areAnyLoading: false })
+
+ logic.actions.collectionNodeLoadData('tile-c')
+ mountTile('tile-c')
+ await expectLogic(logic).toMatchValues({ areAnyLoading: true })
})
it('cancelAllLoading only cancels nodes whose status is loading', () => {
@@ -92,4 +117,164 @@ describe('dataNodeCollectionLogic', () => {
expect(cancelA).toHaveBeenCalledTimes(1)
expect(cancelB).not.toHaveBeenCalled()
})
+
+ describe('load telemetry', () => {
+ it('opens one cycle and settles on the last tile, carrying the cycle totals', () => {
+ mountTile('tile-a')
+ mountTile('tile-b')
+
+ logic.actions.collectionNodeLoadData('tile-a')
+ logic.actions.collectionNodeLoadData('tile-b')
+
+ logic.actions.collectionNodeLoadDataSuccess('tile-a', { isCached: true })
+ expect(capturedLoads()).toHaveLength(0)
+
+ logic.actions.collectionNodeLoadDataFailure('tile-b')
+
+ expect(capturedLoads()).toEqual([
+ expect.objectContaining({
+ context: 'test-collection',
+ action: 'initial_load',
+ status: 'failure',
+ insights_fetched: 2,
+ insights_fetched_cached: 1,
+ failed_tile_count: 1,
+ last_tile_id: 'tile-b',
+ last_tile_kind: 'TrendsQuery',
+ last_tile_status: 'failure',
+ time_to_see_data_ms: expect.any(Number),
+ primary_interaction_id: expect.any(String),
+ }),
+ ])
+ })
+
+ it('labels a reloadAll cycle refresh and the cycle after it update', () => {
+ logic.actions.mountDataNode('tile-a', {
+ id: 'tile-a',
+ loadData: jest.fn(() => logic.actions.collectionNodeLoadData('tile-a')),
+ cancelQuery: jest.fn(),
+ })
+
+ logic.actions.collectionNodeLoadData('tile-a')
+ logic.actions.collectionNodeLoadDataSuccess('tile-a')
+
+ logic.actions.reloadAll()
+ logic.actions.collectionNodeLoadDataSuccess('tile-a')
+
+ logic.actions.collectionNodeLoadData('tile-a')
+ logic.actions.collectionNodeLoadDataSuccess('tile-a')
+
+ expect(capturedLoads().map((p) => p.action)).toEqual(['initial_load', 'refresh', 'update'])
+ })
+
+ it('stays silent for a collection not registered as a page container', () => {
+ const privateLogic = dataNodeCollectionLogic({ key: 'a-trace-or-chart-id' })
+ privateLogic.mount()
+ privateLogic.actions.mountDataNode('tile-a', { id: 'tile-a', loadData: jest.fn(), cancelQuery: jest.fn() })
+
+ privateLogic.actions.collectionNodeLoadData('tile-a')
+ privateLogic.actions.collectionNodeLoadDataSuccess('tile-a')
+
+ expect(posthog.capture).not.toHaveBeenCalled()
+ privateLogic.unmount()
+ })
+
+ it('counts a tile once when it reloads before the load ends', () => {
+ mountTile('tile-a')
+ mountTile('tile-b')
+ logic.actions.collectionNodeLoadData('tile-a')
+ logic.actions.collectionNodeLoadData('tile-b')
+ logic.actions.collectionNodeLoadDataFailure('tile-a')
+
+ logic.actions.collectionNodeLoadData('tile-a')
+ logic.actions.collectionNodeLoadDataSuccess('tile-b')
+ expect(capturedLoads()).toHaveLength(0)
+
+ logic.actions.collectionNodeLoadDataSuccess('tile-a', { isCached: true })
+
+ expect(capturedLoads()).toEqual([
+ expect.objectContaining({
+ status: 'success',
+ insights_fetched: 2,
+ insights_fetched_cached: 1,
+ failed_tile_count: 0,
+ }),
+ ])
+ })
+
+ it.each([
+ [
+ 'every loading tile unmounts',
+ (): void => {
+ logic.actions.unmountDataNode('tile-a')
+ logic.actions.unmountDataNode('tile-b')
+ },
+ 'navigated_away',
+ 2,
+ undefined,
+ ],
+ [
+ 'a loading tile unmounts after its sibling finished',
+ (): void => {
+ logic.actions.collectionNodeLoadDataSuccess('tile-b')
+ logic.actions.unmountDataNode('tile-a')
+ logic.actions.unmountDataNode('tile-b')
+ },
+ 'navigated_away',
+ 1,
+ undefined,
+ ],
+ [
+ 'a tile unmounts while it reloads',
+ (): void => {
+ logic.actions.collectionNodeLoadDataSuccess('tile-a')
+ logic.actions.collectionNodeLoadData('tile-a')
+ logic.actions.collectionNodeLoadDataSuccess('tile-b')
+ logic.actions.unmountDataNode('tile-a')
+ },
+ 'navigated_away',
+ 1,
+ undefined,
+ ],
+ [
+ 'the person refreshes',
+ (): void => {
+ logic.actions.reloadAll()
+ },
+ 'refreshed',
+ 2,
+ undefined,
+ ],
+ [
+ 'the page is hidden',
+ (): void => {
+ window.dispatchEvent(new Event('pagehide'))
+ },
+ 'left_app',
+ 2,
+ { transport: 'sendBeacon' },
+ ],
+ ])('reports one cancelled load when %s', (_, leave, reason, stillLoading, options) => {
+ mountTile('tile-a')
+ mountTile('tile-b')
+ logic.actions.collectionNodeLoadData('tile-a')
+ logic.actions.collectionNodeLoadData('tile-b')
+
+ leave()
+
+ expect(posthog.capture).toHaveBeenCalledTimes(1)
+ expect(posthog.capture).toHaveBeenCalledWith(
+ 'time to see data',
+ expect.objectContaining({
+ context: 'test-collection',
+ action: 'initial_load',
+ status: 'cancelled',
+ cancel_reason: reason,
+ insights_fetched: 2,
+ tiles_still_loading: stillLoading,
+ }),
+ options
+ )
+ })
+ })
})
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts b/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts
index 6d4651e7c287..85544201e4b7 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeCollectionLogic.ts
@@ -1,11 +1,22 @@
-import { MakeLogicType, actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import posthog, { CaptureOptions } from 'posthog-js'
+import { PageLoadTimeToSeeData } from 'lib/internalMetrics'
+import { uuid } from 'lib/utils/dom'
+import { sceneLogic } from 'scenes/sceneLogic'
+
+import { isPageCollection } from '~/queries/nodes/DataNode/pageCollections'
import { RefreshType } from '~/queries/schema/schema-general'
export interface DataNodeRegisteredProps {
id: string
loadData: (refresh?: RefreshType) => void
cancelQuery: () => void
+ kind?: string
+}
+
+export interface CollectionNodeLoadMeta {
+ isCached?: boolean
}
export interface DataNodeCollectionProps {
@@ -19,6 +30,23 @@ export interface DataNodeStatus {
export type DataNodeStatusMap = Record<string, DataNodeStatus | undefined>
+export type DataCollectionLoadTrigger = 'initial_load' | 'refresh' | 'update'
+
+interface DataCollectionLoadTile {
+ kind: string | null
+ status: 'loading' | 'success' | 'failure'
+ cached: boolean
+}
+
+interface DataCollectionLoadCycle {
+ id: string
+ startedAt: number
+ scene: string | null
+ trigger: DataCollectionLoadTrigger
+ tiles: Map<string, DataCollectionLoadTile>
+ lastTileId: string | null
+}
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface dataNodeCollectionLogicValues {
areAnyLoading: boolean
@@ -35,8 +63,12 @@ export interface dataNodeCollectionLogicActions {
collectionNodeLoadDataFailure: (id: string) => {
id: string
}
- collectionNodeLoadDataSuccess: (id: string) => {
+ collectionNodeLoadDataSuccess: (
+ id: string,
+ meta?: CollectionNodeLoadMeta
+ ) => {
id: string
+ meta: CollectionNodeLoadMeta | undefined
}
mountDataNode: (
id: string,
@@ -45,6 +77,9 @@ export interface dataNodeCollectionLogicActions {
id: string
props: DataNodeRegisteredProps
}
+ pageHidden: () => {
+ value: true
+ }
reloadAll: () => {}
unmountDataNode: (id: string) => {
id: string
@@ -78,8 +113,9 @@ export const dataNodeCollectionLogic = kea<dataNodeCollectionLogicType>([
reloadAll: () => ({}),
cancelAllLoading: () => ({}),
collectionNodeLoadData: (id: string) => ({ id }),
- collectionNodeLoadDataSuccess: (id: string) => ({ id }),
+ collectionNodeLoadDataSuccess: (id: string, meta?: CollectionNodeLoadMeta) => ({ id, meta }),
collectionNodeLoadDataFailure: (id: string) => ({ id }),
+ pageHidden: true,
}),
reducers({
mountedDataNodes: [
@@ -96,7 +132,7 @@ export const dataNodeCollectionLogic = kea<dataNodeCollectionLogicType>([
{} as DataNodeStatusMap,
{
mountDataNode: (state, payload) => {
- return { ...state, [payload.id]: { isLoading: false, hasError: false } }
+ return { ...state, [payload.id]: state[payload.id] ?? { isLoading: false, hasError: false } }
},
unmountDataNode: (state, payload) => {
const { [payload.id]: _discard, ...rest } = state
@@ -124,20 +160,155 @@ export const dataNodeCollectionLogic = kea<dataNodeCollectionLogicType>([
},
],
}),
- listeners(({ values }) => ({
- reloadAll: () => {
- // We want to force refresh all nodes, so we use 'force_async' to bypass cache
- // The loadData function in each node will handle converting this to the appropriate type
- // based on whether the node is an insight or not
- values.mountedDataNodes.forEach((node) => node.loadData('force_async'))
- },
- cancelAllLoading: () => {
- values.mountedDataNodes.forEach((node) => {
- const status = values.collectionNodeStatus[node.id]
- if (status?.isLoading) {
- node.cancelQuery()
- }
+ listeners(({ values, props, cache }) => {
+ const countTiles = (
+ cycle: DataCollectionLoadCycle,
+ matches: (tile: DataCollectionLoadTile) => boolean
+ ): number => [...cycle.tiles.values()].filter(matches).length
+
+ const report = (
+ cycle: DataCollectionLoadCycle,
+ outcome: Partial<PageLoadTimeToSeeData>,
+ options?: CaptureOptions
+ ): void => {
+ if (!isPageCollection(props.key) || !posthog.capture) {
+ return
+ }
+ const payload: PageLoadTimeToSeeData = {
+ type: 'page_load',
+ context: props.key,
+ action: cycle.trigger,
+ primary_interaction_id: cycle.id,
+ time_to_see_data_ms: Math.round(performance.now() - cycle.startedAt),
+ insights_fetched: cycle.tiles.size,
+ insights_fetched_cached: countTiles(cycle, (tile) => tile.cached),
+ scene: cycle.scene,
+ time_since_mount_ms: Math.round(performance.now() - cache.mountedAt),
+ ...outcome,
+ }
+ posthog.capture('time to see data', payload, options)
+ }
+
+ const setTile = (
+ cycle: DataCollectionLoadCycle,
+ id: string,
+ status: DataCollectionLoadTile['status'],
+ cached = false
+ ): void => {
+ const kind = values.mountedDataNodes.find((node) => node.id === id)?.kind ?? null
+ cycle.tiles.set(id, { kind, status, cached })
+ }
+
+ const finishTile = (id: string, status: 'success' | 'failure', cached = false): void => {
+ const cycle = cache.cycle
+ if (!cycle) {
+ return
+ }
+ setTile(cycle, id, status, cached)
+ cycle.lastTileId = id
+ if (!values.areAnyLoading) {
+ settle(cycle)
+ }
+ }
+
+ const closeCycle = (): void => {
+ cache.cycle = null
+ cache.completedCycles += 1
+ }
+
+ const settle = (cycle: DataCollectionLoadCycle): void => {
+ const failedTileCount = countTiles(cycle, (tile) => tile.status === 'failure')
+ const lastTile = cycle.lastTileId ? cycle.tiles.get(cycle.lastTileId) : undefined
+ report(cycle, {
+ status: failedTileCount > 0 ? 'failure' : 'success',
+ failed_tile_count: failedTileCount,
+ last_tile_id: cycle.lastTileId,
+ last_tile_kind: lastTile?.kind ?? null,
+ last_tile_status: lastTile?.status ?? null,
})
- },
- })),
+ closeCycle()
+ }
+
+ const abandon = (
+ cycle: DataCollectionLoadCycle,
+ reason: NonNullable<PageLoadTimeToSeeData['cancel_reason']>,
+ options?: CaptureOptions
+ ): void => {
+ report(
+ cycle,
+ {
+ status: 'cancelled',
+ cancel_reason: reason,
+ tiles_still_loading: countTiles(cycle, (tile) => tile.status === 'loading'),
+ },
+ options
+ )
+ closeCycle()
+ }
+
+ return {
+ reloadAll: () => {
+ if (cache.cycle) {
+ abandon(cache.cycle, 'refreshed')
+ }
+ cache.pendingTrigger = 'refresh'
+ // We want to force refresh all nodes, so we use 'force_async' to bypass cache
+ // The loadData function in each node will handle converting this to the appropriate type
+ // based on whether the node is an insight or not
+ values.mountedDataNodes.forEach((node) => node.loadData('force_async'))
+ cache.pendingTrigger = null
+ },
+ cancelAllLoading: () => {
+ values.mountedDataNodes.forEach((node) => {
+ const status = values.collectionNodeStatus[node.id]
+ if (status?.isLoading) {
+ node.cancelQuery()
+ }
+ })
+ },
+ collectionNodeLoadData: ({ id }) => {
+ if (!cache.cycle) {
+ cache.cycle = {
+ id: uuid(),
+ startedAt: performance.now(),
+ scene: sceneLogic.findMounted()?.values.activeSceneId ?? null,
+ trigger: cache.pendingTrigger ?? (cache.completedCycles === 0 ? 'initial_load' : 'update'),
+ tiles: new Map(),
+ lastTileId: null,
+ } satisfies DataCollectionLoadCycle
+ }
+ setTile(cache.cycle, id, 'loading')
+ },
+ collectionNodeLoadDataSuccess: ({ id, meta }) => {
+ finishTile(id, 'success', !!meta?.isCached)
+ },
+ collectionNodeLoadDataFailure: ({ id }) => {
+ finishTile(id, 'failure')
+ },
+ unmountDataNode: ({ id }) => {
+ if (cache.cycle?.tiles.get(id)?.status === 'loading') {
+ abandon(cache.cycle, 'navigated_away')
+ }
+ },
+ pageHidden: () => {
+ if (cache.cycle) {
+ abandon(cache.cycle, 'left_app', { transport: 'sendBeacon' })
+ }
+ },
+ }
+ }),
+ afterMount(({ actions, cache }) => {
+ cache.mountedAt = performance.now()
+ cache.cycle = null
+ cache.completedCycles = 0
+ cache.pendingTrigger = null
+ cache.disposables.add(
+ () => {
+ window.addEventListener('pagehide', actions.pageHidden)
+ return () => window.removeEventListener('pagehide', actions.pageHidden)
+ },
+ 'pagehide',
+ { pauseOnPageHidden: false }
+ )
+ }),
])
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
index e509a01d7dd6..a0741887f214 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
@@ -348,8 +348,12 @@ export interface dataNodeLogicActions {
collectionNodeLoadDataFailure: (id: string) => {
id: string
} // dataNodeCollectionLogic
- collectionNodeLoadDataSuccess: (id: string) => {
+ collectionNodeLoadDataSuccess: (
+ id: string,
+ meta?: import('~/queries/nodes/DataNode/dataNodeCollectionLogic').CollectionNodeLoadMeta | undefined
+ ) => {
id: string
+ meta: import('~/queries/nodes/DataNode/dataNodeCollectionLogic').CollectionNodeLoadMeta | undefined
} // dataNodeCollectionLogic
mountDataNode: (
id: string,
@@ -2111,7 +2115,9 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
},
loadDataSuccess: ({ response }) => {
props.onData?.(response as Record<string, unknown> | null | undefined)
- actions.collectionNodeLoadDataSuccess(props.key)
+ actions.collectionNodeLoadDataSuccess(props.key, {
+ isCached: !!response && typeof response === 'object' && 'is_cached' in response && !!response.is_cached,
+ })
if ('query' in props.query) {
cache.localResults[JSON.stringify(props.query.query)] = response
}
@@ -2205,6 +2211,14 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
})),
afterMount(({ actions, props, cache }) => {
cache.localResults = {}
+
+ actions.mountDataNode(props.key, {
+ id: props.key,
+ loadData: actions.loadData,
+ cancelQuery: actions.cancelQuery,
+ kind: props.query?.kind,
+ })
+
if (props.cachedResults) {
// Use cached results if available, otherwise this logic will load the data again.
// We need to set them here, as the propsChanged listener will not trigger on mount
@@ -2215,12 +2229,6 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
const refreshType = isInsightQueryNode(props.query) ? 'async' : 'blocking'
actions.loadData(refreshType)
}
-
- actions.mountDataNode(props.key, {
- id: props.key,
- loadData: actions.loadData,
- cancelQuery: actions.cancelQuery,
- })
}),
beforeUnmount(({ actions, props, values }) => {
if (values.autoLoadRunning) {
diff --git a/frontend/src/queries/nodes/DataNode/pageCollections.ts b/frontend/src/queries/nodes/DataNode/pageCollections.ts
new file mode 100644
index 000000000000..dc149e5f8d2d
--- /dev/null
+++ b/frontend/src/queries/nodes/DataNode/pageCollections.ts
@@ -0,0 +1,10 @@
+const pageCollectionIds = new Set<string>()
+
+export function pageCollectionId(id: string): string {
+ pageCollectionIds.add(id)
+ return id
+}
+
+export function isPageCollection(id: string): boolean {
+ return pageCollectionIds.has(id)
+}
diff --git a/frontend/src/scenes/web-analytics/common.ts b/frontend/src/scenes/web-analytics/common.ts
index 4316c6ef9d45..0e42bab99671 100644
--- a/frontend/src/scenes/web-analytics/common.ts
+++ b/frontend/src/scenes/web-analytics/common.ts
@@ -8,6 +8,7 @@ import { type FeatureFlagsSet } from 'lib/logic/featureFlagLogic'
import { getDefaultInterval } from 'lib/utils/dateFilters'
import { UnexpectedNeverError } from 'lib/utils/guards'
+import { pageCollectionId } from '~/queries/nodes/DataNode/pageCollections'
import { hogqlQuery } from '~/queries/query'
import {
BreakdownFilter,
@@ -526,7 +527,7 @@ export const getWebAnalyticsBreakdownFilter = (breakdown: WebStatsBreakdown): Br
export const GEOIP_TEMPLATE_IDS = ['template-geoip', 'plugin-posthog-plugin-geoip']
-export const WEB_ANALYTICS_DATA_COLLECTION_NODE_ID = 'web-analytics'
+export const WEB_ANALYTICS_DATA_COLLECTION_NODE_ID = pageCollectionId('web-analytics')
export const INITIAL_WEB_ANALYTICS_FILTER = [] as WebAnalyticsPropertyFilters
export const INITIAL_DATE_FROM = '-7d' as string | null
diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsTilesLogic.ts b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsTilesLogic.ts
index e3bf2fac1c2b..001b765f9c00 100644
--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsTilesLogic.ts
+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsTilesLogic.ts
@@ -7,6 +7,7 @@ import { isNotNil } from 'lib/utils/guards'
import { MARKETING_ANALYTICS_DEFAULT_QUERY_TAGS, QueryTile, TileId, loadPriorityMap } from 'scenes/web-analytics/common'
import { getDashboardItemId } from 'scenes/web-analytics/insightsUtils'
+import { pageCollectionId } from '~/queries/nodes/DataNode/pageCollections'
import {
CompareFilter,
ConversionGoalFilter,
@@ -45,7 +46,7 @@ import {
validColumnsForTiles,
} from './utils'
-export const MARKETING_ANALYTICS_DATA_COLLECTION_NODE_ID = 'marketing-analytics'
+export const MARKETING_ANALYTICS_DATA_COLLECTION_NODE_ID = pageCollectionId('marketing-analytics')
const isSchemaBackedMarketingColumn = (column: validColumnsForTiles): column is rawColumnsForTiles =>
column !== 'roas' && column !== 'cost_per_reported_conversion'
diff --git a/frontend/src/scenes/web-analytics/webAnalyticsLoadTimeLogic.ts b/frontend/src/scenes/web-analytics/webAnalyticsLoadTimeLogic.ts
index 522ea8f8267f..2f1231a67ac2 100644
--- a/frontend/src/scenes/web-analytics/webAnalyticsLoadTimeLogic.ts
+++ b/frontend/src/scenes/web-analytics/webAnalyticsLoadTimeLogic.ts
@@ -44,8 +44,12 @@ export interface webAnalyticsLoadTimeLogicActions {
collectionNodeLoadDataFailure: (id: string) => {
id: string
} // dataNodeCollectionLogic
- collectionNodeLoadDataSuccess: (id: string) => {
+ collectionNodeLoadDataSuccess: (
+ id: string,
+ meta?: import('~/queries/nodes/DataNode/dataNodeCollectionLogic').CollectionNodeLoadMeta | undefined
+ ) => {
id: string
+ meta: import('~/queries/nodes/DataNode/dataNodeCollectionLogic').CollectionNodeLoadMeta | undefined
} // dataNodeCollectionLogic
recordVisit: () => {
value: true
diff --git a/products/customer_analytics/frontend/constants.ts b/products/customer_analytics/frontend/constants.ts
index 38347fdbab08..c055d764273f 100644
--- a/products/customer_analytics/frontend/constants.ts
+++ b/products/customer_analytics/frontend/constants.ts
@@ -1,6 +1,7 @@
+import { pageCollectionId } from '~/queries/nodes/DataNode/pageCollections'
import { ProductKey, QueryLogTags } from '~/queries/schema/schema-general'
-export const CUSTOMER_ANALYTICS_DATA_COLLECTION_NODE_ID = 'customer-analytics'
+export const CUSTOMER_ANALYTICS_DATA_COLLECTION_NODE_ID = pageCollectionId('customer-analytics')
export const ACCOUNTS_TABLE_DATA_NODE_KEY = 'customer-analytics-accounts-table'
diff --git a/products/mcp_analytics/frontend/components/toolCallFeedQuery.ts b/products/mcp_analytics/frontend/components/toolCallFeedQuery.ts
index fef15be0c5e0..07a886b83977 100644
--- a/products/mcp_analytics/frontend/components/toolCallFeedQuery.ts
+++ b/products/mcp_analytics/frontend/components/toolCallFeedQuery.ts
@@ -1,10 +1,11 @@
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { MCP_TOOL_CALL_EVENT } from 'lib/components/TaxonomicFilter/utils/mcpProperties'
+import { pageCollectionId } from '~/queries/nodes/DataNode/pageCollections'
import { DataTableNode, HogQLFilters, NodeKind } from '~/queries/schema/schema-general'
import { AnyPropertyFilter, PropertyFilterType, PropertyOperator } from '~/types'
-export const MCP_ACTIVITY_DATA_COLLECTION_ID = 'mcp-analytics-activity'
+export const MCP_ACTIVITY_DATA_COLLECTION_ID = pageCollectionId('mcp-analytics-activity')
export const MCP_ACTIVITY_PAGE_SIZE = 100
export const MCP_ACTIVITY_MAX_ROWS = 1000
export const MCP_ACTIVITY_INTENT_COLUMN = 'properties.$mcp_intent -- Agent intent'