Skip to content

v2.0.0

Choose a tag to compare

@dr-dimitru dr-dimitru released this 01 Dec 20:37
77e27da

Brief: Ground-up TypeScript rewrite with multi-format builds, smarter URL filtering, hardened transports, and stronger runtime validation.

New methods

  • setTransport(Transport) — switch between fetch, beacon, and img at runtime (auto-fallback to img if fetch is unavailable).
  • applySettings({...}) — update runtime flags (trackHash, trackQuery, transport, serviceUrl) without reinstantiating.
  • ignoreQuery(key) / ignoreQueries(keys[]) — case-insensitive removal of noisy query/search params from navigation detection and payloads.
  • destroy() — unbind all listeners and clear internal timers (SPA teardown/HMR friendly).

Major changes

  • TypeScript port with strict types and generated declarations.
  • Smarter URL controls: trackHash, trackQuery, ignoredQueries, ignoredPaths (supports exact, prefix /*, and RegExp). Internals now use Set for performance and dedupe.
  • Transport hardening: default fetch with credentials: 'include', mode: 'no-cors', cache: 'no-store'; beacon when available; legacy img pixel fallback.
  • Global error capture: adds unhandledrejection reporting and de-dupes identical [Global Error] payloads.
  • Validation: constructing with an invalid 17-char tracking ID now throws an error.
  • Service URL normalization: trailing slash enforced.
  • Distribution artifacts: ESM (dist/index.js), CJS (dist/index.cjs), UMD (dist/ostrio-analytics.umd.js), UMD minified (dist/ostrio-analytics.min.js), and types (dist/index.d.ts).
  • Package exports map aligned for modern bundlers; UMD/minified builds only attach the global window.OstrioTrackerClass for <script> usage (modules do not pollute globals).

Breaking changes

  • Invalid tracking ID throws at construction.
  • Global attach limited to script builds: ESM/CJS no longer define globals.

Full Changelog: 1.3.0...2.0.0