Troubleshooting
Most problems show up as a console warning on localhost. Start there.
No events at all
- Was the site refused? Open Settings, Connect and AI: when datacub refused events, a warning names the site or app and offers Add this site (Add this app), for owners and admins. In the network tab, a
403from/v1/batchnames the reason. - Testing on localhost? Those events arrive and show on the setup page, but reports leave them out. To see them, choose Include local testing in the Filter button of any report (it is off by default).
- Is the ID real? The placeholder
YOUR_PROJECT_IDis refused:init: bad key. - An old snippet? Copy the one-line tag from these docs or from Settings; snippets for SDK 0.4.0 and earlier must keep their
apiHost. - Consent or opt-out? With "Ask for consent first" on, nothing is sent before
datacub.consent.grant(). A visitor who revoked, or whose browser sends Global Privacy Control, stays opted out. - An ad blocker? Use a first-party proxy.
Then open your site and watch Realtime: you should appear within seconds. A headless or automated browser (Playwright, Puppeteer) counts as a bot: its events are stored but left out of reports. So does an AI assistant opening your page itself (ChatGPT, Claude, Grok, Perplexity), and any browser on a big cloud network (Microsoft Azure, Google Cloud, AWS). A person who clicks a link in an AI answer is counted, under the AI assistants channel.
Warnings
| Warning | Fix |
|---|---|
init: bad key | use your real project ID |
init: bad apiHost | apiHost must be https (or http://localhost) |
refused a secret key. Use your project ID. | never put an sk_ key in client code |
bad name | event names cannot start with $ or look like IDs |
bad id | the user ID looks like an email, phone, national ID or placeholder: send your internal ID |
In React Native: track: invalid event name, identify: ID refused, init: expected a project ID and an https apiHost, and init: no app id when app is missing.
Responses from datacub
| Status | Meaning | What the SDK does |
|---|---|---|
401 invalid_key | the key does not exist or was revoked | stops for this page or launch |
403 origin_not_allowed, 403 app_not_allowed | the site or app is not accepted yet (add it from the warning in Settings) | stops for this page or launch |
403 project_suspended, 403 project_in_review, 403 ingestion_paused | the project is paused | stops for this page or launch |
413 payload_too_large | a batch over 512 KB | check any proxy that merges or changes batches |
429 rate_limited | too many events at once | retries after the time datacub asks for |
5xx or offline | datacub or the network is down | retries with backoff, keeps up to 1,000 events |
Page views missing or doubled
- Only the first page counts in a single page app: your router uses the URL fragment. Set
hashRouting: true. - A page counts twice: the SDK is loaded twice. Load it once.
- Paths show
:idor:redacted: on purpose. IDs and personal data are removed from URLs.
Users duplicated or merged
- One person shows as many users: call
identifyafter every login, on every device. - Two people show as one: call
reset()at logout.
Mobile
- Nothing survives a restart: pass
storagetoinit. - Expo Go events missing from reports: they count as local testing; choose Include local testing in a report's Filter button to see them.
- Nothing sent in tests:
await datacub.flush()before the test ends.