Troubleshooting

Most problems show up as a console warning on localhost. Start there.

No events at all

  1. Does the project ask for consent first, or did the visitor opt out? With "Ask for consent first" on, nothing is sent before datacub.consent.grant(). A visitor who called datacub.consent.revoke() stays opted out on that browser. On localhost the SDK warns no consent yet.
  2. Is the key right? It starts with pk_live_ or pk_test_ followed by 24 to 48 letters and digits. The placeholder pk_live_YOUR_PROJECT_KEY is refused: init: bad key.
  3. Is your site allowed? Check Where data may come from in Settings, General. localhost works only with a pk_test_ key. In the browser's network tab, a 403 from /v1/batch with origin_not_allowed means the site is not on the list.
  4. Is Global Privacy Control on? Browsers with GPC count as an opt-out. See consent.
  5. Is an ad blocker dropping the request? Use a first-party proxy.

Then use Check the connection in Settings, Integrations: it waits for your next event and says when it lands.

Warnings and what they mean

WarningFix
init: bad keyuse a real pk_ key; apiHost must be https (or http://localhost)
refused a secret key. Use a pk_ key.never put an sk_ key in client code
bad nameevent names cannot start with $ or look like IDs. See names
bad idthe ID looks like an email, phone, national ID or placeholder. Send your internal user ID
no consent yetonly with "Ask for consent first" on: expected until your consent flow grants

In React Native the same checks print as track: invalid event name, identify: ID refused, init: expected a pk_live_ or pk_test_ key, and init: no app id when app is missing.

Responses from datacub

StatusMeaningWhat the SDK does
401 invalid_keythe key does not exist or was revokedstops for this page or launch
403 origin_not_allowed, 403 app_not_allowedthe site or app is not on the allowed liststops for this page or launch
403 project_suspended, 403 project_in_reviewthe project is pausedstops for this page or launch
403 ingestion_pausedthe trial ended without a plan (billing)stops for this page or launch
429 rate_limitedtoo many events at onceretries after the time datacub asks for
5xx or offlinedatacub or the network is downretries with backoff, keeps up to 1,000 events

Page views are missing or doubled

  • Only the first page counts in a single page app: your router may use the URL fragment. Set hashRouting: true.
  • A page counts twice: init is called with two different setups, or the script tag and the npm package are both loaded. Load the SDK once.
  • Paths show :id or :redacted: that is on purpose. IDs and personal data are removed from URLs.

Users look duplicated or merged

  • One person shows as many users: call identify after every login, on every device. Safari users who stay away for 7 days return as new Guests until they sign in.
  • Two people show as one: call reset() at logout.

Mobile

  • Nothing survives a restart: pass storage to init.
  • Events from Expo Go are refused: Expo Go works only with a pk_test_ key.
  • Nothing sent in tests: await datacub.flush() before the test ends.