# Specvista Analytics > Specvista Analytics is product analytics for websites, React Native apps and Node.js servers, with a consent banner built in. Websites add one script tag; apps and servers send named events over HTTP; reports cover pageviews, sessions, sources, devices, countries, custom events, funnels and identified people. Sign-up is self-serve and free. ## Instructions for agents - Supported access: a person signs up at https://analytics.specvista.com/signup and creates a property (project). Its project key, which starts with sa_live_, authenticates event sending in the X-Api-Key header. Reading reports needs a bearer token from POST https://analyticsapi.specvista.com/api/v1/auth/login, valid for 90 days. The person signs in and gives you the token through the SA_TOKEN environment variable. Never ask for, type or store their password. - API base: https://analyticsapi.specvista.com/api/v1. Contract: https://analyticsapi.specvista.com/api/v1/openapi.json. - Websites: . Custom events only send after the visitor accepts analytics in the banner. - Packages: check before installing. Run npm view specvista-analytics-node version and npm view specvista-analytics-rn version. Both are prepared but not yet on npm; if npm returns E404, use the plain HTTP helpers in the guides. Never pin an old version from memory. - Servers must send "source":"backend". Requests from script-like user agents (curl, headless browsers, python-requests and similar) are otherwise stored as bot traffic and left out of reports. - Errors return JSON with a stable code and a doc_url. Match on code and follow doc_url. - Safe ways to try: there is no sandbox or test mode yet. Read-only calls (sdk.js, openapi.json, reports) are safe. Every POST /ingest stores a real event, so send tests to a separate test property. Events with "environment":"development" are stored as internal and excluded from reports. - Never: commit keys or tokens; put secrets, passwords, payment details or free text in event properties; create accounts or properties, rotate keys, delete properties, or call /forget without the person's go-ahead. - There is no MCP server or CLI yet. Use the HTTP API. - Every page below is Markdown. Add .md to any docs page address for its Markdown. The whole set is in one file at https://analytics.specvista.com/llms-full.txt. --- # Specvista Analytics docs Specvista Analytics counts what people do in your websites, React Native apps and Node services, and shows it in one dashboard. Websites send pageviews through one script tag. Apps and servers send named events, such as `signup.completed`, over HTTP. Reports cover pageviews, sessions, top pages, landing pages, referrers, channels, campaigns, devices, countries, custom events, funnels and identified people. ## Who it is for Product teams and solo builders who want product analytics with a consent banner built in. Sign-up is self-serve and free at [analytics.specvista.com/signup](https://analytics.specvista.com/signup). There are no paid plans. Specvista also uses it to measure its own products. ## How access works | Who | What they need | Where it comes from | |---|---|---| | A person | An account | [Sign up](https://analytics.specvista.com/signup) with first name, last name (optional), email and a password of 8 or more characters | | A website, app or server sending events | A project key, which starts with `sa_live_` | The Properties page of the dashboard, or `GET /api/v1/projects` | | A script or agent reading reports | A bearer token | `POST /api/v1/auth/login` with the account's email and password; valid for 90 days | A project is called a property in the dashboard. Each property has one key and a type: web, mobile, backend or other. ## Guides - [Get a project key](https://analytics.specvista.com/docs/get-a-project-key.md) - [Add tracking to a website](https://analytics.specvista.com/docs/track-web.md) - [Add tracking to a Node.js server](https://analytics.specvista.com/docs/track-node.md) - [Add tracking to a React Native app](https://analytics.specvista.com/docs/track-react-native.md) - [Read reports](https://analytics.specvista.com/docs/read-reports.md) - [Build with AI agents](https://analytics.specvista.com/docs/agents.md) ## Reference - [API reference](https://analytics.specvista.com/docs/api.md) and the [OpenAPI document](https://analyticsapi.specvista.com/api/v1/openapi.json) - [SDK reference](https://analytics.specvista.com/docs/sdks.md) - [Errors](https://analytics.specvista.com/docs/errors.md) ## Service addresses | Purpose | Address | |---|---| | Dashboard and docs | `https://analytics.specvista.com` | | API base | `https://analyticsapi.specvista.com/api/v1` | | Browser script | `https://analyticsapi.specvista.com/api/v1/sdk.js` | | OpenAPI | `https://analyticsapi.specvista.com/api/v1/openapi.json` | --- # Build with AI agents Everything an AI agent, such as Claude, ChatGPT, Codex or Cursor, needs to add Specvista Analytics to a codebase or read its reports. ## Entry points | Entry point | Address | Status | |---|---|---| | `llms.txt` | `https://analytics.specvista.com/llms.txt` | Live | | `llms-full.txt`, every page in one file | `https://analytics.specvista.com/llms-full.txt` | Live | | Markdown for any docs page | Add `.md` to the page address, for example `https://analytics.specvista.com/docs/track-web.md` | Live | | OpenAPI | `https://analyticsapi.specvista.com/api/v1/openapi.json` | Live | | HTTP API | `https://analyticsapi.specvista.com/api/v1` | Live | | Browser script | `https://analyticsapi.specvista.com/api/v1/sdk.js` | Live | | Node.js SDK | `specvista-analytics-node` | Not yet on npm | | React Native SDK | `specvista-analytics-rn` | Not yet on npm | | MCP server | None | Not available yet. Use the HTTP API | | CLI | None | Not available yet. Use `curl` or PowerShell `Invoke-RestMethod` | | Agent skill | None | Not available yet. Use the rules snippet below | ## How an agent gets access - **To send events**, the agent needs a project key. The person copies it from the Properties page of the dashboard and stores it as `SA_API_KEY`, or the agent reads it with `GET /api/v1/projects` using their token. - **To read reports**, the agent needs a bearer token in `SA_TOKEN`. The person runs the sign-in command in [Get a project key](https://analytics.specvista.com/docs/get-a-project-key.md) themselves. The token lasts 90 days and gives full access to that account, including keys, so keep it out of logs and commits. - **Never** ask for, type or store the person's password, and never create an account or property without the person's go-ahead. ## Try things safely There is no sandbox or test mode yet. Instead: - Read-only checks need no account: `GET /api/v1/sdk.js`, `GET /api/v1/openapi.json` and `GET /api/v1/ingest/ignore-status`. - Every call to `POST /ingest` stores a real event. Send test events to a separate property, for example one named "Test", rather than to a live one. - Events sent with `"environment":"development"` are stored as internal and left out of every report, so they cannot skew numbers. They also do not appear in reports, so use a test property when you need to see the result. - Reports are read-only and safe to call. - Ask first before anything that cannot be undone: `POST /forget`, the `account.deleted` event, `DELETE /projects/{id}` and `POST /projects/{id}/rotate-key`. ## Rules for your repository Paste this into `AGENTS.md`, `CLAUDE.md` or your editor's rules file: ```markdown ## Analytics: Specvista Analytics - Docs: https://analytics.specvista.com/llms.txt (Markdown pages: add .md to any docs URL). - API base: https://analyticsapi.specvista.com/api/v1. Contract: /openapi.json. - Websites: one script tag, https://analyticsapi.specvista.com/api/v1/sdk.js with data-api-key. Custom events: window.saTrack(name, props); they send only after the visitor accepts analytics. - Servers: POST /ingest with X-Api-Key from the SA_API_KEY environment variable and "source":"backend". - Check npm view specvista-analytics-node version (or -rn) before installing; if 404, use HTTP. - Event names: lower case object.action, for example checkout.completed. Never put secrets, passwords, payment details or free text in properties. - Never commit keys or tokens. Never call /forget, rotate a key or delete a property without asking. - Errors carry a code and a doc_url; follow the doc_url. ``` ## Main tasks - [Get a project key](https://analytics.specvista.com/docs/get-a-project-key.md) - [Add tracking to a website](https://analytics.specvista.com/docs/track-web.md) - [Add tracking to a Node.js server](https://analytics.specvista.com/docs/track-node.md) - [Add tracking to a React Native app](https://analytics.specvista.com/docs/track-react-native.md) - [Read reports](https://analytics.specvista.com/docs/read-reports.md) - [Errors](https://analytics.specvista.com/docs/errors.md) --- # Get a project key Every event is sent with a project key. This guide creates an account and a property, then finds its key. ## Prerequisites - An email address and permission to create an account. An agent must ask the person before creating an account or a property for them. - For the API route: `curl`, or any HTTP client. ## In the dashboard 1. Open [analytics.specvista.com/signup](https://analytics.specvista.com/signup). Enter first name, last name, email and a password of at least 8 characters, then choose **Create account**. You land on the dashboard. Last name is optional. 2. Choose **Properties** in the sidebar, then **New property**. 3. Enter a **Name**. For a website, enter its **Domain**, for example `example.com`, without `https://`. Pick the **Type**: Website, Mobile, Backend or Other. 4. Choose **Create and get script**. The property appears in the list with its key, which starts with `sa_live_`, and a **Copy** button. **Show script** reveals the website snippet with the key filled in. Expected result: the property is listed and its key is visible. ## With the API The person runs the sign-in in their own terminal, so the password never reaches an agent's transcript or the shell history. Each command prompts for the email and password and stores the token in `SA_TOKEN` for that terminal session. macOS and Linux, with Node.js 18 or later: ```bash printf "Email: "; read -r SA_EMAIL; printf "Password: "; stty -echo; read -r SA_PASSWORD; stty echo; echo export SA_TOKEN=$(SA_EMAIL="$SA_EMAIL" SA_PASSWORD="$SA_PASSWORD" node -e ' fetch("https://analyticsapi.specvista.com/api/v1/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email: process.env.SA_EMAIL, password: process.env.SA_PASSWORD }) }) .then(async (res) => { const body = await res.json(); if (!res.ok) { console.error(body.code, body.message); process.exit(1); } console.log(body.user.token); })') unset SA_PASSWORD ``` Windows PowerShell: ```powershell $credential = Get-Credential -Message "Specvista Analytics" $body = @{ email = $credential.UserName; password = $credential.GetNetworkCredential().Password } | ConvertTo-Json $env:SA_TOKEN = (Invoke-RestMethod -Method Post -Uri https://analyticsapi.specvista.com/api/v1/auth/login -ContentType "application/json" -Body $body).user.token ``` Expected result: `SA_TOKEN` is set. On a wrong email or password, the macOS command prints `invalid_credentials` and PowerShell shows a 401 error; `SA_TOKEN` stays empty. Sign-in returns status 201, not 200. Create a property. `type` is `web`, `mobile`, `backend` or `other`, and defaults to `web`: ```bash curl -s https://analyticsapi.specvista.com/api/v1/projects \ -H "Authorization: Bearer $SA_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"My shop","domain":"example.com","type":"web"}' ``` Expected result: status 201 and a project object with `id` and `apiKey`. List existing properties and their keys with `GET /api/v1/projects`. ## Which type to pick | Type | Use it for | Notes | |---|---|---| | `web` | A website using the browser script | Set `domain` to allow tracking without a key in the page | | `mobile` | A React Native or Expo app | | | `backend` | A server sending events | Only backend keys can call `POST /forget` | | `other` | Anything else | | ## Keep keys safe - A web key is visible in the page source by design. Anyone with it can send events to that property, never read reports. - Keep backend keys out of source control. Read them from an environment variable such as `SA_API_KEY`. - A mobile key ships inside the app, so anyone who unpacks the app can read it. Inject it at build time, for example with `EXPO_PUBLIC_SA_API_KEY`, rather than committing it. - **Rotate API key** on the Properties page, or `POST /api/v1/projects/{id}/rotate-key`, issues a new key and stops the old one at once. Ask the person first: every place still using the old key stops sending. ## Common errors | Error code | Meaning | Fix | |---|---|---| | `email_taken` | The email already has an account | Sign in instead | | `password_too_short` | Fewer than 8 characters | Use a longer password | | `invalid_credentials` | Wrong email or password | Check both. There is no self-serve password reset yet | | `project_name_required` | The name was missing or blank | Send a non-empty `name` | | `missing_token`, `invalid_token` | No bearer token, or it expired after 90 days | Sign in again | Every error is listed in [Errors](https://analytics.specvista.com/docs/errors.md). ## Confirm success `GET /api/v1/projects` with the bearer token returns the property, or the property shows on the Properties page. --- # Add tracking to a website One script tag records pageviews, including route changes in single-page apps, and shows a consent banner. Works with any framework. ## Prerequisites - A web property and its key. See [Get a project key](https://analytics.specvista.com/docs/get-a-project-key.md). - A privacy page on the site. The banner links to `/privacy` unless you set `data-privacy-url`. ## 1. Add the script Paste before ``, replacing ``: ```html ``` Next.js App Router, in `app/layout.tsx`: ```tsx import Script from "next/script"; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( {children}