Skip to content

Troubleshooting

Turn on logging in the browser console:

cosembra.debug() // on
cosembra.debug(false) // off

Or set it from the start with init(key, { endpoint, debug: true }). Debug mode logs every call, batch and retry, and explains why an event was dropped.

Check these in order:

  1. Is init() called? Without it, other calls log [cosembra] call init() first.
  2. Is consent pending? With requireConsent: true, nothing is sent until consent(true). See Consent and privacy.
  3. Is it just waiting? Events are sent in batches every 5 seconds, or immediately when the page is hidden. Call cosembra.flush() to send now.
  4. Is the script blocked? Some ad blockers and privacy extensions block analytics scripts. Test in a private window with extensions turned off.

If the server answers 401 (site key not recognized) or 403 (origin not allowed), the SDK stops sending for the rest of the page view and logs site key or origin not accepted; tracking disabled.

  • 401: check that the site key in init() is exactly right.
  • 403: the page’s origin isn’t on the key’s allowlist. The origin is the scheme, host and port, such as https://www.example.com. https://example.com, https://www.example.com and http://localhost:3000 are three different origins: each one must be listed.

A 202 response can still reject individual events. The body lists them:

{ "accepted": 9, "rejected": [{ "index": 3, "reason": "invalid_name" }] }

Rejected events are dropped, since they’d fail again on retry. The most common reasons:

Reason Fix
invalid_name Use lower_snake_case, up to 64 characters
properties_too_large Keep properties under 8 KB
properties_too_many_keys Use 100 keys or fewer
properties_too_deep Nest at most 3 levels
too_old The event happened more than 7 days ago

See the HTTP API reference for every response and reason.

The service is asking clients to slow down. The SDK keeps the events and retries automatically, following the Retry-After header. No action is needed unless it lasts.