nitur
v0.1.0
Published
Install privacy-first analytics on a project in one command. No cookies, no IP logging, no consent banner.
Maintainers
Readme
nitur
Install nitur on a project in one command. Privacy-first analytics: no cookies, no IP logging, no fingerprinting, and so no consent banner.
npx nitur initIt works out what the project is, creates the site, writes the script tag into the right file, and prints the token. Run it twice and it reuses the site and leaves the file alone.
Options
| Flag | |
| ---- | --- |
| --key <key> | API key. Falls back to $NITUR_KEY, then $TRACK_KEY. |
| --name <name> | Site name. Defaults to the package name, then the directory. |
| --dir <path> | Project directory. Defaults to the working directory. |
| --origin <url> | Where nitur is hosted. For self-hosting. |
| --print-only | Print the snippet; write nothing. |
| --json | Machine-readable result on stdout. |
| --yes | Never prompt. Fails instead of asking. |
Get a key at /dashboard/account.
Running it from an agent
--key and --yes together mean it never prompts, so it is safe in a
non-interactive shell. --json gives you the token and the file it wrote
without parsing prose, and every failure exits non-zero with one line on
stderr.
NITUR_KEY=trk_sk_… npx nitur init --yes --jsonWhat it writes
One line, in one file.
| Project | File | Where |
| ------- | ---- | ----- |
| Next.js | app/layout.tsx or src/app/layout.tsx | first thing inside <body> |
| Vite, CRA | index.html | last thing in <head> |
| Static | index.html | last thing in <head> |
A plain <script> tag, not next/script — the tracker finds its own
data-site-id through document.currentScript, which is null for a script
injected at runtime.
If it cannot see exactly where the tag belongs, it prints the snippet and tells you which file to put it in rather than editing something it does not understand.
Then
window.track("signup");
window.track("purchase", { plan: "pro", seats: 3 });Safe to call anywhere: it is a no-op until the script loads, on localhost, and for anyone with Do Not Track set.
Props are stored exactly as sent — keep personal data out of them.
MIT.
