The satsu-analytics CLI
The CLI ships inside the satsu-analytics package. Run it with npx, pnpm dlx, yarn dlx or bunx; there is nothing to install globally.
npx satsu-analytics initinit
Detects your framework, signs you in, creates the site and wires Satsu into the project.
- Reads
package.jsonand finds your framework (Next.js, React with Vite, Vue, Nuxt, Astro, SvelteKit, Remix or React Router). For anything else it offers to create the site, prints the script tag for your<head>and links the matching docs page. - Signs you in through your browser with a code shown in the terminal. Sign in or create an account in the browser.
- Asks for the workspace (when you have several) and the production domain. The domain can stay empty and be set later; the dashboard suggests it once traffic arrives.
- Shows the file changes and asks before writing them: the site ID goes into your env file and the component into your layout. It never overwrites an existing value without asking, and offers to replace a hand-written Satsu script tag.
- Offers to install the package with your package manager, then waits for the local dev ping to confirm the setup.
- Asks whether to connect your coding agent. On yes it writes the MCP config for Claude Code, Cursor, VS Code or Windsurf, and prints the config for any other editor; the server uses the personal key from your sign-in.
Set the printed variable in your hosting provider's environment too; the env file stays on your machine.
If a file can't be changed safely, init prints the manual steps from your framework guide instead.
login
npx satsu-analytics loginSigns you in through the browser and stores a personal key in a file in your user config directory (~/.config/satsu-analytics/credentials.json, under $XDG_CONFIG_HOME when set, or %APPDATA% on Windows) with owner-only permissions. The key acts as you: same workspaces, same role. Nothing secret is written into your project.
logout
npx satsu-analytics logoutRemoves the stored credentials from this machine. The key itself stays valid until you revoke it.
types
npx satsu-analytics types --site YOUR_IDWrites satsu-events.d.ts with the names of your custom-event goals, so track() autocompletes and rejects typos. --site is optional inside a project where init saved the site ID. Props are typed as Record<string, string | number | boolean>. Run it again after you add a goal. Requires login.
mcp
Runs the MCP server over stdio. You normally don't call it yourself; your editor does.
Environment
| Variable | Effect |
|---|---|
SATSU_API_URL | Overrides the API base URL (default https://api.satsu.pro). |
Sessions are derived from a daily-rotating fingerprint that cannot be linked across days; raw IP addresses and user agents are never written to the analytics database and pass through our message queue only until they are processed, at most 24 hours; no cookies, no persistent visitor IDs. The sign-in sends your computer's hostname as the key's label; later calls send the site and goal data you ask for.