Analytics
Provider-agnostic analytics dashboard, configure shell, trend chart, and breakdown lists.
Analytics
Domain: analytics
Package path: packages/ui/src/analytics
Import: @ziteox/ui/analytics
Provider-agnostic workspace UI for linked analytics: dashboard, configure flow, HTML trend chart, and breakdown lists. Host apps supply normalized AnalyticsReport data and optional slots (favicons, linking UI).
Peer dependencies: react-icons, lucide-react (plus existing @ziteox/ui peers).
Theme: expects shadcn-style CSS variables (--foreground, --card, --border, …). Map Forge tokens or add aliases in global CSS.
Linked dashboard
Range selector switches sample datasets client-side (24h / 7d / 30d). Header actions: Configure is icon-only (settings, aria-label from labels), external provider link unchanged. Trend header uses a clock control (@ziteox/ui/tooltip, click) instead of inline timezone text. Bar width follows range via trendBarLayout (7d widest, 24h medium, 30d thinnest).
Forge Docs
forge.ziteox.test · Platform
Views
84
+20% vs prior
Visitors
28
+33% vs prior
Bounce rate
42%
−6 pts vs prior
Avg. duration
2m 4s
+26% vs prior
Pages / visit
2.4
+14% vs prior
Traffic trend
Pages & sources
- /120
- /docs/library86
- /playbook52
Location
- United States160
- Germany72
- India48
Technology
- Chrome180
- Safari72
- Firefox40
Empty, loading, and error
Quiet site
quiet.example
Views
0
0% vs prior
Visitors
0
0% vs prior
Bounce rate
0%
0% vs prior
Avg. duration
0
0% vs prior
Pages / visit
0
0% vs prior
Pages & sources
No pages in this range.
Location
No countries in this range.
Technology
No browsers in this range.
Linked site
Linked site
Configure + site picker
Site picker supports search and “Linked to …” markers (optional href).
Analytics configuration
Times shown in America/New_York.
Linked site
Forge Docs
forge.ziteox.test · Platform
forge-demo-1Open in Example AnalyticsChange linked site
Trend chart
One component: AnalyticsTrendChart. Same shell everywhere; switch with variant (design-system style — not separate chart components).
| Variant | Mode |
|---|---|
views (default) | Page views from report points |
views-visitors | Views + nested visitors |
metric | Pre-built bars (buildFlatTrendBarChart) — usage meters |
import { AnalyticsTrendChart, buildFlatTrendBarChart } from "@ziteox/ui/analytics";
<AnalyticsTrendChart
range={report.range}
bucket={report.trend.bucket}
points={report.trend.points}
variant="views-visitors"
seriesLabels={{ views: "Pageviews", visitors: "Visitors" }}
/>
<AnalyticsTrendChart
variant="metric"
chart={buildFlatTrendBarChart(bars)}
tone="neutral"
emptyLabel="No usage in this range."
/>AnalyticsLinkedDashboard → views-visitors. Client portal → views. Admin usage → metric.
Breakdown blocks
Metric cards, top pages with buildSitePageUrl, countries (flags + Intl.DisplayNames), browsers/OS/devices icons, sources with custom favicon slot.
Views
84
Visitors
28
Top pages
Countries
- United States16050%
- Germany7222%
- India4815%
Browsers
- Chrome18056%
- Safari7222%
- Firefox4012%
Operating systems
- macOS14044%
- Windows11034%
- iOS4213%
Devices
- Desktop20062%
- Mobile9630%
- Tablet268.0%
Sources
- Direct14044%
google.com8828%
news.ycombinator.com3411%
Usage
import {
AnalyticsLinkedDashboard,
buildSitePageUrl,
type AnalyticsReport,
} from "@ziteox/ui/analytics";
export function SiteAnalytics({ report }: { report: AnalyticsReport }) {
return (
<AnalyticsLinkedDashboard
report={report}
loadState={{ status: "ready" }}
rangeId="7d"
rangeOptions={[
{ id: "24h", label: "24h", bucket: "hour" },
{ id: "7d", label: "7 days", bucket: "day" },
]}
onRangeChange={() => {}}
onConfigure={() => {}}
onRetry={() => {}}
buildPageHref={(row) => buildSitePageUrl(report.site.domain, row.meta?.path ?? row.label)}
/>
);
}Adapters map provider payloads to AnalyticsReport (src/analytics/types.ts). No provider names in the package source.