Tracker cost
Trail publishes what its tracker costs. The table below is filled in when this site is built: sizes are gzipped (level 9) from the files the server embeds, and timings come from the last benchmark run in tracker/bench/last.json.
| File | What it does | Gzipped |
|---|---|---|
t.p.js | Private only | 1,501 B |
t.js | All three modes; private until consent by default | 2,043 B |
t.x.js | Extras: web vitals, rage clicks, form submits and errors, loaded only when asked for | 744 B |
Timings are not included in this build. Run npm run bench in tracker/ (see below) to measure script time, heap, listeners and requests on your machine; the result is written to tracker/bench/last.json and shows up here on the next build.
Rules the build enforces
- Every tracker file is at most 2,048 bytes gzipped.
tracker/build.mjsfails the build if one is over, and a test in CI checks it again. Todayt.p.jsis 1,490 bytes,t.jsis 2,040 andt.x.jsis 740. - The limit holds under two measurements:
gzip -9, and raw deflate plus 18 bytes of header. Zlib builds differ by a few bytes, so the file has to fit under both. - Script time at load is checked before and after every tracker change.
How the server delivers it
The server compresses each tracker file once at startup, at the best gzip level, and sends that copy to any browser that accepts gzip. Every response carries an ETag, and a repeat request with If-None-Match gets a 304 with no body. Files are cacheable for an hour (Cache-Control: public, max-age=3600). The sizes in the table are what travels over the wire.
How the benchmark works
tracker/bench/bench.mjs starts a local server that serves a 9,000 px tall test page and the built tracker files, and answers /_t/e with 204. For each variant (no tracker, t.js, t.p.js when built, t.js with data-mode="full", and t.js with vitals and rage clicks) it opens a fresh Chromium context and measures:
- Script time: CDP
ScriptDurationafter load, minus the same page without a tracker. - Heap: JS heap used after a forced garbage collection, minus the page without a tracker.
- Listeners and timers added, by wrapping
addEventListener,setTimeoutandsetInterval. - Requests per pageview: load, wait 15 simulated seconds, then navigate away, and count the
POST /_t/erequests.
Each variant runs several times, interleaved so machine noise hits all of them equally, and the table reports the median with the range.
Run it yourself
cd tracker
npm ci
npx playwright install chromium
npm run bench # builds, then benchmarks; RUNS=15 for a steadier medianIt prints a table and writes bench/last.json, which this page reads on the next build.
Next
- Pick a smaller file: privacy modes.
- Turn on extras only when you need them.