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

# npm package

> Install @heretic-hq/collector and measure the visitor from your bundle.

```bash theme={"dark"}
npm install @heretic-hq/collector
```

```js theme={"dark"}
import { heretic } from '@heretic-hq/collector';

const result = await heretic({ siteKey: 'hrtc_live_0123456789abcdef01234567' });
if (result.ok) await fetch('/api/heretic', { method: 'POST', body: result.requestId });
```

`heretic()` runs once per page; later calls return the same run. `result.requestId` is a 32-character hex string. It is readable at [`GET /v1/verdict`](/api/verdict-endpoint) as soon as the promise resolves.

```ts theme={"dark"}
type HereticResult =
  | { ok: true; sessionCreated: true; requestId: string }
  | { ok: false; sessionCreated: true; requestId: string; reason: string }
  | { ok: false; sessionCreated: false; requestId: null; reason: string };
```

ESM, CommonJS, and types are included. `dist/heretic.js` is the browser bundle for serving from your own origin.

## Content security policy

```text theme={"dark"}
script-src 'self' 'wasm-unsafe-eval';
connect-src https://probe.heretic.tech;
worker-src blob:;
```

[Options and result](/collector/options) lists every `heretic(config)` option.


## Related topics

- [Quickstart](/quickstart.md)
- [Collector options and result](/collector/options.md)
- [Script tag](/collector/script-tag.md)
- [Heretic documentation](/index.md)
