Components
Analytics Page
A traffic analytics page with charts, goals and top pages.
Installation
$ npx veil-ui@latest add analytics-pageUsage
import { AnalyticsPage } from "@/components/ui/analytics-page";
<AnalyticsPage />;Examples
Basic
Analytics
Audience growth and engagement for the last 30 days.
Visitors
48,210
+12.5%vs last month
Sessions
86,940
+9.8%vs last month
Bounce rate
32.4%
-4.2%vs last month
Avg. session
4m 12s
+2.6%vs last month
Sessions and conversions
Weekly totals across all channels
Traffic sources
Where visitors come from
Goal completion
Monthly acquisition targets
New signups7,800 / 10,000
Activated accounts3,200 / 5,000
Upgraded plans210 / 500
Newsletter9,100 / 10,000
Top pages
Most visited content
| Page | Views | Change |
|---|---|---|
| /pricing | 12,480 | +8.2% |
| /docs/getting-started | 9,320 | +3.4% |
| /blog/design-tokens | 7,860 | +14.1% |
| /components | 6,140 | -1.2% |
| /changelog | 4,980 | +2.7% |
Engagement by day
Sessions and conversions compared
API reference
The package exports analytics-page along with its composable parts. It forwards standard attributes to its root element; see the examples above for the component-specific props.
Accessibility
- Page templates use semantic landmarks and a single page-level heading.
- Navigation links and actions have discernible names and visible focus styles.
- Decorative imagery uses empty alt text; content images carry descriptions.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add analytics-page --framework vue or switch the framework in components.json.
<template>
<div data-slot="analytics-page" class="space-y-6 rounded-xl border bg-background p-5 sm:p-6 min-h-[600px]"><div class="flex flex-wrap items-end justify-between gap-3"><div><h1 class="text-xl font-semibold tracking-tight">Analytics</h1><p class="text-sm text-muted-foreground">Audience growth and engagement for the last 30 days.</p></div><div class="flex flex-wrap items-center gap-2"><button type="button" role="combobox" aria-expanded="false" aria-autocomplete="none" dir="ltr" data-state="closed" data-slot="select-trigger" class="flex items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow,border-color] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 h-8 w-32" aria-label="Date range"><span style="pointer-events:none"></span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down size-4 opacity-50" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg></button><select aria-hidden="true" tabindex="-1" style="position:absolute;border:0;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;word-wrap:normal"></select><button data-slot="button" data-variant="outline" data-size="sm" class="inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap font-medium outline-none transition-[color,background-color,border-color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-8 rounded-md px-3 text-xs"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-funnel lucide-filter" aria-hidden="true"><path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"></path></svg> Filter</button><button data-slot="button" data-variant="default" data-size="sm" class="inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap font-medium outline-none transition-[color,background-color,border-color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 bg-primary text-primary-foreground hover:bg-primary/90 h-8 rounded-md px-3 text-xs"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download" aria-hidden="true"><path d="M12 15V3"></path><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><path d="m7 10 5 5 5-5"></path></svg> Export</button></div></div><div class="grid gap-4 sm:grid-cols-2 xl:grid-cols-4"><div data-slot="statistic-card" class="flex flex-col rounded-lg border bg-card py-5 text-card-foreground shadow-xs gap-2 max-w-none"><div data-slot="card-content" class="px-5 space-y-1"><div class="flex items-center justify-between gap-2 text-sm text-muted-foreground"><span>Visitors</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trending-up size-4" aria-hidden="true"><path d="M16 7h6v6"></path><path d="m22 7-8.5 8.5-5-5L2 17"></path></svg></div><p class="text-2xl font-semibold tracking-tight">48,210</p><p class="flex items-center gap-1 text-xs"><span class="flex items-center gap-0.5 font-medium text-emerald-600 dark:text-emerald-400"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right size-3.5" aria-hidden="true"><path d="M7 7h10v10"></path><path d="M7 17 17 7"></path></svg>+12.5%</span><span class="text-muted-foreground">vs last month</span></p></div></div><div data-slot="statistic-card" class="flex flex-col rounded-lg border bg-card py-5 text-card-foreground shadow-xs gap-2 max-w-none"><div data-slot="card-content" class="px-5 space-y-1"><div class="flex items-center justify-between gap-2 text-sm text-muted-foreground"><span>Sessions</span></div><p class="text-2xl font-semibold tracking-tight">86,940</p><p class="flex items-center gap-1 text-xs"><span class="flex items-center gap-0.5 font-medium text-emerald-600 dark:text-emerald-400"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right size-3.5" aria-hidden="true"><path d="M7 7h10v10"></path><path d="M7 17 17 7"></path></svg>+9.8%</span><span class="text-muted-foreground">vs last month</span></p></div></div><div data-slot="statistic-card" class="flex flex-col rounded-lg border bg-card py-5 text-card-foreground shadow-xs gap-2 max-w-none"><div data-slot="card-content" class="px-5 space-y-1"><div class="flex items-center justify-between gap-2 text-sm text-muted-foreground"><span>Bounce rate</span></div><p class="text-2xl font-semibold tracking-tight">32.4%</p><p class="flex items-center gap-1 text-xs"><span class="flex items-center gap-0.5 font-medium text-red-600 dark:text-red-400"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-right size-3.5" aria-hidden="true"><path d="m7 7 10 10"></path><path d="M17 7v10H7"></path></svg>-4.2%</span><span class="text-muted-foreground">vs last month</span></p></div></div><div data-slot="statistic-card" class="flex flex-col rounded-lg border bg-card py-5 text-card-foreground shadow-xs gap-2 max-w-none"><div data-slot="card-content" class="px-5 space-y-1"><div class="flex items-center justify-between gap-2 text-sm text-muted-foreground"><span>Avg. session</span></div><p class="text-2xl font-semibold tracking-tight">4m 12s</p><p class="flex items-center gap-1 text-xs"><span class="flex items-center gap-0.5 font-medium text-emerald-600 dark:text-emerald-400"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-right size-3.5" aria-hidden="true"><path d="M7 7h10v10"></path><path d="M7 17 17 7"></path></svg>+2.6%</span><span class="text-muted-foreground">vs last month</span></p></div></div></div><div class="grid gap-4 lg:grid-cols-[1.6fr_1fr]"><div data-slot="card" class="flex flex-col gap-4 rounded-lg border bg-card py-5 text-card-foreground shadow-xs"><div data-slot="card-header" class="grid auto-rows-min items-start gap-1 px-5 has-[[data-slot=card-action]]:grid-cols-[1fr_auto]"><div data-slot="card-title" class="text-base font-medium leading-none">Sessions and conversions</div><div data-slot="card-description" class="text-sm text-muted-foreground">Weekly totals across all channels</div></div><div data-slot="card-content" class="px-5"><div data-slot="chart" class="w-full" style="height:280px"><div class="recharts-responsive-container" style="width:100%;height:100%;min-width:0"><div style="width:0;height:0;overflow:visible"><div width="600" height="280" class="recharts-wrapper" style="position:relative;cursor:default;width:600px;height:280px"></div></div></div></div></div></div><div data-slot="card" class="flex flex-col gap-4 rounded-lg border bg-card py-5 text-card-foreground shadow-xs"><div data-slot="card-header" class="grid auto-rows-min items-start gap-1 px-5 has-[[data-slot=card-action]]:grid-cols-[1fr_auto]"><div data-slot="card-title" class="text-base font-medium leading-none">Traffic sources</div><div data-slot="card-description" class="text-sm text-muted-foreground">Where visitors come from</div></div><div data-slot="card-content" class="px-5"><div data-slot="chart" class="w-full" style="height:280px"><div class="recharts-responsive-container" style="width:100%;height:100%;min-width:0"><div style="width:0;height:0;overflow:visible"><div width="600" height="280" class="recharts-wrapper" style="position:relative;cursor:default;width:600px;height:280px"></div></div></div></div></div></div></div><div class="grid gap-4 lg:grid-cols-[1fr_1.4fr]"><div data-slot="card" class="flex flex-col gap-4 rounded-lg border bg-card py-5 text-card-foreground shadow-xs"><div data-slot="card-header" class="grid auto-rows-min items-start gap-1 px-5 has-[[data-slot=card-action]]:grid-cols-[1fr_auto]"><div data-slot="card-title" class="text-base font-medium leading-none">Goal completion</div><div data-slot="card-description" class="text-sm text-muted-foreground">Monthly acquisition targets</div></div><div data-slot="card-content" class="px-5 space-y-4"><div class="space-y-1.5"><div class="flex justify-between text-sm"><span>New signups</span><span class="text-muted-foreground">7,800 / 10,000</span></div><div aria-valuemax="100" aria-valuemin="0" aria-valuenow="78" aria-valuetext="78%" role="progressbar" data-state="loading" data-value="78" data-max="100" data-slot="progress" class="relative h-1.5 w-full overflow-hidden rounded-full bg-primary/15" aria-label="New signups"><div data-state="loading" data-value="78" data-max="100" data-slot="progress-indicator" class="h-full w-full flex-1 rounded-full bg-primary transition-transform duration-300 motion-reduce:transition-none" style="transform:translateX(-22%)"></div></div></div><div class="space-y-1.5"><div class="flex justify-between text-sm"><span>Activated accounts</span><span class="text-muted-foreground">3,200 / 5,000</span></div><div aria-valuemax="100" aria-valuemin="0" aria-valuenow="64" aria-valuetext="64%" role="progressbar" data-state="loading" data-value="64" data-max="100" data-slot="progress" class="relative h-1.5 w-full overflow-hidden rounded-full bg-primary/15" aria-label="Activated accounts"><div data-state="loading" data-value="64" data-max="100" data-slot="progress-indicator" class="h-full w-full flex-1 rounded-full bg-primary transition-transform duration-300 motion-reduce:transition-none" style="transform:translateX(-36%)"></div></div></div><div class="space-y-1.5"><div class="flex justify-between text-sm"><span>Upgraded plans</span><span class="text-muted-foreground">210 / 500</span></div><div aria-valuemax="100" aria-valuemin="0" aria-valuenow="42" aria-valuetext="42%" role="progressbar" data-state="loading" data-value="42" data-max="100" data-slot="progress" class="relative h-1.5 w-full overflow-hidden rounded-full bg-primary/15" aria-label="Upgraded plans"><div data-state="loading" data-value="42" data-max="100" data-slot="progress-indicator" class="h-full w-full flex-1 rounded-full bg-primary transition-transform duration-300 motion-reduce:transition-none" style="transform:translateX(-58%)"></div></div></div><div class="space-y-1.5"><div class="flex justify-between text-sm"><span>Newsletter</span><span class="text-muted-foreground">9,100 / 10,000</span></div><div aria-valuemax="100" aria-valuemin="0" aria-valuenow="91" aria-valuetext="91%" role="progressbar" data-state="loading" data-value="91" data-max="100" data-slot="progress" class="relative h-1.5 w-full overflow-hidden rounded-full bg-primary/15" aria-label="Newsletter"><div data-state="loading" data-value="91" data-max="100" data-slot="progress-indicator" class="h-full w-full flex-1 rounded-full bg-primary transition-transform duration-300 motion-reduce:transition-none" style="transform:translateX(-9%)"></div></div></div></div></div><div data-slot="card" class="flex flex-col gap-4 rounded-lg border bg-card py-5 text-card-foreground shadow-xs"><div data-slot="card-header" class="grid auto-rows-min items-start gap-1 px-5 has-[[data-slot=card-action]]:grid-cols-[1fr_auto]"><div data-slot="card-title" class="text-base font-medium leading-none">Top pages</div><div data-slot="card-description" class="text-sm text-muted-foreground">Most visited content</div></div><div data-slot="card-content" class="px-5"><div data-slot="table-container" class="relative w-full overflow-x-auto"><table data-slot="table" class="w-full caption-bottom text-sm"><thead data-slot="table-header" class="[&_tr]:border-b"><tr data-slot="table-row" class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"><th data-slot="table-head" scope="col" class="h-10 whitespace-nowrap px-3 text-left align-middle font-medium text-muted-foreground">Page</th><th data-slot="table-head" scope="col" class="h-10 whitespace-nowrap px-3 align-middle font-medium text-muted-foreground text-right">Views</th><th data-slot="table-head" scope="col" class="h-10 whitespace-nowrap px-3 align-middle font-medium text-muted-foreground text-right">Change</th></tr></thead><tbody data-slot="table-body" class="[&_tr:last-child]:border-0"><tr data-slot="table-row" class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle font-mono text-xs">/pricing</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right">12,480</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right"><span data-slot="badge" data-variant="default" class="inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [&>svg]:pointer-events-none [&>svg]:size-3 border-transparent bg-primary text-primary-foreground">+8.2%</span></td></tr><tr data-slot="table-row" class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle font-mono text-xs">/docs/getting-started</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right">9,320</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right"><span data-slot="badge" data-variant="default" class="inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [&>svg]:pointer-events-none [&>svg]:size-3 border-transparent bg-primary text-primary-foreground">+3.4%</span></td></tr><tr data-slot="table-row" class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle font-mono text-xs">/blog/design-tokens</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right">7,860</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right"><span data-slot="badge" data-variant="default" class="inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [&>svg]:pointer-events-none [&>svg]:size-3 border-transparent bg-primary text-primary-foreground">+14.1%</span></td></tr><tr data-slot="table-row" class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle font-mono text-xs">/components</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right">6,140</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right"><span data-slot="badge" data-variant="muted" class="inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [&>svg]:pointer-events-none [&>svg]:size-3 border-transparent bg-muted text-muted-foreground">-1.2%</span></td></tr><tr data-slot="table-row" class="border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle font-mono text-xs">/changelog</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right">4,980</td><td data-slot="table-cell" class="whitespace-nowrap p-3 align-middle text-right"><span data-slot="badge" data-variant="default" class="inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [&>svg]:pointer-events-none [&>svg]:size-3 border-transparent bg-primary text-primary-foreground">+2.7%</span></td></tr></tbody></table></div></div></div></div><div data-slot="card" class="flex flex-col gap-4 rounded-lg border bg-card py-5 text-card-foreground shadow-xs"><div data-slot="card-header" class="grid auto-rows-min items-start gap-1 px-5 has-[[data-slot=card-action]]:grid-cols-[1fr_auto]"><div data-slot="card-title" class="text-base font-medium leading-none">Engagement by day</div><div data-slot="card-description" class="text-sm text-muted-foreground">Sessions and conversions compared</div></div><div data-slot="card-content" class="px-5"><div data-slot="chart" class="w-full" style="height:220px"><div class="recharts-responsive-container" style="width:100%;height:100%;min-width:0"><div style="width:0;height:0;overflow:visible"><div width="600" height="220" class="recharts-wrapper" style="position:relative;cursor:default;width:600px;height:220px"></div></div></div></div></div></div></div>
</template>