← All packages

@lacspace/analytics-lite

v1.1.0Core0 deps

Privacy-first, cookieless web analytics — page views and custom events sent to your own endpoint. No cookies, no localStorage IDs, no cross-site tracking, no consent banner. Respects Do-Not-Track, auto-tracks SPA navigation, uses sendBeacon. Now with a batching LiteClient, a sendBeacon-first transport, UTM parsing, DNT/consent helpers and a CSPRNG id. Zero-dependency, isomorphic.

npm i @lacspace/analytics-lite

Usage

analytics-lite.ts
import { createAnalytics } from "@lacspace/analytics-lite";

const analytics = createAnalytics({
  endpoint: "/api/collect",  // your own collector
  siteId: "acme",
});

analytics.pageview();                       // manual page view
analytics.track("signup", { plan: "pro" }); // custom event
const stop = analytics.autoTrack();         // auto page views on route change (SPA)

Exports 1

createAnalytics

Keywords

analyticsweb-analyticsprivacycookielessgdprno-cookiesutmsendbeacondo-not-track

More in Core

@lacspace/analytics

Event tracking for Lacspace platforms — a spec-style track/identify/page/group/alias client with batching, an offline retry queue, consent + Do-Not-Track gating, and pluggable middleware. Every transport, clock and timer is injectable, so it never touches the network by default.

@lacspace/api

Lightweight, zero-dependency, isomorphic TypeScript HTTP client for Lacspace APIs — retries with backoff, interceptors, timeouts/abort, page- & cursor-pagination, plus dependency-free query-string, URL/path, header-merge, form-body and typed-error helpers.

@lacspace/auth

Authentication flows (login, register, token, refresh) for Lacspace APIs — now with PKCE/OIDC helpers, JWT expiry math, scope/role checks and proactive token refresh.

@lacspace/next

Next.js App Router integration for the Lacspace SDK — authenticated server client from cookies, Route Handler/Server Action wrappers, CSRF + middleware auth guard, plus edge-safe pure helpers for cookies, Cache-Control, route matching, open-redirect-safe redirects and bearer tokens.

@lacspace/react

React hooks and provider for the Lacspace SDK — useAuth, useQuery, useMutation, useAuthStatus and useLacspace, all sharing one authenticated client, over a pure DOM-free core (async state machine, retry/backoff, polling) you can unit-test anywhere.

@lacspace/sdk

High-level TypeScript SDK for Lacspace — api, auth, analytics and e-commerce sharing one connection and token. Now with named environment presets, a config merger, correlation/idempotency ids, health probes, typed error normalization and transport-agnostic pagination.