> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trevosdk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# No events arriving

> Work out where the chain broke — the script, the key, the init call, or the track call.

**Data → Events** is empty, or the setup panel is still saying "waiting for your first
event". Work down this list in order; each step rules out everything above it.

## 1. Did the SDK load at all?

Open your browser console on a page where Trevo should be running:

```js theme={null}
typeof window.Trevo
```

* `"object"` — loaded. Go to step 2.
* `"undefined"` — the script never ran.

If you installed via a `<script>` tag, the global is **`Trevo`**. Check the Network tab for
the CDN request. The URL must include both the version and the filename:

```
✅ https://cdn.trevosdk.com/browser/v0.2.4/trevo.min.js
❌ https://cdn.trevosdk.com/browser/latest.js
```

A `403` or `404` there means the URL is wrong, not that your key is wrong.

If you installed from npm, `window.Trevo` will not be set — that is normal. Confirm your
bundle actually imports the module instead.

## 2. Did `init()` run, and with a key?

```js theme={null}
Trevo.isReady()
```

Check the console for:

```
[TrevoSDK] <method>() called before init(). Call init({ apiKey }) first.
```

`init()` requires an explicit key. There is no auto-initialisation from a `data-key`
attribute:

```js theme={null}
❌ Trevo.init();
✅ Trevo.init({ apiKey: 'tsk_live_…' });
```

Calling `init()` with no argument throws
`TrevoSDKError: init() requires a non-empty apiKey string.`

## 3. Is the key the right one?

Look at the Network tab for a request to `api.trevosdk.com/v1/config`.

| What you see      | What it means                                |
| ----------------- | -------------------------------------------- |
| `200`             | Key is valid and config loaded. Go to step 4 |
| `401`             | Key is wrong, revoked, or the wrong class    |
| no request at all | `init()` never ran — back to step 2          |

A `401` in a browser is most often a **server key in client code**. `tsk_secret_…` keys are
rejected when sent with an `Origin` header, because that combination means the key has been
shipped to a browser. Browsers need the publishable `tsk_live_…` key from
**Settings → API keys**.

A successful config fetch is the strongest signal you can get before any event exists: it
proves the script loaded, the key is valid, and the workspace is reachable.

## 4. Are you calling `track()`?

Nothing is captured automatically. Trevo has no autocapture — no click tracking, no
pageviews. An event exists only where you wrote one:

```ts theme={null}
trevo.track('purchase_completed');
```

Exposures are the exception: those fire automatically inside `getVariant()`. So if you see
exposures but no conversions, the SDK is working and the missing piece is a `track()` call
on your side.

## 5. Are the events leaving the browser?

Watch the Network tab for `POST` requests to `ingest.trevosdk.com/v1/events`. Events are
**batched, not immediate** — up to 50 per request, flushed about every 2 seconds, and on
page unload. A single `track()` in a quiet tab can take a couple of seconds to appear.

To force a send:

```js theme={null}
Trevo.flush()
```

| What you see | What it means                                                   |
| ------------ | --------------------------------------------------------------- |
| `202`        | Accepted. It will show in Events shortly                        |
| `400`        | Validation failed — the response body names the offending field |
| `401`        | Key problem, as in step 3                                       |
| `429`        | Rate limited or daily cap reached                               |
| nothing      | The queue is empty; `track()` is not being reached              |

## 6. Still nothing?

**Check for a blocker.** Ad blockers and privacy extensions block analytics-shaped
requests. Test in a clean profile with extensions disabled. If your users are blocked too,
consider recording conversions from your backend with
[`@trevosdk/node`](/install/node), which no blocker can intercept.

**Check for parked events.** Failed batches are kept in local storage for retry:

```js theme={null}
Object.keys(localStorage).filter(k => k.startsWith('trevo_'))
```

You will see two keys, each suffixed with the last 8 characters of your API key:

* `trevo_config_cache_…` — the cached experiment config
* `trevo_failed_events_…` — events that could not be delivered

Entries in `trevo_failed_events_…` mean the SDK is working and the network is the problem.

**Check for a slow network.** Requests time out after 10 seconds, and you will see this
warning in the console:

```
[TrevoSDK] Event flush failed  TimeoutError: signal timed out
```

## Quick reference

| Symptom                                     | Most likely cause                              |
| ------------------------------------------- | ---------------------------------------------- |
| `window.Trevo` undefined                    | Script tag URL wrong, or blocked               |
| `init() requires a non-empty apiKey string` | Called `init()` with no argument               |
| `401` on `/v1/config`                       | Secret key used in a browser, or a revoked key |
| Config `200`, no events                     | No `track()` call is being reached             |
| Exposures but no conversions                | The SDK works; the `track()` call is missing   |
| Events in `trevo_failed_events_…`           | Network or blocker, not configuration          |
