Docsllms.txtSign inGo to your sites

Updated

View as Markdown

Privacy and cookieless mode

twelvebit collects what you need to see traffic and revenue, and nothing more. This page says exactly what is collected and stored, so you can write an accurate privacy policy.

What the script sends

For each page view, goal or outbound click: the page URL, the referrer (first page view only), the viewport width, the event name and props, and the visitor and session ids from the cookies. The browser also sends its user agent and IP address with the request, as every request does.

What twelvebit stores

DataStoredNotes
Page path, hostname, referrer domain and URL, UTM and ref parametersyesQuery strings other than UTM and ref/via/source are not stored.
Country, region, city, approximate coordinatesyesFrom the network edge in front of twelvebit, based on the IP address.
Cloud provider of the networkonly for visits from a data centreThe provider's name (for example "AWS") when the IP address is in a cloud or hosting provider's published ranges. See cloud networks.
Browser, operating system, device type, screen widthyesParsed from the user agent. The full user agent is not stored.
IP addressnoUsed during the request for IP exclusions, the cloud-network check and the daily hash. Then discarded.
Visitor id and session idyesRandom values from the cookies, or the daily hash in cookieless mode.
Daily hash of the visitfor 3 daysThe daily hash (see cookieless mode) of the browser that started a visit with cookies. A Shopify order without the cart ids finds its visit by it. Deleted after 3 days.
Goals and their propsyesWhatever you send. Do not send personal data in props.
Identity (user id, email, name, image, traits)only when you call identifySee Identify.
Paymentsyes, from your payment providerAmount, currency, plan, customer id, email when the provider sends it.

Cookies

NameLifetimePurpose
_tb_vid1 yearRecognise a returning browser, and link a payment to its visits
_tb_sid30 minutes, renewed with each eventGroup page views into one visit

Both are first-party cookies on your domain (on .example.com when you set data-domain). twelvebit sets no third-party cookies and does not track people across sites.

Cookieless mode

Turn it on in the site settings and add data-cookieless="true" to the script tag:

HTML
<script defer data-website-id="tb_YOUR_SITE_ID" data-domain="example.com" data-cookieless="true" src="https://twelvebit.app/js/script.js"></script>
  • The script sets no cookies and uses no storage.
  • The server makes the visitor id from a hash of the IP address, the user agent, the site and a secret salt that changes every day (UTC). The IP address is not stored.
  • A visit continues while the same visitor sends events at least every 30 minutes.
  • When the site setting is on, the server uses the hash even if a browser sends cookie ids.

What you lose:

  • The same person is a new visitor every day, so returning visitors and multi-day journeys are not counted.
  • Identify links only that day's visitor.
  • Revenue attribution has no cookies to read at checkout. It works when the visitor identified with the same email before paying, and the provider sends that email with the payment. Expect fewer attributed payments.
  • People on the same network with the same browser version on the same day can count as one visitor.

Use this when your site has its own consent banner and twelvebit should set cookies only after a yes. Every visit still counts: without a yes, twelvebit counts in cookieless mode.

  1. Add data-consent="required" to the script tag:
HTML
<script defer data-website-id="tb_YOUR_SITE_ID" data-domain="example.com" data-consent="required" src="https://twelvebit.app/js/script.js"></script>
  1. Tell twelvebit the visitor's choice from your banner, on every page load (once the choice is known) and each time it changes:
JavaScript
twelvebit("consent", true);  // analytics cookies allowed
twelvebit("consent", false); // not allowed, or allowed before and now withdrawn

What happens:

ChoiceCookiesWhat counts
No answer yetnoneEvery page view, in cookieless mode. The first page view waits up to 2.5 seconds for an answer.
true_tb_vid, _tb_sidEverything, with returning visitors. The visit so far joins the new visitor id, so it stays one visit.
falsenone, and existing ones are deletedEvery page view, in cookieless mode.
  • Call twelvebit("consent", …) as early as you can. With the queue stub on the page, a call made before the script loads waits in the queue and the first page view needs no wait.
  • twelvebit("consent", { analytics: true }) works too, if your banner gives you an object.
  • Without data-consent, the script sets cookies at once, and twelvebit("consent", false) still removes them.
  • On Shopify, the script follows the store's own consent banner by itself. You need nothing of this.

Exclude yourself

In the browser that you want to exclude, open the developer console on your site and run:

JavaScript
localStorage.setItem("twelvebit_ignore", "true");

To count this browser again: localStorage.removeItem("twelvebit_ignore").

For whole offices or test servers, use the site's exclusions in the dashboard: IP addresses, paths (/admin/*, ** for any depth), hostnames and countries. Excluded requests are dropped before anything is stored.

Exclusions

Settings → Exclusions:

  • IP addresses: an address (203.0.113.7, 2001:db8::1) or a range (203.0.113.0/24, 2001:db8:1::/48). The page shows your current address with Exclude my IP. On IPv6, your device can change its address inside its network, so the page also offers Exclude this /64.
  • Paths and hostnames: see above.
  • Countries: new visits from the country are not recorded. Turn on Also hide past data to leave the country out of every report too: totals, charts, breakdowns, people, live, insights, emails, widgets and the API. Nothing is deleted, so removing the country brings its history back. Imported Plausible history loses the country where the import has countries: the totals and the country card. Imported page, source and device rows have no country split, so they keep it. Payments still count in revenue totals, because the money came in.

Exclusions with an agent or the API

Ask your coding agent

Paste this into Claude Code, Codex or Cursor in your project folder. It holds no key: the agent gets one with the CLI, and you approve the sign-in in the browser. To do it yourself, follow the steps after it.

Prompt for your coding agent · holds no key
Set up the twelvebit exclusions for <production domain>, so that our own traffic, test hosts and private pages are not counted. 1. If the twelvebit MCP tools are not available, add the server first. It signs in through the browser, so no key is needed. Claude Code: claude mcp add --transport http twelvebit https://twelvebit.app/api/mcp (or, when twelvebit init already saved TWELVEBIT_API_KEY in .env, npx -y twelvebit@latest mcp claude --run, which uses that key and needs no approval). Codex: codex mcp add twelvebit --url https://twelvebit.app/api/mcp && codex mcp login twelvebit. Cursor: add { "mcpServers": { "twelvebit": { "url": "https://twelvebit.app/api/mcp" } } } to .cursor/mcp.json. Other agents: a streamable HTTP MCP server at https://twelvebit.app/api/mcp. Wait for me to approve it in the browser. Never ask me to paste a key into this chat. The tool update_exclusions needs the "Change setup" permission (write:config) in the sign-in. 2. Call list_sites and read the current lists of <production domain>: excluded_ips, excluded_paths, excluded_hostnames, excluded_countries and hidden_countries. 3. Look in this project for hosts that load the twelvebit script but are not production: staging and preview domains in the deploy config (vercel.json, netlify.toml, CI files, .env.example, README). Look for routes that people outside the team never see, like /admin/** or /health. Never exclude checkout, success or thank-you pages: revenue attribution needs them. 4. Ask me for the IP addresses or ranges of our office, VPN and test servers. Do not guess them. 5. Show me the list of entries and wait for my OK. Then call update_exclusions with site "<production domain>", add: { hostnames, paths, ips } and a fresh idempotency_key (a UUID). Add countries only when I ask for them. hidden_countries also hides past data, so it needs my OK and confirm: true. 6. Check it: tell me the change_note of the answer, then call list_sites again and show me the lists. Without MCP, POST https://twelvebit.app/api/v1/sites/<production domain>/exclusions with {"add": {...}} and an Idempotency-Key header does the same. Key: the server code needs a twelvebit site key in TWELVEBIT_API_KEY with the write:config scope. If .env has no TWELVEBIT_API_KEY, run npx -y twelvebit@latest init <production domain> in the project root. It opens the browser so that I can approve the sign-in, then it saves the key in .env (the default key includes write:config). If the API answers 403 insufficient_scope, stop and ask me to create a key with write:config in Settings → API & MCP and put it in .env myself. Never print the key, never put it in browser code or git, and never ask me to paste it into this chat. Reference: https://twelvebit.app/docs/privacy.md (Exclusions). Fill in <production domain> and <site id> from this project: the site id is data-website-id in the twelvebit script tag, or TWELVEBIT_SITE_ID in .env. Ask me if you cannot find them.

Add and remove single entries with POST /api/v1/sites/{siteId}/exclusions (scope write:config) or the MCP tool update_exclusions. The checks are the same as in Settings: an IP entry that is not an address or a CIDR range is a 400 invalid_ip, a country is an ISO code or an English name, and a country in hidden_countries is excluded too. A repeat changes nothing; send an Idempotency-Key header to retry safely. data.change_note says what changed, or is null when nothing changed.

Shell
curl -sS -X POST "https://twelvebit.app/api/v1/sites/example.com/exclusions" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
  -d '{"add": {"ips": ["203.0.113.0/24"], "hostnames": ["staging.example.com"]}, "remove": {"countries": ["DE"]}}'

GET /api/v1/sites/{siteId}/exclusions returns the five lists. To replace a whole list, send excluded_ips, excluded_paths, excluded_hostnames, excluded_countries or hidden_countries to PATCH /api/v1/sites/{siteId} or update_site_settings. In MCP, adding hidden_countries needs confirm: true, because it changes every report.

Attack mode

Attack mode filters spam during a bot attack. Turn it on in Settings → Exclusions, or with attack_mode in the REST API and MCP (write:config). While it is on:

  1. A visit counts only after a person interacts: a click, scroll, pointer move, touch or key press. The script marks every hit after the first interaction. Until then the visit is held back: it is stored, but no report shows it. The next marked hit of the session (at the latest, the ping when the tab closes) lets it count. Visits with no interaction stay out, so real visitors who leave without touching the page are not counted either. App SDK visits (app://) are not held back.
  2. Rate limits: at most 30 hits a minute from one address (one IPv6 /64), and 150 a minute from one network (IPv4 /24, IPv6 /48). Without attack mode there is no limit.
  3. Referrer spam: hits from known referrer spam domains are dropped.
  4. Browser headers: hits with neither Accept-Language nor Sec-Fetch-Mode are dropped. Every current browser sends at least one of them; scripts and simple bots often send neither.

The app gets no network-owner (ASN) data, so data-centre traffic is caught by the network rate limit, not by the name of the hosting company. Rate limits count per server instance, and the dropped-hit counts on the Overview are close, not exact.

Turn on automatically on a traffic spike: every hour, the spike check compares the last 24 hours with the usual day (the 14 days before). More than twice the usual, on a site with at least 20 visitors on a usual day, turns attack mode on. The check also counts held-back visits and dropped page views, so it sees the attack and not only what got through. Attack mode that the check turned on turns itself off when it has been on for 24 hours and the last 24 hours were normal. After you turn it off yourself, the check waits 24 hours before it turns it on again. The owner gets an email at each automatic change, and the Overview shows "Attack mode on since …" while it is on.

Local development

twelvebit does not track local development, by design. The script does not send on localhost, 127.*, [::1], *.local or *.test, and the server accepts events only from the site's domain, its subdomains and its extra domains. Check a new setup on the production domain. Coding agents: do not set up local tracking unless the person asks for it.

Only for a local test that someone asked for: data-allow-localhost="true" makes the script send, and the server must accept the local host: turn on "Allow every domain" in Settings → General → Other domains. Turn both off after the test.

Do Not Track and Global Privacy Control

The script does not read the Do Not Track or Global Privacy Control signals. If your policy respects them, load the script only when they are off:

HTML
<script>
  if (navigator.doNotTrack !== "1" && !navigator.globalPrivacyControl) {
    var s = document.createElement("script");
    s.defer = true;
    s.src = "https://twelvebit.app/js/script.js";
    s.setAttribute("data-website-id", "tb_YOUR_SITE_ID");
    s.setAttribute("data-domain", "example.com");
    document.head.appendChild(s);
  }
</script>

Whether you need consent depends on the laws that apply to you and on how you use the data. In cookie mode the script stores an identifier on the device for up to one year. In the EU and the UK, storing identifiers on a device usually needs consent unless an exemption applies. Cookieless mode stores nothing on the device. If you are not sure, ask a lawyer. This page is a description of the product, not legal advice.