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.

12.7 KB
Raw Blame
import { sceneConfigurations } from 'scenes/scenes'

import { FileSystemImport } from '~/queries/schema/schema-general'

const descriptions: Record<string, string> = {
    Home: 'Pick up where you left off with the insights, dashboards, and activity that matter to your project.',
    Activity:
        'Explore the events people send to your project. Inspect their properties to understand exactly what happened.',
    'SQL editor':
        'Ask questions that need more than a chart builder. Query your events and warehouse tables together, then turn the results into a table or visualization.',
    'Product analytics':
        'Find out how people discover, use, and return to your product. Explore trends, conversion funnels, retention, and the paths people take.',
    Dashboards:
        'Bring related insights together in one place. Follow your key metrics over time and share the same view of progress with your team.',
    'Session replay':
        'Watch how people actually experience your product. Follow their clicks and navigation to understand the behavior behind a metric or bug report.',
    'Feature flags':
        'Choose who sees a feature without another deployment. Roll changes out gradually, target a specific group, or turn a feature off when something goes wrong.',
    Experiments:
        'Compare product changes with a controlled test. Measure their effect on the metrics you care about before deciding what to ship.',
    'Web analytics':
        'Understand who visits your website, where they come from, and which pages lead to conversions. Start with traffic, then explore what drives it.',
    'Error tracking':
        'Turn exceptions into issues you can investigate. See who was affected and connect errors with the context you need to find the cause.',
    Surveys:
        'Ask people about their experience while it is still fresh. Collect feedback in your product and use it to explain what your analytics cannot.',
    Heatmaps:
        'See where people click and how far they scroll. Spot overlooked calls to action and places where a page loses attention.',
    Notebooks:
        'Keep an investigation together with notes, insights, and recordings. Give your team the evidence and context behind your conclusions.',
    'LLM analytics':
        'Follow your AI application from prompts to responses. Inspect traces, latency, token usage, and cost to understand quality and performance.',
    Persons:
        'Explore the people and groups behind your events, including their properties and activity. Connect an individual experience with the patterns in your analytics.',
    Cohorts:
        'Group people by what they do and who they are. Reuse those audiences in analysis, feature targeting, and experiments.',
    'SQL variables':
        'Define reusable values for SQL queries so you can change a shared parameter without editing every query.',
    'Core events':
        'Choose the events that signal meaningful use of your product. Give your team a shared starting point for understanding customer activity.',
    'Revenue definitions':
        'Tell PostHog which events represent revenue and where to find their amounts and currencies. Use consistent revenue measures across your analyses.',
    'Property groups':
        'Organize related properties into reusable groups. Make a large tracking schema easier to navigate and understand.',
    'Event definitions':
        'Explore the events captured in your project and document what they mean. Help your team choose the right events for an analysis.',
    'Property definitions':
        'Explore the properties attached to your events and people. Document their meaning so everyone interprets the same data consistently.',
    'Managed viewsets':
        'Set up collections of warehouse views built for a particular kind of analysis. Reuse prepared data models instead of starting each query from scratch.',
    Annotations:
        'Add context to changes in your metrics. Mark releases, campaigns, and other milestones so your team can connect a chart with what happened.',
    ETL: 'Watch the data moving into PostHog and out to your own warehouses. See what is running, what is stale, and what has stopped.',
    Sources:
        'Bring data from your other tools into PostHog. Combine it with product events to answer questions that span your business.',
    Destinations:
        'Send events from PostHog to the tools that need them. Connect product activity with the rest of your workflows.',
    Transformations:
        'Reshape incoming events before they reach your analyses. Keep event names and properties consistent across your tracking.',
    Models: 'Turn SQL queries into reusable views and materialized views. Build on shared data models instead of repeating the same preparation in every analysis.',
}

/**
 * Tree items whose product has no page on posthog.com/docs yet, so they show no docs link.
 * Every other sidebar product must have one — `sidebarProductMeta.test.ts` fails when a new product has neither.
 */
export const SIDEBAR_PRODUCTS_WITHOUT_DOCS = new Set<string>([
    'Application observability',
    'Apps',
    'Autoresearch',
    'Broadcasts',
    'Business intelligence',
    'Business knowledge',
    'Code review',
    'Engineering analytics',
    'Identity matching',
    'Platform alerts',
    'Product tours',
    'Pulse',
    'Transactional',
    'Uptime monitoring',
    'Visual review',
    'Wizard',
])

const examples: Record<string, string> = {
    Home: 'Return to a dashboard you were investigating yesterday.',
    Activity: 'Check which properties arrive with a signup event.',
    'SQL editor': 'Join signup events with billing data to compare activation by plan.',
    'Product analytics': 'Find the step where new users drop out of onboarding.',
    Dashboards: 'Keep activation, retention, and revenue on a weekly team dashboard.',
    'Session replay': 'Watch a failed checkout to see what got in the way.',
    'Feature flags': 'Try a new navigation with your team before rolling it out to everyone.',
    Experiments: 'Test whether a shorter signup flow improves activation.',
    'Web analytics': 'Find which referral sources bring visitors who sign up.',
    'Error tracking': 'Investigate an exception that appeared after a release.',
    Surveys: 'Ask people who abandon a flow what they were trying to do.',
    Heatmaps: 'Check whether visitors reach your pricing call to action.',
    Notebooks: 'Share a funnel drop-off alongside recordings that explain it.',
    'LLM analytics': 'Find the model calls making an assistant slow or expensive.',
    Persons: 'Review a user’s recent events while investigating a support question.',
    Cohorts: 'Compare people who tried a feature with those who have not.',
    Apps: 'Build an internal Python dashboard using your project data.',
    Broadcasts: 'Send an announcement to a cohort of beta testers.',
    Transactional: 'Send a password reset email from your backend.',
    'Business knowledge': 'Give your AI assistant context about how your business works.',
    Clusters: 'Discover common themes in conversations with your AI assistant.',
    'Code review': 'Review automated findings on a pull request before it merges.',
    'Customer analytics': 'Explore activity across the accounts that use your product.',
    'Data catalog': 'Find the agreed definition of a metric before using it.',
    'Data warehouse': 'Manage the shared data your team uses for analysis.',
    Datasets: 'Keep representative prompts and expected answers for testing.',
    'Early access features': 'Let interested users opt into a public beta.',
    Endpoints: 'Serve a saved query to your application and track its usage.',
    'Engineering analytics': 'Find workflows that slow down pull requests.',
    Evaluations: 'Check whether AI responses meet your quality criteria.',
    'Identity matching': 'Review how identities connect across your data.',
    Inbox: 'Review a report about friction discovered in user sessions.',
    Logs: 'Search application logs around the time an error occurred.',
    'MCP analytics': 'See which tools AI users call and what they are trying to achieve.',
    'MCP servers': 'Find a server that gives your agent the tools it needs.',
    'Marketing analytics': 'Compare campaign performance alongside your product data.',
    Metrics: 'Investigate a change in application performance over time.',
    Playground: 'Try a revised prompt before using it in your application.',
    'Product tours': 'Guide new users through their first useful action.',
    Prompts: 'Keep track of changes to the prompts your application uses.',
    Pulse: 'Follow what is happening across your project.',
    'Replay vision': 'Explore patterns found in session recordings.',
    Skills: 'Share reusable instructions with the agents your team uses.',
    Support: 'Investigate and respond to a customer’s support request.',
    Taggers: 'Label AI generations so you can compare different kinds of requests.',
    Tasks: 'Ask an agent to investigate an issue and prepare a code change.',
    Toolbar: 'Inspect elements on your website while setting up tracking.',
    Tracing: 'Follow a slow request across services to find the bottleneck.',
    'Visual review': 'Review visual changes before they reach users.',
    'Web scripts': 'Add a website tag without changing your application code.',
    Wizard: 'Review the code changes an agent prepares to set up PostHog.',
    Workflows: 'Send a follow-up when someone completes an onboarding step.',
    Actions: 'Combine related clicks into a single event for analysis.',
    Annotations: 'Mark a release date to help explain a change in a chart.',
    'Core events': 'Define the events that represent meaningful product usage.',
    Destinations: 'Send captured events to another tool your team uses.',
    'Event definitions': 'Check what an event means before adding it to an insight.',
    'Event ingestion filtering': 'Filter unwanted events before they enter your project.',
    'Event ingestion warnings': 'Investigate events that were not ingested as expected.',
    'Managed migrations': 'Bring historical events into PostHog.',
    'Managed viewsets': 'Set up a collection of warehouse views for analysis.',
    Models: 'Save a reusable query as a view for other analyses.',
    'Property definitions': 'Check the meaning and format of an event property.',
    'Property groups': 'Organize related properties so they are easier to find.',
    'Revenue definitions': 'Choose the events and properties that represent revenue.',
    'SQL variables': 'Reuse the same date boundary across several queries.',
    Sources: 'Connect billing or support data to your product analytics.',
    Transformations: 'Clean or reshape incoming data before you analyze it.',
    'Warehouse destinations': 'Choose where a warehouse source sends its synced rows.',
    'Warehouse properties': 'Add account attributes from a warehouse table to your groups.',
}

// Pinned pages that have no scene config of their own to carry a docs link.
const docsHrefs: Record<string, string> = {
    Activity: 'https://posthog.com/docs/data/events',
    Persons: 'https://posthog.com/docs/data/persons',
}

export interface SidebarProductMeta {
    example?: string
    description?: string
    docsHref?: string
}

/** Group paths come from configurable group type names, so groups share this copy. */
export const SIDEBAR_GROUP_META = {
    description:
        'Explore the organizations, accounts, or other groups behind your events. Understand usage at the group level.',
    example: 'Compare activity across customer accounts.',
}

/** The copy of one sidebar name, for a row that is not a tree item. */
export function sidebarProductCopy(name: string): SidebarProductMeta {
    return { description: descriptions[name], example: examples[name], docsHref: docsHrefs[name] }
}

/** Description and docs link for a sidebar product, both read from the product's scene config. */
export function sidebarProductMeta(product: FileSystemImport): SidebarProductMeta {
    // Most tree items name their scene explicitly; the rest are generated with a single-scene list.
    const sceneKey = product.sceneKey ?? (product.sceneKeys?.length === 1 ? product.sceneKeys[0] : undefined)
    const sceneConfig = sceneKey ? sceneConfigurations[sceneKey] : undefined
    const isGroup =
        product.iconType === 'group' || product.iconType?.startsWith('group_') || product.type?.startsWith('group_')
    return {
        // Group paths come from configurable group type names, which can match a built-in app name.
        description: isGroup
            ? SIDEBAR_GROUP_META.description
            : (descriptions[product.path] ?? sceneConfig?.description),
        example: isGroup ? SIDEBAR_GROUP_META.example : examples[product.path],
        docsHref: sceneConfig?.docsHref ?? docsHrefs[product.path],
    }
}