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.

1.0 KB
Raw Blame
import { useActions, useValues } from 'kea'

import { LemonSwitch, Tooltip } from '@posthog/lemon-ui'

import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'

import { webAnalyticsLogic } from './webAnalyticsLogic'

export const IncludeHostToggle = (): JSX.Element | null => {
    const { featureFlags } = useValues(featureFlagLogic)
    const { includeHostPath } = useValues(webAnalyticsLogic)
    const { setIncludeHostPath } = useActions(webAnalyticsLogic)

    if (!featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_INCLUDE_HOST]) {
        return null
    }

    return (
        <Tooltip title="Show the full host + path (e.g. example.com/about) instead of just the path">
            <div className="flex items-center gap-1">
                <LemonSwitch
                    checked={includeHostPath}
                    onChange={setIncludeHostPath}
                    className="text-xs"
                    label="Include host"
                />
            </div>
        </Tooltip>
    )
}