Docsllms.txtSign inGo to your sites

Updated

View as Markdown

Troubleshooting

Start with the install check. It shows what twelvebit has received for the site:

Shell
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:

Shell
npx -y twelvebit@latest status

Read these fields first:

FieldWhat it tells you
installed, first_event_atWhether any event has arrived. Until then, status says "Waiting for the first event from <domain>".
last_event_atThe time of the latest event. It updates at most once a minute.
counts_24hPage views, goals, identify calls, outbound clicks and payments in the last 24 hours.
hostsThe page hosts that sent events in the last 7 days.
next_stepsWhat 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:

MessageCause
[twelvebit] data-website-id is missingThe script tag has no site id. The script stops. This shows without data-debug.
not tracking: botThe user agent looks like a headless browser or an HTTP library, or is shorter than 20 characters.
not tracking: iframeThe page runs inside an iframe. Add data-allow-iframe="true" to track it.
script loaded twice, this copy does nothingTwo script tags for the same site are on the page. Only the first copy sends, so page views are not counted twice.

Nothing arrives

CauseWhat you seeFix
You test on localhost, 127.*, *.local or *.testConsole (with data-debug): not tracking: localhostThis 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 allowedTest on the production domain, or add the preview host under Other domains (Settings → General).
This browser is excludednot tracking: ignored by this browserRun localStorage.removeItem("twelvebit_ignore") in the console.
Automated browsernot tracking: automationPlaywright, Puppeteer, Selenium and Cypress set navigator.webdriver. Test in a normal browser.
The page is opened as a filenot tracking: fileServe the page over HTTP.
An ad blocker blocks the script or the requestThe request to /js/script.js or /api/e fails in the Network tabServe the script from your domain. See Proxy.
The page host is not the site's domainPOST /api/e answers 403 domain not allowedUse 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 idPOST /api/e answers 404 unknown siteCopy the id from the site's setup page. It starts with tb_.
Content Security PolicyA CSP error in the consoleAdd https://twelvebit.app to script-src and connect-src, or proxy the script.
The visit is excludedPOST /api/e answers 202 but no visit showsCheck the site's exclusions: IP addresses, paths, hostnames and countries.
The request looks like a botPOST /api/e answers 202, nothing showsServer-side bot filtering drops known bot user agents. Use a normal browser.
You changed a setting a moment agoThe old rule still appliesEach 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.

StatusResponse textMeaning
202(empty)The event is stored.
202botThe user agent is empty or is a known bot.
202excluded ip, excluded path, excluded host, excluded countryAn exclusion matched.
202attack mode: no_browser, attack mode: rate_ip, attack mode: rate_range, attack mode: referrer_spamAttack mode is on and dropped the hit.
202cloud networkThe address belongs to a cloud or hosting network. The visit counts as a bot. See Cloud networks.
202sampled out, pings offA usage control left out this page view or ping.
400bad payload, bad url, bad json, bad goal nameThe body is not what the script sends. Check a proxy that changes the body, and the goal name.
403domain not allowedThe page host is not the site's domain, a subdomain of it, or an extra domain.
404unknown siteThe site id is wrong.
413too largeThe 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. Signup arrives as signup, and signUp also arrives as signup, not sign_up. Write names in snake_case.
  • Spaces and other characters become _, and a name must start with a letter. Sign Up! arrives as sign_up. A name with no letter left answers 400 bad goal name.
  • pageview, identify, outbound, ping and payment are 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-goal sends 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 lists undeclared events and prop_drift: props that do not match the plan in the last 7 days.

[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_id and twelvebit_session_id in its metadata. Read the _tb_vid and _tb_sid cookies on the server when you create the checkout. See Revenue.
  • In cookieless mode there are no cookies. Use identify with 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 in integrations.
  • For Stripe Checkout and Polar, the script can link the payment from the success page URL (session_id=cs_… or checkout_id). This does not work when data-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.