AbsoluteJS

Analytics

@absolutejs/analyticsv0.1.1betaCommerce & Growth

Typed, tenant-fenced, privacy-thresholded product and operational analytics primitives for AbsoluteJS.

#Installation

BASH
bun add @absolutejs/analytics

#Capabilities

Overview

Typed product and operational analytics primitives for AbsoluteJS.

Privacy-first contracts

The package deliberately does not provide an unbounded client event collector. Callers declare every dimension and measure, identity-shaped dimensions are rejected, cardinality is bounded, and cohorts smaller than a configured privacy threshold are suppressed. The result is deterministic aggregate evidence that can feed dashboards, Outcomes, SLOs, incidents, and release gates without turning application telemetry into a shadow user database.

Tenant and cohort safety

Tenant identity belongs at the storage/query authorization boundary and is not an analytics dimension. Prompts, tokens, email addresses, IP addresses, and user identifiers do not belong in this package's event contract.

Privacy thresholds apply independently to every measure as well as to its group. Dimension values that are direct email or IP identifiers are rejected; route-like values should use normalizeRouteTemplate or a stricter domain-specific normalizer before grouping. Hosts remain responsible for tenant authorization, bounded query variation, retention, and erasure.

compareCohorts requires both sample sizes to meet its configured minimum before it can label a directional change as a regression.

Outcomes

What you can build

Overview

Typed product and operational analytics primitives for AbsoluteJS.

Privacy-first contracts

The package deliberately does not provide an unbounded client event collector. Callers declare every dimension and measure, identity-shaped dimensions are rejected, cardinality is bounded, and cohorts smaller than a configured privacy threshold are suppressed. The result is deterministic aggregate evidence that can feed dashboards, Outcomes, SLOs, incidents, and release gates without turning application telemetry into a shadow user database.

Tenant and cohort safety

Tenant identity belongs at the storage/query authorization boundary and is not an analytics dimension. Prompts, tokens, email addresses, IP addresses, and user identifiers do not belong in this package's event contract.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/analytics version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/analytics example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Aggregate analytics

Partial snippet

Working example for Aggregate analytics.

TS
import {
  aggregateAnalytics,
  defineAnalyticsSchema,
} from "@absolutejs/analytics";

const schema = defineAnalyticsSchema({
  name: "route-performance",
  dimensions: ["route", "release"],
  dimensionNormalizers: { route: normalizeRouteTemplate },
  measures: ["durationMs"],
  minimumCohortSize: 10,
});

const snapshot = aggregateAnalytics(schema, observations, {
  groupBy: ["route", "release"],
  quantiles: [0.5, 0.75, 0.95, 0.99],
});

#Public entry points

Supported entry points declared by this project’s package manifest. Internal dist paths are not part of the package contract.

@absolutejs/analyticsPublic package entry point declared in package.json.

#Package commands

Scripts declared by this project’s package manifest.

bun run buildrm -rf dist && bun build src/index.ts --outdir dist --root src --sourcemap --target=bun && tsc --project tsconfig.build.json
bun run check:packagebun run format && bun run typecheck && bun run test && bun run build
bun run formatprettier --write "./**/*.{ts,json,md}"
bun run testbun test
bun run typechecktsc --noEmit