Analytics SDKs
@hanzo/analytics, @hanzo/insights, @hanzo/capture, and @hanzo/flags — which JavaScript package to use, and the one-import setup for every Hanzo app.
Analytics SDKs
Four packages, one rule of thumb: apps use @hanzo/analytics (the
one-import umbrella); the rest are the underlying engines you can use directly
when you need only one of them.
| Package | What it is | Use it when |
|---|---|---|
@hanzo/analytics | One import that initializes everything: behavioral analytics + feature flags (Insights) and privacy-first page views, with per-org keys built in. | Any Hanzo/Lux/Zoo/Pars app. Default choice. |
@hanzo/insights | The full behavioral SDK for insights.hanzo.ai: capture, identify, autocapture, session replay, flags. | You need the full analytics API surface directly. |
@hanzo/capture | Tiny batched product-analytics client for Cloud (/v1/analytics + /v1/tracker) with UTM/referrer attribution and a shared event vocabulary. | Lightweight product events into Hanzo Cloud (the console uses this). |
@hanzo/flags | Zero-dep client for the native flags engine (/v1/flags). | Flags/experiments only — no analytics payload. |
One-import setup
npm install @hanzo/analyticsimport { init } from "@hanzo/analytics"
init({ app: "hanzo-blog", org: "hanzo" }) // org resolves the Insights keyReact:
import { useAnalytics } from "@hanzo/analytics/react"
const analytics = useAnalytics()
analytics.capture("cta_clicked", { placement: "hero" })Server (Node):
import { serverAnalytics } from "@hanzo/analytics/server"Options: autocapture, sessionRecording, capturePageview,
capturePageleave, persistence, debug, plus insightsKey/insightsHost/
analyticsHost overrides.
Feature flags in every language
The flag engine has a client per language — exact usage for each lives in hanzoai/flags and the Feature Flags docs:
- TypeScript —
@hanzo/flags(npm) - Go —
github.com/hanzoai/flags/go - Python —
hanzo-flags(PyPI) - Rust —
hanzo-flags-client(HTTP) or the embeddedhanzo-flagsevaluator crate - C/C++ — the evaluator's C ABI (
hanzo_flags_evaluate)
Where events go
- Behavioral events (
capture, autocapture, replay) → insights.hanzo.ai → Hanzo Datastore. - Product events (
@hanzo/capture) → Hanzo Cloud/v1/analytics+/v1/tracker, surfaced in the admin cockpit. - Flags are evaluated, not stored — reads hit the in-process engine.
How is this guide?
Last updated on
Feature Flags
Native feature flags, percentage rollouts, and A/B experiments — a stateless Rust evaluator embedded in Hanzo Cloud with per-project SQLite definitions and Insights-compatible semantics.
Referrals & Affiliates
Refer developers to Hanzo Cloud and earn -- both sides get credits, and affiliates earn ongoing commission on referred spend.