Skip to content

RevTurbineInitOptions

Options for initializing the RevTurbine SDK.

import { initRevTurbine } from '@revt-eng/sdk';
const sdk = initRevTurbine({
tenantId: 'tenant_abc',
apiKey: 'rt_live_xxx',
endpoint: 'https://api.revturbine.io',
mode: 'react',
});

optional analytics?: boolean

Analytics/clickstream telemetry opt-out.

Analytics is on by default (true). Set to false to opt out: the SDK then emits no clickstream events to POST /api/track across every path (capture / track / batched flush / page-unload). Locally-registered RevTurbineEventConsumer adapters and local_only runtime state are unaffected — this flag governs only the RevTurbine ingest network call.

Note: this opt-out covers the authed clickstream. The separate keyless anonymous SDK-init beacon has its own opt-out (anonymousTelemetry).


optional anonymousTelemetry?: boolean

Keyless anonymous SDK-init telemetry opt-out (plan 95).

When no ingestPublicKey is configured, the SDK sends a single anonymous sdk_init beacon to POST /api/sdk/meta carrying config-shape counts only (number of plans, entitlements, placements, etc.), the SDK version, runtime/schema/bundle versions, and a one-way hashed config id — never any user, account, or PII context. It powers RevTurbine’s SDK-adoption metrics for installs that haven’t wired an ingest key.

On by default (true). Set to false to opt out entirely; the SDK then sends no keyless telemetry. When active, the SDK logs a one-time info console notice naming this flag. Has no effect once an ingestPublicKey is present (that path uses the authed clickstream instead), nor in local_only runtime mode.


apiKey: string

API key for authentication.


optional configProvider?: RevTurbineConfigProvider

Optional provider for RevTurbineConfig-backed data (plans, segments, rules, ui paths).


optional domainProviders?: AnyDomainProvider[]

Typed domain providers (plan, entitlements, segments, content, rules, traits).


endpoint: string

Base URL of the RevTurbine API Edge.


optional endpointOverrides?: Partial<RevTurbineEndpointOverrides>

Optional endpoint overrides used in custom_endpoints mode.


optional environmentId?: string

Environment identifier stamped on every ingested clickstream event (TrackEvent.environment_id, e.g. 'prod' / 'staging'). Lets a tenant separate analytics by deployment environment. Defaults to 'default' when omitted.


optional eventBatching?: RevTurbineEventBatchingOptions

Client-side clickstream batching policy (plan 95). Events are buffered and flushed to POST /api/track on whichever comes first: the batch reaching RevTurbineEventBatchingOptions.maxBatchSize, the RevTurbineEventBatchingOptions.flushIntervalMs timer elapsing, or a page-unload signal (pagehide / visibilitychange: hidden). Tune for low-volume sessions that would otherwise strand events.


optional ingestPublicKey?: string

Public ingest key for SDK clickstream ingestion (POST /api/track).

Mint one in your RevTurbine tenant under Settings → Ingest keys. This is a tenant-scoped, embeddable public token distinct from apiKey: it authorizes only event ingestion (the ingest:write scope) and carries no role authority, so it is safe to ship in client bundles. When omitted, the SDK falls back to apiKey for the ingest request — but /api/track accepts only a public token, so a non-public apiKey fallback will be rejected. Set this for any integration that emits events.


optional localRuntime?: RevTurbineLocalRuntimeOptions

Local-only runtime configuration used in local_only mode.


mode: RevTurbineSdkMode

SDK integration mode.


optional persistentStorage?: RevTurbineStorage

Persistent storage provider (survives page reloads). Browser default: localStorage. Server default: in-memory. Override with a Redis/cookie/DB-backed implementation for SSR persistence.


optional placementBehavior?: Partial<RevTurbinePlacementBehaviorFlags>

Opt-in flags for placement decision behavior changes.

Defaults are conservative (false) so existing integrations do not change behavior until explicitly enabled.


optional providerFailureSlotBehavior?: RevTurbineProviderFailureSlotBehavior

Slot behavior after provider-chain failure disables the SDK.

  • invisible (default): slots return hidden decisions.
  • placeholder: slots return visible placeholder content.

optional runtimeMode?: RevTurbineRuntimeMode

SDK deployment/runtime mode:

  • revturbine_server (default): standard RevTurbine-hosted endpoints.
  • custom_endpoints: customer-provided endpoint replacements.
  • local_only: no server calls, runtime data initialized locally.

optional sessionStorage?: RevTurbineStorage

Session-scoped storage provider (cleared when the tab/session ends). Browser default: sessionStorage. Server default: in-memory.


tenantId: string

Your RevTurbine tenant identifier.


optional uiPathResolvers?: RevTurbineUiPathResolverMap

Optional UI path resolver map used by validateUiPathResolvers().