# Quickstart

twelvebit is web analytics with revenue attribution. A small script counts visits. Your payment provider sends payments. twelvebit joins the two, so you see which sources bring money, not only traffic.

You can set it up in three ways. Pick one.

## 1. Let your coding agent do it

Copy the setup prompt from the home page or from your site in the dashboard, and paste it into Claude Code, Codex or Cursor. The prompt holds no key. The agent runs the CLI below, you approve the sign-in in the browser, and the CLI saves a site key in `.env`. Then the agent adds the script, tracks the actions that matter, writes `analytics.yaml`, connects the MCP server and checks that events arrive.

Or start from the terminal in your project folder:

~~~sh
npx -y https://twelvebit.app/cli/twelvebit-cli.tgz init example.com
~~~

The CLI signs you in through the browser, finds or creates the site, saves a site key in `.env` (only when `.env` is in `.gitignore`), writes a starter `analytics.yaml`, adds a twelvebit section to `AGENTS.md` and prints the script tag for your framework. Then tell your agent: "Instrument this app with twelvebit (see AGENTS.md)".

## 2. Add the script yourself

Put this tag in the `<head>` of every page:

~~~html
<script defer data-website-id="tb_YOUR_SITE_ID" data-domain="example.com" src="https://twelvebit.app/js/script.js"></script>
~~~

- `data-website-id` is the public id of your site. It is safe to publish.
- `data-domain` is your root domain. Subdomains share one visitor id.

See [Install](/docs/install) for Next.js, React, Vue, Svelte, Astro, Remix, Gatsby, WordPress, Shopify, Webflow, Framer and Google Tag Manager.

## 3. Check that it works

Open your site in a normal browser window (not on `localhost`, unless you set `data-allow-localhost="true"`). The dashboard shows the visit within a few seconds. From a terminal:

~~~sh
curl -sS https://twelvebit.app/api/v1/install-check -H "Authorization: Bearer $TWELVEBIT_API_KEY"
~~~

The response lists the first event time, the last events, counts per type for the last 24 hours, the hosts seen, which planned events have arrived, and next steps when something looks wrong. If nothing arrives, read [Troubleshooting](/docs/troubleshooting).

## Next steps

- [Goals](/docs/goals): count signups, checkouts and other actions.
- [Revenue](/docs/revenue): connect Stripe, Polar, Lemon Squeezy, Paddle or Dodo Payments, and pass the visitor id to the checkout.
- [Identify](/docs/identify): link a visitor to a user in your app.
- [Tracking plan](/docs/tracking-plan): keep your events in `analytics.yaml` and check them in CI.

## All pages

| Page | What it covers |
|---|---|
| [Install](/docs/install) | The script tag for every common framework and site builder |
| [Agent setup](/docs/agents) | The workflow for coding agents, with guardrails |
| [Script reference](/docs/script) | Every `data-*` attribute, cookies and the JS API |
| [Goals](/docs/goals) | Custom events from JS, HTML attributes and your server |
| [Identify](/docs/identify) | Link visitors to users |
| [Revenue](/docs/revenue) | Revenue attribution per payment provider |
| [Tracking plan](/docs/tracking-plan) | The `analytics.yaml` format, codegen and drift checks |
| [API reference](/docs/api) | The REST API at `/api/v1` |
| [MCP](/docs/mcp) | Ask your agent about your analytics |
| [CLI](/docs/cli) | `twelvebit init`, `push`, `check`, `codegen` and more |
| [Privacy and cookieless](/docs/privacy) | What is stored, cookieless mode, excluding yourself |
| [Proxy](/docs/proxy) | Serve the script from your own domain |
| [Bot tracking](/docs/bots) | Count AI crawlers and search bots on your server |
| [Troubleshooting](/docs/troubleshooting) | When events do not arrive |

Agents can read every page as Markdown: add `.md` to the URL (for example [/docs/revenue.md](/docs/revenue.md)), or read the full guide at [/setup.md](/setup.md) and the index at [/llms.txt](/llms.txt).

---

Source: https://twelvebit.app/docs · All docs: https://twelvebit.app/llms.txt
