Skip to content
Documentation

Drop the kit in. Swap the vendor later.

Connectors, the query model, chart variants, and how colors follow the host site. For every drawing and its props, see Components.

01

Install

Pick a connector for the analytics tool you already use. The React package is the dashboard and the charts.

$pnpm add @analytics-kit/react @analytics-kit/core @analytics-kit/next @analytics-kit/connector-vercel

Wingtics was called Analytics Kit until September 2026. The packages still publish under @analytics-kit/*; only the project name changed.

Also: @analytics-kit/connector-plausible, connector-ga4, connector-umami, connector-posthog, and connector-mock for tests. Import @analytics-kit/react/styles.css once.

02

AnalyticsProvider

One provider around the tree. Widgets and hooks read the connector, range, and theme from context. theme is light or dark — not a color palette.

provider.tsx
import { AnalyticsProvider, Dashboard } from "@analytics-kit/react";
import { createVercelConnector } from "@analytics-kit/connector-vercel";
import "@analytics-kit/react/styles.css";

const connector = createVercelConnector({
  token: process.env.VERCEL_TOKEN!,
  projectId: process.env.VERCEL_PROJECT_ID!,
});

export function Stats() {
  return (
    <AnalyticsProvider connector={connector} theme="light" range="7d">
      <Dashboard />
    </AnalyticsProvider>
  );
}
PropTypeDefaultNotes
connectorAnalyticsConnectorRequired. Any package connector, mock, or createHttpConnector.
rangeDateRangeInput"7d"Preset (24h, 7d, 30d, 90d, 12mo, …) or { from, to }.
theme"light" | "dark""dark"Sets data-ak-theme on the kit root. Host CSS still owns --chart-*.
cacheTtlMsnumber30000In-memory query cache on the connector. 0 disables it.

03

Connectors

Same query() shape. Swap the constructor when you leave a vendor.

VercelWeb Analytics API
createVercelConnector{ token, projectId, teamId? }@analytics-kit/connector-vercel
PlausibleStats API v2
createPlausibleConnector{ apiKey, siteId }@analytics-kit/connector-plausible
Google Analytics 4Data API
createGa4Connector{ accessToken, propertyId }@analytics-kit/connector-ga4
Umami
createUmamiConnector{ apiKey, websiteId, host? }@analytics-kit/connector-umami
PostHogHogQL
createPostHogConnector{ apiKey, projectId, host? }@analytics-kit/connector-posthog
Mock
createMockConnector{ profile?, seed? }

Deterministic data. profile: full | vercel | plausible | …

Your endpoint
createHttpConnector{ endpoint }

The browser talks to your route. Keys stay on the server.

04

Query model

Widgets never send vendor field names. They send a canonical AnalyticsQuery. The connector maps it.

query.ts
const result = await connector.query({
  range: "7d",
  metrics: ["visitors", "pageviews"],
  dimensions: ["path"],
  granularity: "day",
  limit: 8,
  includePrevious: true,
});
PropTypeDefaultNotes
rangeDateRangeInputRequired on the wire. Provider range is the default in useQuery.
metricsMetricId[]visitors, pageviews, visits, bounceRate, avgDuration, viewsPerVisit, events.
dimensionsDimensionId[]path, referrer, country, device, browser, os, source, medium, campaign, eventName, host.
granularity"hour" | "day" | "week" | "month"Time buckets for series. Omit for totals-only queries.
filtersAnalyticsFilter[]dimension + op (eq, neq, contains, in) + value.
limitnumberBreakdown row cap.
includePreviousbooleanPrevious-period totals for deltas on metric cards.

Result: totals, series, breakdown, optional previous.totals. Hooks: useQuery, useRealtime, useCapabilities. If a connector cannot answer a metric, the widget renders an unsupported state instead of crashing.

05

Charts

Tailwind + Recharts. Eighteen types, funnel through sunburst, and the drawing is a variant — gradient, dither, hatched, glow — not a palette. Colors come from CSS variables on the host page.

chart.tsx
import { AreaChart } from "@analytics-kit/react";

<AreaChart
  data={points}
  dataKey="value"
  labelKey="date"
  variant="gradient"
  config={{ value: { label: "Visitors", color: "var(--chart-1)" } }}
/>
PropTypeDefaultNotes
AreaChartgradient | linear | natural | step | dots | spark | dither | glow | hatched | bars | solidgradientFilled trend. hatched and bars are SVG textures; glow blooms the stroke.
LineChartmonotone | linear | step | dashed | dots | dither | glow | ping | rainbow | valuesmonotoneStroke only. ping pulses the last point; rainbow uses --chart-1…5.
BarChartvertical | horizontal | rounded | hatched | dither | glow | gradient | duotoneverticalBreakdown bars. duotone is a hard two-band fill.
PieChartdonut | pie | legend | dither | rounded | radial | glowdonutShare of a dimension. radial is a RadialBar.
FunnelCharttape | steps | verticaltapeConversion stages with drop-off.
RadarChartstroke | fill | glow | ditherfillMulti-axis comparison.
ComposedChartcombo | highlight | overlaycomboTwo series on one axis.
GaugeChartarc | ring | tickarcSingle-value dial.
ScatterChartdots | bubble | glowdotsCorrelation. bubble sizes by z.
SankeyChartflow | gradient | ditherflowFlow between stages. nodes + links.
CandlestickChartohlc | hollow | wickohlcOpen, high, low, close.
ChoroplethCharttiles | heat | dithertilesRegion tiles by intensity. Not a geoJSON map.
LiveLineChartstream | glow | dashedstreamSliding window over a series.
RingChartstack | nested | trackstackConcentric KPI rings.
HeatmapChartcalendar | matrix | dithercalendarA grid of intensity cells.
SunburstChartnest | burstnestHierarchy as two rings.
ProfitLossChartfill | stroke | barsfillSigned series above and below zero.
MetricCarddefault | spark | compact | herodefaultWired to a metric via useQuery.
RankedListbar | compact | tablebarBreakdown rows with optional tracks.

Shared chart props: data, dataKey, labelKey, variant, config, className. Full tables live on the components page.

06

Widgets & dashboard

Dashboard lays out registered widgets. defaultDashboard is the Vercel-friendly subset. catalogDashboard is every built-in widget — use it with a full-capability connector (mock profile full).

PropTypeDefaultNotes
widgetsDashboardItem[]defaultDashboard{ widget, span?, props? }. widget is a registry id such as "visitors".
columnsnumber4Grid columns. span on an item stretches across.
showRangebooleantruePreset range toolbar from the provider.

Built-in ids: visitors, pageviews, visits, events, bounce-rate, duration, views-per-visit, realtime, timeseries, top-pages, top-referrers, top-countries, devices, top-browsers, top-os, top-sources, top-campaigns, top-events, pages-table, tracker.

07

Colors follow the host

There is no kit “theme pack.” Set the same variables you would on a shadcn page. The kit reads them through --ak-chart-* fallbacks.

tokens.css
:root {
  --chart-1: #0070f3;
  --chart-2: #7d5bed;
  --chart-3: #f5a623;
  --chart-4: #12a594;
  --chart-5: #e5484d;
  --card: #fff;
  --foreground: #000;
  --primary: #0070f3;
  --border: #e6e6e6;
  --muted: #fafafa;
  --muted-foreground: #666;
}

Per-series override: pass config on Area, Line, and Bar. config.value.color can be any CSS color, including var(--chart-1).

08

Keys stay on the server

Do not put vendor tokens in the browser bundle. @analytics-kit/next proxies the connector. The client uses createHttpConnector.

route.ts
import { createVercelConnector } from "@analytics-kit/connector-vercel";
import { createRouteHandlers } from "@analytics-kit/next";

const connector = createVercelConnector({
  token: process.env.VERCEL_TOKEN!,
  projectId: process.env.VERCEL_PROJECT_ID!,
});

export const { GET, POST } = createRouteHandlers({ connector });

Browser: createHttpConnector({ endpoint: "/api/analytics" }). This site does that in app/api/analytics/route.ts. Also examples/next-app-route.ts.

09

shadcn registry

Copy a chart or the dashboard into your app. You own the file. Runtime still comes from npm so the query model stays canonical.

$pnpm dlx shadcn@latest add /r/dashboard.json

Items: every catalog chart plus metric-card and dashboard. Also educlopez/analytics-kit/dashboard from the GitHub registry.

10

Extend

defineConnector and defineWidget are the extension points. Register custom metrics and dimensions, or merge them into MetricCatalog / DimensionCatalog. See examples/custom-connector.ts and examples/custom-widget.tsx.

Next: every component, every variant, every prop.