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.

530 B
Raw Blame
import { formatEventName } from 'lib/insights/entityFilterNames'

// Matches the events table: only a column literally named `event` is known to hold event names.
const EVENT_COLUMN_NAME = 'event'

/** Swap a raw PostHog event key (`$pageview`) for its display name (`Pageview`) in chart labels. */
export function humanizeEventColumnValue<T>(columnName: string, value: T): T {
    if (columnName !== EVENT_COLUMN_NAME || typeof value !== 'string') {
        return value
    }
    return (formatEventName(value) ?? value) as T
}