@elqnt/analytics
v0.1.1
Published
Product analytics for Eloquent platform - models, API, and the useProductAnalytics hook
Readme
@elqnt/analytics
Product analytics for the Eloquent platform — per-org and global/platform-admin
query helpers plus frontend event tracking. Fully typed, zero any.
Building a custom app / using an AI coding agent? Read
SKILL.md— the full agent guide: the one-way architecture (custom app →useProductAnalytics→ API Gateway → analytics backend), the gateway-token flow, and the exact per-method spec of the hook (getSummary,getChats,getAgents,getUsage,getDaily,getEvents,trackEvent,trackPageView,getGlobalSummary,getGlobalOrgs). It ships in the package, so the contract is this package's own.d.ts— your code type-checks against it.
Installation
pnpm add @elqnt/analyticsQuick Start
import { useProductAnalytics } from "@elqnt/analytics/hooks";
import type { AnalyticsSummary, DateFilter } from "@elqnt/analytics/models";
const { loading, error, summary, getSummary, trackEvent } = useProductAnalytics({
baseUrl: apiGatewayUrl,
orgId,
userId,
userEmail,
});
// Fetch analytics
await getSummary({ from: "2024-01-01", to: "2024-12-31" });
// Track events (fire-and-forget)
trackEvent("button_click", "ui", { buttonId: "submit" });Entry Points
| Import | Description |
|--------|-------------|
| @elqnt/analytics | Models + API functions |
| @elqnt/analytics/api | Browser API functions |
| @elqnt/analytics/models | TypeScript types |
| @elqnt/analytics/hooks | The useProductAnalytics hook (+ useAnalyticsContext alias) |
License
Private - Eloquent Platform
