Overview
Client is the main entry point for the Mirador SDK. It handles authentication and creates trace builders.
Import
Web SDK:Constructor
Web SDK:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes (Web) / No (Node.js) | API key for authentication |
options | ClientOptions | No | Configuration options |
Options
Examples
Basic initialization:Methods
trace()
Creates a new trace builder. Web SDK:Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
options | TraceOptions | No | Trace configuration |
TraceOptions
Web SDK:| Option | Type | Default | Description |
|---|---|---|---|
name | string | undefined | Name identifying the trace |
includeUserMeta | boolean | true | Include browser metadata |
maxRetries | number | 3 | Maximum retry attempts |
retryBackoff | number | 1000 | Base backoff delay (ms) |
autoClose | boolean | false | Automatically close trace on page unload |
| Option | Type | Default | Description |
|---|---|---|---|
name | string | undefined | Name identifying the trace |
captureStackTrace | boolean | true | Capture stack trace at trace creation |
maxRetries | number | 3 | Maximum retry attempts |
retryBackoff | number | 1000 | Base backoff delay (ms) |
Returns
Trace - A trace builder instance
Examples
Web SDK - Basic trace:Usage Patterns
Single Client Instance
Create one client instance and reuse it: Web SDK:Multiple Traces
A single client can create multiple concurrent traces: Web SDK:Environment-Based Configuration
Authentication
The API key is sent with every request in thex-ingest-api-key header. Keep your API key secure:
- Don’t commit it to version control
- Use environment variables
- Consider using different keys for dev/prod