: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(web-analytics): Add tooltips to live metric cards (#80171)
Jordan Mryyan0eb516dbfa71
diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveStatCard.tsx b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveStatCard.tsxindex d928175c1801..2a51c2d4531d 100644--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveStatCard.tsx+++ b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveStatCard.tsx@@ -1,7 +1,8 @@import clsx from 'clsx'import { useEffect, useRef, useState } from 'react'-import { LemonSkeleton } from '@posthog/lemon-ui'+import { IconInfo } from '@posthog/icons'+import { LemonSkeleton, Tooltip } from '@posthog/lemon-ui'const AnimatedNumber = ({ value, duration = 300 }: { value: number; duration?: number }): JSX.Element => {const [displayValue, setDisplayValue] = useState(value)@@ -68,12 +69,20 @@ export interface LiveStatCardProps {label: stringvalue: number | nullisLoading?: boolean+ tooltip?: string}-export const LiveStatCard = ({ label, value, isLoading }: LiveStatCardProps): JSX.Element => {+export const LiveStatCard = ({ label, value, isLoading, tooltip }: LiveStatCardProps): JSX.Element => {return (<div className="flex flex-col">- <span className="text-muted text-xs uppercase font-medium">{label}</span>+ <div className="flex items-center gap-1 text-muted">+ <span className="text-xs uppercase font-medium">{label}</span>+ {tooltip && (+ <Tooltip title={tooltip}>+ <IconInfo className="text-sm" />+ </Tooltip>+ )}+ </div>{isLoading ? (<LemonSkeleton className="w-16 h-8 mt-1" />) : (diff --git a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsxindex 51d41a889f79..e3de9969c5ba 100644--- a/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx+++ b/frontend/src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx@@ -370,12 +370,27 @@ export const LiveWebAnalyticsMetrics = (): JSX.Element => {label="Users online"value={displayedLiveUserCount}isLoading={hasActiveFilters ? isLoading : undefined}+ tooltip="People active on your site right now."/>)case 'unique_visitors':- return <LiveStatCard label="Unique visitors" value={totalUniqueVisitors} isLoading={isLoading} />+ return (+ <LiveStatCard+ label="Unique visitors"+ value={totalUniqueVisitors}+ isLoading={isLoading}+ tooltip="Distinct visitors in the last 30 minutes."+ />+ )case 'pageviews':- return <LiveStatCard label="Pageviews" value={totalPageviews} isLoading={isLoading} />+ return (+ <LiveStatCard+ label="Pageviews"+ value={totalPageviews}+ isLoading={isLoading}+ tooltip="Total pages viewed in the last 30 minutes."+ />+ )}}