Updated
View as MarkdownTroubleshooting
Start with the install check. It shows what twelvebit has received for the site:
curl -sS https://twelvebit.app/api/v1/install-check -H "Authorization: Bearer $TWELVEBIT_API_KEY"The CLI prints the same check in a short form:
npx -y twelvebit@latest statusRead these fields first:
| Field | What it tells you |
|---|---|
installed, first_event_at | Whether any event has arrived. Until then, status says "Waiting for the first event from <domain>". |
last_event_at | The time of the latest event. It updates at most once a minute. |
counts_24h | Page views, goals, identify calls, outbound clicks and payments in the last 24 hours. |
hosts | The page hosts that sent events in the last 7 days. |
next_steps | What to do next, for example "Events come from …, not example.com. Check data-domain." |
Then add data-debug="true" to the script tag and open the browser console. When the script decides not to track, it logs the reason, for example [twelvebit] not tracking: localhost.
Console messages
The messages for localhost, file, automation and ignored by this browser are in Nothing arrives. The others:
| Message | Cause |
|---|---|
[twelvebit] data-website-id is missing | The script tag has no site id. The script stops. This shows without data-debug. |
not tracking: bot | The user agent looks like a headless browser or an HTTP library, or is shorter than 20 characters. |
not tracking: iframe | The page runs inside an iframe. Add data-allow-iframe="true" to track it. |
script loaded twice, this copy does nothing | Two script tags for the same site are on the page. Only the first copy sends, so page views are not counted twice. |
Nothing arrives
| Cause | What you see | Fix |
|---|---|---|
You test on localhost, 127.*, *.local or *.test | Console (with data-debug): not tracking: localhost | This is by design: local development is not tracked. Deploy and test on the production domain. (data-allow-localhost="true" makes the script send, but the server still refuses hosts that are not the site's domains.) |
You test on a preview deployment (*.vercel.app, *.netlify.app) | POST /api/e answers 403 domain not allowed | Test on the production domain, or add the preview host under Other domains (Settings → General). |
| This browser is excluded | not tracking: ignored by this browser | Run localStorage.removeItem("twelvebit_ignore") in the console. |
| Automated browser | not tracking: automation | Playwright, Puppeteer, Selenium and Cypress set navigator.webdriver. Test in a normal browser. |
| The page is opened as a file | not tracking: file | Serve the page over HTTP. |
| An ad blocker blocks the script or the request | The request to /js/script.js or /api/e fails in the Network tab | Serve the script from your domain. See Proxy. |
| The page host is not the site's domain | POST /api/e answers 403 domain not allowed | Use the root domain in the dashboard and in data-domain, or add the other domain in the site settings (extra domains). Subdomains of the site domain are always allowed. |
| Wrong site id | POST /api/e answers 404 unknown site | Copy the id from the site's setup page. It starts with tb_. |
| Content Security Policy | A CSP error in the console | Add https://twelvebit.app to script-src and connect-src, or proxy the script. |
| The visit is excluded | POST /api/e answers 202 but no visit shows | Check the site's exclusions: IP addresses, paths, hostnames and countries. |
| The request looks like a bot | POST /api/e answers 202, nothing shows | Server-side bot filtering drops known bot user agents. Use a normal browser. |
| You changed a setting a moment ago | The old rule still applies | Each server keeps the site settings for one minute. Wait one minute and try again. |
Read the answer of POST /api/e
Open the Network tab, find the POST request to /api/e (or to your proxy path), and read its status and its response text.
| Status | Response text | Meaning |
|---|---|---|
| 202 | (empty) | The event is stored. |
| 202 | bot | The user agent is empty or is a known bot. |
| 202 | excluded ip, excluded path, excluded host, excluded country | An exclusion matched. |
| 202 | attack mode: no_browser, attack mode: rate_ip, attack mode: rate_range, attack mode: referrer_spam | Attack mode is on and dropped the hit. |
| 202 | cloud network | The address belongs to a cloud or hosting network. The visit counts as a bot. See Cloud networks. |
| 202 | sampled out, pings off | A usage control left out this page view or ping. |
| 400 | bad payload, bad url, bad json, bad goal name | The body is not what the script sends. Check a proxy that changes the body, and the goal name. |
| 403 | domain not allowed | The page host is not the site's domain, a subdomain of it, or an extra domain. |
| 404 | unknown site | The site id is wrong. |
| 413 | too large | The body is larger than 16 KB. Send fewer or shorter props. |
While attack mode is on, a new visit counts only after the visitor clicks, scrolls, moves the pointer, touches or types. A visit where you only load the page can stay out of the reports.
From a cloud desktop or a VPN in a data centre, your own visits can count as cloud-network bots.
Events arrive, but not the ones I expect
- Goal names are changed to lower case and cut to 64 characters.
Signuparrives assignup, andsignUpalso arrives assignup, notsign_up. Write names in snake_case. - Spaces and other characters become
_, and a name must start with a letter.Sign Up!arrives assign_up. A name with no letter left answers 400bad goal name. pageview,identify,outbound,pingandpaymentare reserved.window.twelvebit("payment", …)is a payment hint, not a goal.- Props: at most 30 per event. Keys are cut to 64 characters and text values to 255. The script turns objects into JSON text and skips
null. data-tb-goalsends on click. Check that no other handler stops the event before the document sees it (the script listens in the capture phase, so most handlers do not block it).- Calls made before the script has loaded are lost unless you add the queue stub.
- A page view is sent only when the URL changes. The hash counts only with
data-hash="true". - Compare your code with the plan:
npx -y twelvebit@latest check. The install check also listsundeclaredevents andprop_drift: props that do not match the plan in the last 7 days.
Identify does not link the user
[twelvebit] identify needs user_id or email in the console means that the call had neither. For 404 visitor_not_found from the server API and for cookieless mode, see Identify.
Revenue does not show a source
- The checkout must carry
twelvebit_visitor_idandtwelvebit_session_idin its metadata. Read the_tb_vidand_tb_sidcookies on the server when you create the checkout. See Revenue. - In cookieless mode there are no cookies. Use
identifywith the customer's email before the checkout, so twelvebit can match the payment by email. - The provider must be connected in the site's revenue settings, or you must send payments with
POST /api/v1/payments. The install check lists the site's integrations and their status inintegrations. - For Stripe Checkout and Polar, the script can link the payment from the success page URL (
session_id=cs_…orcheckout_id). This does not work whendata-disable-payments="true"is set. See Payments from the success page.
Every visitor shows the same city
Your proxy sends the requests from its own address. See Proxy.
Still stuck
Send the output of the install check and the console lines with data-debug="true" to support.