t.lumenstat.com. The file is byte for byte the hosted release, with the same integrity hash, and it still sends events to Lumenstat’s collect endpoint. Only the origin of the script changes.
The first npm publish of
@lumenstat/tracker is pending (Milestone 1). Until it ships, npm install will not find the package. You can take the same file from packages/tracker/releases/1.0.0.js in the repository and check it as described in Verify the tracker.Hosted or self-hosted
Self-hosting is worth it when your policy allows scripts only from your own origin, or requires every script to come from your own build. Otherwise the hosted file does the same job with less to maintain.
1
Install the package
2
Check the file
The package ships the file as The first command prints the hash without the
dist/l.js and the release record as releases.json. The hash of the first must equal the integrity value in the second.sha384- prefix. npm audit signatures checks the registry signatures and provenance attestations of your installed packages.3
Copy it into your static files
Copy the file as part of your build, under a name that includes the version:Serve it as is. Do not import the package into your JavaScript bundle: a bundler rewrites the bytes, so they no longer match the hash, and the tracker reads its settings from its own
<script> tag. Because the name changes with every version, you can serve the file with a long, immutable cache.4
Point the tag at your copy
Take the website id from Setup and write the tag yourself:Keep
integrity: it still protects visitors if the file on your host or CDN is changed. A file served from the page’s own origin needs no crossorigin. If you serve it from another origin, such as a separate static-asset host, add crossorigin="anonymous" and make that host send Access-Control-Allow-Origin.Leave data-host-url out. The file already sends to https://t.lumenstat.com/e.5
Confirm data is arriving
Deploy, open a page of your site, then reload Setup and check Is data arriving?. The troubleshooting list in Add the tracker applies unchanged.
Where events go: data-host-url
The collect host and the endpoint path are built into each release file. Releases from the Lumenstat repository send tohttps://t.lumenstat.com/e. data-host-url replaces the host and keeps the path:
/e. On such an instance, Setup adds data-host-url to the snippet by itself whenever its public tracker host is not https://t.lumenstat.com.
Provenance
The package is published by the release workflow when a tagtracker-v<version> is pushed that matches the version in packages/tracker/package.json. Before anything is published, the workflow:
- Rebuilds the tracker from Umami v3.5.0 and the patches in
patches/umami, and stops unless the result matchespackages/tracker/releases/<version>.jsbyte for byte. - Creates a GitHub release with the file attached and its URL and hash in the notes.
- Runs
npm publish --provenance --access public.
npm audit signatures verifies it. Provenance tells you where the package came from. It does not tell you that the commit is safe, so review the changes before you upgrade.
Limits
- Your build carries the hash. The
integrityvalue lives in the HTML your build produces. It protects against a changed file on a static host or CDN, not against a compromised build that can change both the file and the hash. - Upgrades are yours to notice. Watch
releases.jsonor the repository’s releases. Tracker upgrade notices in the dashboard are planned. - The collect request does not change. Each event still goes from the visitor’s browser to
t.lumenstat.com. In the current pilot that hostname passes through Cloudflare, which sees visitor IP addresses in transit. Self-hosting the file changes who serves the script, not who receives the events.