Installation

Choose the right Klime SDK for your platform and get started.

Frontend or backend?

Frontend tracking — Use the JavaScript browser SDK for any client-side tracking, both for dynamic or static sites. It automatically captures browser context (userAgent, locale, timezone) and handles page unload events.

Backend tracking — Use a server SDK for server-rendered apps, API servers, background jobs, or webhook handlers.

Common features

All SDKs share the same core API design (track, identify, group) while following platform-specific conventions:

  • Automatic batching — Events are queued and sent in batches for efficiency
  • Automatic retries — Failed requests retry with exponential backoff
  • Graceful shutdown — Events are flushed before process exit
  • Zero dependencies — Built on standard library only
  • Type safety — Full TypeScript/type hints support

Configuration

All SDKs accept similar configuration options:

OptionDefaultDescription
writeKey(required)Your Klime write key
endpointhttps://i.klime.comAPI endpoint
flushInterval2 secondsTime between automatic flushes
maxBatchSize20 eventsMax events per batch (max: 100)
maxQueueSize1000 eventsMax queued events
retryMaxAttempts5Max retry attempts

Zero Performance Impact

All tracking methods are non-blocking. Events are queued in memory and sent in the background. Your application code is never blocked by network requests.

Tip: Use environment variables

Never commit your write key to source control. Store it in an environment variable like KLIME_WRITE_KEY and load it at runtime.