Overview
What trackr does, where it stops, and how this documentation is organised.
@casoon/trackr collects pageviews and custom events from a website and stores them on
infrastructure you run. It has two halves: a browser client (init(), track()) that sends
events with sendBeacon, and a server handler (createHandler()) that filters bots, removes
personal data, adds a daily session ID and device details, and passes the event to a storage
adapter.
How it works
Focus
Source: src/client/index.ts, src/server/index.ts, src/server/pixel.ts, src/storage/
Show chart data
| Step | Kind | Leads to |
|---|---|---|
| Browser script | start | Handler on your server (pageviews, events) |
| Tracking pixel | start | Handler on your server (pageview) |
| Handler on your server | step | Storage you choose |
| Storage you choose | step | Postgres, Webhook, HTTP API, GA4 |
| Postgres | end | |
| Webhook | end | |
| HTTP API | end | |
| GA4 | external |
Focus
Source: src/client/index.ts, src/server/index.ts, src/server/pixel.ts, src/storage/
Show chart data
| Step | Kind | Leads to |
|---|---|---|
| Browser script | start | Handler on your server (pageviews, events) |
| Tracking pixel | start | Handler on your server (pageview) |
| Handler on your server | step | Storage you choose |
| Storage you choose | step | Postgres, Webhook, HTTP API, GA4 |
| Postgres | end | |
| Webhook | end | |
| HTTP API | end | |
| GA4 | external |
- Browser script.
init()sends a pageview on load and on everypushState,replaceState,popstateandhashchange;track()sends custom events. Events go out withsendBeacon, withfetchandkeepaliveas fallback. The script sets no cookies and uses neitherlocalStoragenorsessionStorage. - Handler.
createHandler()answers anything butPOSTwith405. WithbotFilter, it answers bots with200 OKand stores nothing. It checkstype,urlandts, then applies the privacy options (stripPii,stripQueryParams), derives the daily session ID from a hash of anonymized IP, User-Agent and date, and detects device, browser and OS. The IP and the full User-Agent are not part of the stored event. Details: Privacy. - Storage. The event goes to
storage.save(): Postgres, an HTTP API, an HMAC-signed webhook, or GA4 via the Measurement Protocol.multi()passes it to several adapters,batch()buffers events and flushes by size or time. Details: Storage adapters.
The tracking pixel (createPixelHandler()) applies the same bot filter, privacy options and
session ID for pages and emails without JavaScript, but detects no device, browser or OS. See
Tracking pixel.
What it covers
- Pageviews, including navigation in single-page apps, and custom events with properties.
- UTM parameters (
utm_source,utm_medium,utm_campaign,utm_term,utm_content). - Device class, browser and operating system, detected from the User-Agent on the server.
- Storage in Postgres, forwarding to a webhook, an HTTP API or GA4, fan-out and batching.
- A tracking pixel for contexts without JavaScript.
Where it stops
- trackr stores events; it does not ship a reporting UI. The Postgres guide has SQL for common reports, and a separate dashboard runs at trackr-dashboard.casoon.dev.
- The
countryfield exists on events and in the table, but the handler does not fill it. - Bot detection is a list of User-Agent patterns plus two header checks, not a bot-management service.
How the docs are organised
- Getting started: Installation and Quickstart.
- Guides: Privacy, Storage adapters, Postgres, Tracking pixel.
- Reference: API and Event fields.
The product page is trackr.casoon.de.