Installation
fetch)
Setup
| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your imk_ prefixed API key |
baseUrl | string | Yes | Base domain (SDK appends /api/v1/...) |
timeout | number | No | Request timeout in milliseconds |
Tracking Events
Direct Tracking
Fluent Builder
ThePendingEvent class provides a chainable API:
PendingEvent Methods
| Method | Parameters | Description |
|---|---|---|
idempotencyKey(key) | string | Set deduplication key |
version(v) | number | Set event schema version |
session(id) | string | Set session identifier |
actionCategory(cat) | string | Set action category |
target(type, id?, name?, metadata?) | string, string?, string?, object? | Add a single target |
targets(arr) | array | Set all targets at once |
track(action, resource?, metadata?) | string, string?, object? | Send the event |
Batch Ingestion
Send up to 100 events in a single request:Querying Events
Retrieving a Single Event
Verification
Viewer Tokens
Alerts
Exports
Error Handling
The SDK throwsImmutableError for API failures: