v2.0.0
Brief: Ground-up TypeScript rewrite with multi-format builds, smarter URL filtering, hardened transports, and stronger runtime validation.
New methods
setTransport(Transport)— switch betweenfetch,beacon, andimgat runtime (auto-fallback toimgiffetchis 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/*, andRegExp). Internals now useSetfor performance and dedupe. - Transport hardening: default
fetchwithcredentials: 'include',mode: 'no-cors',cache: 'no-store';beaconwhen available; legacyimgpixel fallback. - Global error capture: adds
unhandledrejectionreporting 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.OstrioTrackerClassfor<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