Quick start
Verify it works
In development mode (logLevel: "debug"), the SDK logs to the console when events are batched and flushed. You can also call await tell.flush() and check that no error is reported via onError.
Configuration
Two presets are available:Tracking events
Every method takesuserId as its first parameter. For details on each event type and when to use them, see Events & Properties.
undefined when you don’t need properties:
Standard event names
Super properties
Structured logging
service parameter defaults to "app". Nine severity levels from logEmergency to logTrace. See Logs for the full level reference and when to use each.
Generic logging method:
Redaction & beforeSend
Transform or drop events before they’re queued. Returnnull to drop an item. Supports a single function or an array of functions applied in order.
Drop health-check events
Scrub user PII from traits
redact() utility
For common patterns, use the built-in redact() factory:
redact() with custom hooks in an array:
Lifecycle
close() before your process exits to avoid losing buffered events.
Error handling
Tracking calls (track, identify, group, revenue, alias) and logging calls never throw. Validation errors and network failures route through the onError callback:
flush, close) can throw or reject — handle these in your application code.
Retry behavior
On HTTP send failure (5xx or network error), the SDK retries with exponential backoff: 1-second base delay, 1.5x multiplier, 20% jitter, capped at 30 seconds. AftermaxRetries attempts (default: 3), the batch is dropped and reported via onError.
4xx errors (except 413) are not retried — they indicate a client-side issue (e.g. invalid API key). On 413 (payload too large), the SDK automatically halves the batch size for future sends.
Configuration reference
| Parameter | Production | Development | Description |
|---|---|---|---|
endpoint | https://collect.tell.app | http://localhost:8080 | HTTP collector URL |
batchSize | 100 | 10 | Events per batch before auto-flush |
flushInterval | 10,000 ms | 2,000 ms | Time between auto-flushes |
maxRetries | 3 | 3 | Retry attempts on send failure |
closeTimeout | 5,000 ms | 5,000 ms | Max wait on close() |
networkTimeout | 30,000 ms | 30,000 ms | HTTP request timeout |
maxQueueSize | 1,000 | 1,000 | Max queued items before oldest drops |
gzip | false | false | Compress payloads with gzip |
source | os.hostname() | os.hostname() | Log source identifier |
logLevel | error | debug | SDK log verbosity |
disabled | false | false | Drop all events locally |