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:
npx -y https://twelvebit.app/cli/twelvebit-cli.tgz init example.comThe 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:
<script defer data-website-id="tb_YOUR_SITE_ID" data-domain="example.com" src="https://twelvebit.app/js/script.js"></script>data-website-idis the public id of your site. It is safe to publish.data-domainis your root domain. Subdomains share one visitor id.
See 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:
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.
Next steps#
- Goals: count signups, checkouts and other actions.
- Revenue: connect Stripe, Polar, Lemon Squeezy, Paddle or Dodo Payments, and pass the visitor id to the checkout.
- Identify: link a visitor to a user in your app.
- Tracking plan: keep your events in
analytics.yamland check them in CI.
All pages#
| Page | What it covers |
|---|---|
| Install | The script tag for every common framework and site builder |
| Agent setup | The workflow for coding agents, with guardrails |
| Script reference | Every data-* attribute, cookies and the JS API |
| Goals | Custom events from JS, HTML attributes and your server |
| Identify | Link visitors to users |
| Revenue | Revenue attribution per payment provider |
| Tracking plan | The analytics.yaml format, codegen and drift checks |
| API reference | The REST API at /api/v1 |
| MCP | Ask your agent about your analytics |
| CLI | twelvebit init, push, check, codegen and more |
| Privacy and cookieless | What is stored, cookieless mode, excluding yourself |
| Proxy | Serve the script from your own domain |
| Bot tracking | Count AI crawlers and search bots on your server |
| Troubleshooting | When events do not arrive |
Agents can read every page as Markdown: add .md to the URL (for example /docs/revenue.md), or read the full guide at /setup.md and the index at /llms.txt.