Release 1.4.0
23 Sep 2026 · pinned package [email protected]
openvibe-shared/analytics is now the ADR-021 module (roadmap register item 26 and C-80). It replaces three hand-copied versions in Live server/analytics/, Tools apps/_shared/analytics/ and Network server/analytics/. The old analytics.js was removed. It stored raw IPs, user ids, cities and full user agents, and deleted raw rows only after 90 days. No deployed service still used it.
- Same API, ADR-021 behaviour.
new AnalyticsTracker(db, service[, opts]),middleware(),trackEvent(),flush(),aggregate(),getStats(),getOverview(),getBotAnalysis()anddestroy()all keep their shapes. A raw row has a route template, a referer origin, a user-agent class, a rotating session id, a country and a signed-in flag.ip,user_idandcityare always NULL. Unique visitors come from day-salted hashes, which are deleted once the day's rollup is final. The rate check keeps its counters in memory only. - Sec-GPC and DNT are honoured on the server. A request with
Sec-GPC: 1orDNT: 1is not recorded at all: no raw row, visitor hash, session id or rate counter. It is therefore also missing from the rollups, because ADR-021 provides for no separate opted-out count.trackEvent(name, { headers })does the same.privacy.optedOut(headers)is exported. analytics/event.v1is the documented raw event shape:docs/schemas/analytics-event.v1.json, exported asopenvibe-shared/analytics/event.v1.json.openvibe-shared/analytics/eventprovidestoEvent(row),validateEvent(ev)andcheckRow(row).checkRowrejects a row that has ip/user_id/city set. The validator reads the schema file itself.trackEventnow stores NULL for a value outside the schema, and throws aTypeErrorfor an event name outside it.- Retention. The tracker schedules the 30-day raw-event prune by default. Pass
retention: falseif the service runsretention.pruneRawEventsitself. The newretention.schedulePrune(db, opts)returns{ run, stop }. Days above 30 are refused. - Service specifics are options (formerly Network's
network.js).paramPrefixesadds parameter words to the defaults.pathRulesis a list of[RegExp, replacement]rewrites applied before templating. Both are accepted by the tracker and byretention.scrubEvents/scrubRollups/inspect, so legacy rows are templated like new ones. openvibe-shared/analytics/prune-cliis the prune and one-time scrub command. Each service wraps it in its own script and passesDatabase,defaultDbor atargetshook, extra flags and path options. It runs a dry run by default.--applyneeds--backupor--no-backup. It backs up one database to a file or several to a directory. Backups are owner-only (0600) because a pre-scrub backup holds the old IPs. It checks that rollup totals are unchanged and can VACUUM.- An over-long route template now loses whole segments and ends in
/*. Before, it was cut at 200 characters, possibly mid-segment. - The root export (
require('openvibe-shared')) andopenvibe-shared/analyticskeep the names that 1.x exported:classifyRequest,parseUserAgent,ANALYTICS_SCHEMAandBOT_USER_AGENTSnow use the ADR-021 code.SUSPICIOUS_PATTERNSis a frozen, deprecated object that nothing reads, and it will be removed in 2.0.0. - Package shape: docs/adr/0001-one-package-subpath-exports.md (proposed) keeps one package with explicit subpath exports.
exportsgains theanalytics/*subpaths, andtest/package.test.jsnow refuses wildcard subpaths and any module file without an entry. - Dev only:
better-sqlite3is a devDependency for the analytics tests. The package itself has no native dependency.
Rules10 A change is New, Improved or Fixed, and says so with a small mark.