Dashral Pro is on the wayGet 30% off at launch

Dashral

Analytics overviewPro

A whole analytics page: who's online, numbers that pick what the chart shows, the period before, and pages, sources and countries.

When to use

  • A whole analytics page: who's online, numbers that pick what the chart shows, the period before, and top lists.
  • Product and marketing analytics with a few headline metrics and a 7, 30 or 90 day range.

When not to use

  • Ops and infrastructure metrics across many small panels: Analytics panels.
  • One or two numbers on a home page: Stats cards.

Usage

Analytics overview with your own data: every prop has the sample as its default, so pass only what you have.

example.tsx
import { AnalyticsOverview } from "@/components/dashral/blocks/analytics-overview"

<AnalyticsOverview
  sites={sites}
  site={siteId}
  onSiteChange={setSiteId}
  online={visitorsNow}
  metrics={metrics}
  periods={periods}
  onExport={(period) => api.analytics.export(siteId, period)}
/>

API reference

AnalyticsOverview

A whole analytics page: the site, who's online, a period switch and export; four numbers that each pick what the chart shows, with their change; an area chart against the period before, read by hover or the arrow keys; then top pages, sources and countries. Every part follows the period. Your sites, metrics and each period's figures come from props; with period and onPeriodChange you load a period's figures as it's picked.

PropTypeDefault
sitesstring[]sample
sitestring

The site shown (the page keeps it without it).

—
onSiteChange(site: string) => void—
onlinenumber | null

People on the site right now; null hides it.

38
metricsAnalyticsMetric[]sample
periodsAnalyticsPeriod[]sample
periodstring—
onPeriodChange(period: string) => void—
onExport(period: string) => void—

type AnalyticsMetric

A number on top: how it reads, and how a period's values add up to it ("sum", or "average" for rates).

PropTypeDefault
idstring—
labelstring—
format(value: number) => string—
aggregate"sum" | "average"—
invertboolean—

type BreakdownItem

PropTypeDefault
labelstring—
valuenumber—

type AnalyticsPeriod

A period on the switch: the chart's labels, what it compares with, each metric's values now and before (by id), and the breakdowns.

PropTypeDefault
valuestring—
labelstring—
comparestring—
labelsstring[]—
seriesRecord<string, { now: number[]; before: number[] }>—
pagesBreakdownItem[]—
sourcesBreakdownItem[]—
countriesBreakdownItem[]—