twelvebitDocsllms.txtSign in
View as Markdown

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 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.

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.yaml and check them in CI.

All pages#

PageWhat it covers
InstallThe script tag for every common framework and site builder
Agent setupThe workflow for coding agents, with guardrails
Script referenceEvery data-* attribute, cookies and the JS API
GoalsCustom events from JS, HTML attributes and your server
IdentifyLink visitors to users
RevenueRevenue attribution per payment provider
Tracking planThe analytics.yaml format, codegen and drift checks
API referenceThe REST API at /api/v1
MCPAsk your agent about your analytics
CLItwelvebit init, push, check, codegen and more
Privacy and cookielessWhat is stored, cookieless mode, excluding yourself
ProxyServe the script from your own domain
Bot trackingCount AI crawlers and search bots on your server
TroubleshootingWhen 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.