traffic-tracker
v0.6.0
Published
Installable Analytics Package with Adapter Pattern
Readme
Traffic Tracker
An installable, framework-agnostic analytics package with a robust adapter pattern, inspired by better-auth. It gives you full control of your traffic data by storing it directly in your own database.
Features
- Adapter Pattern: Ships with a Drizzle ORM adapter (PostgreSQL, MySQL, SQLite).
- Framework Agnostic: Works in any environment (Node, Edge, Serverless). Built-in integrations for Hono and SvelteKit.
- Privacy First: Built-in consent mode (
fullvsanonymous). IP hashing and truncation. - Client Tracker: Bundled lightweight browser tracker with automatic batching, session management, and visible-time tracking.
- Analytics Querying: Built-in methods to generate aggregates for overview, pages, referrers, and tech breakdowns.
Documentation
Full documentation is available in the src/docs/ directory:
- Installation: Add dependencies to your project.
- Server Setup: Initialize schemas, setup the server instance, and expose the collect endpoint.
- Client Setup: Integrate the bundled browser tracker into SvelteKit or Vanilla JavaScript SPAs.
- Querying Data: Fetch and aggregate traffic statistics (pageviews, referrers, tech) from your database.
- MongoDB Adapter: Instructions specifically for users using the native MongoDB adapter.
Quick Start
npm install traffic-trackerCheck out the Installation guide to get started.
