Traffic Analytics
Web analytics console: a pulsing live-visitors strip, an hourly-sessions area chart, a daily-goal radial gauge, a channel-audience radar chart, a new-vs-returning dual line chart, and a top-pages table whose columns sort on click. Every chart is hand-drawn inline SVG, no charting library involved.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/traffic-analytics.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/dashboard/dashboard7.tsx instead.
Usage
The file also exports dashboard7Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Dashboard7, dashboard7Demo } from "@/components/blocks/dashboard/dashboard7"; export default function Page() { return <Dashboard7 {...dashboard7Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| navItems | NavItem[] | none | Sidebar links; icons are assigned by position, not by prop. |
| siteName | string | "devtoolbox.io" | Site label shown in the topbar. |
| liveVisitors | number | none | Count shown next to the pulsing 'online now' dot. |
| hourlySessions | number[] | none | Session counts per hour, rendered as the area chart; any length works, the chart scales to the array's own min/max. |
| dailyGoal | { current: number; target: number } | none | Drives the daily-goal radial gauge, capped at 100%. |
| channelAudience | ChannelAudiencePoint[] | none | Five axis points for the radar chart, in Direct/Search/Social/Referral/Email order; axis labels are fixed in the component, not read from this data. |
| newVsReturning | { new: number[]; returning: number[] } | none | Two equal-length series drawn as solid (new) and dashed (returning) lines on one chart. |
| topPages | PageRow[] | none | Rows for the sortable top-pages table. |
| className | string | none | Extra classes for the outer section element. |
Types
type NavItem = { label: string; href: string; active?: boolean }; type ChannelAudiencePoint = { label: string; value: number }; type PageRow = { path: string; views: number; avgTimeSeconds: number; bounceRate: number; // 0-100 };
Behavior notes
- The 'visitors online now' pulse is a pure CSS animation (animate-ping) on a fixed liveVisitors number; it does not poll or update the count itself.
- The top-pages table sort is real client state: clicking a column header sorts by that column, clicking the same header again reverses direction, and the header icon reflects the active column and direction.
- channelAudience's five entries are matched to fixed Direct/Search/Social/Referral/Email axis labels by array position; passing a differently-ordered or differently-sized array will mislabel or clip the radar chart.
- avgTimeSeconds is the single source of truth for both sorting and the displayed mm:ss string, formatted client-side, so the two can never drift out of sync.
- Every chart (area, radial gauge, radar, dual line) is a local, non-exported SVG helper scaled from the array's own min/max at render time; none of it depends on a charting library or on window size.
- The whole block is a client component because the table sort needs real state; the pulsing dot and all four charts would otherwise have been servable as a plain server component.
More Dashboard Blocks
View all →admin-shell
Admin Shell
Full admin dashboard frame with a collapsible icon sidebar, command-palette trigger, KPI row, and recent-orders table.
customers-table
Customers Table
Sortable, searchable customers table with row selection, pagination, and a per-row action menu.
commerce-analytics
Commerce Analytics
E-commerce analytics dashboard with a four-up KPI row, net-profit area chart, repeat-rate gauge, weekday bar chart, and a best-sellers table.
project-workspace
Project Workspace
Project-management dashboard with a highlighted stats row, weekly hours chart, meeting reminder, team list, progress gauge, and a focus tracker.
booking-workspace
Booking Workspace
Split hotel booking dashboard with tabbed overview, active booking cards, room timelines, and a month calendar with a day agenda.
talent-sourcing
Talent Sourcing
Recruiting project dashboard with a five-up stat strip, stage-filtered candidate pipeline, live search, and per-card wishlist/invite toggles.