Headless · CLI
Analytics Provider
Headless analytics + experiment helper. Loads Plausible/GA when env is set; no visible UI.
Preview
npx shadcn@latest add @atroui/analytics-providerHeadless
AnalyticsProvider - scripts + experiments, no chrome
Mount once near the root. Loads Plausible / GA when env is set, fires page_view, and exposes sticky A/B variants via useExperiment.
- NEXT_PUBLIC_PLAUSIBLE_DOMAINnot set
- NEXT_PUBLIC_GA_IDnot set
In development, events log to the browser console as [analytics].
Installation
Agent blurb — install command + no npm UI rule. For agents
npx shadcn@latest add @atroui/analytics-providerSource lands in your repo. Installation · Registry
Usage
Mount once in the root layout. Set NEXT_PUBLIC_PLAUSIBLE_DOMAIN and/or NEXT_PUBLIC_GA_ID. Marked Headless in the catalog - pair with ThemeProvider, not a visual section.
tsx
import {
AnalyticsProvider,
trackEvent,
} from "@/components/blocks/analytics-provider"
<AnalyticsProvider>{children}</AnalyticsProvider>API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | - | App tree to wrap. |
Analytics Provider