RTN Docs

Web SDK · v0.6.0

Configuration

Every option accepted by rtn.init and createClient, with defaults.

Pass options as the second argument to rtn.init:

rtn.init('WRITE_KEY', {
  consent: 'pending',
  currency: 'USD',
  cookieDomain: '.example.com',
  debug: true,
});

With a bundler, pass the same options to createClient together with writeKey and endpoint.

Options

OptionDefaultDescription
endpointScript originIngest base URL without /v1/batch. Required with createClient.
consentStored decision, otherwise 'granted'Initial analytics decision. See Consent.
autoPageViewstrueTracks the initial page and SPA navigations (pushState, popstate, hash routes).
interactionsAll offOpt-in listeners for outbound links, downloads, and forms. See Automatic Tracking.
pageTracking—SPA page filter, custom page key, and debounce: shouldTrackPage, key, debounceMs.
ratePolicy—Global in-memory sampling and rate limit.
eventRatePolicies—Per-event policies applied in addition to ratePolicy.
currency'TRY'ISO 4217 currency used by ecommerce helpers when an event has none.
cookieDomainCurrent hostShares the anonymous and user ID across subdomains, for example .example.com.
batchSize10Events per batch.
flushIntervalMs5000Maximum wait before a batch is sent.
debugfalseLogs events, warnings, and server rejection reasons to the console.
ignoredReferrers—Extra referrer hosts that must not start a new visit, such as your payment provider. Common payment and 3-D Secure hosts are built in.
redactParams—Extra URL parameters whose values become redacted.
redactPropertyKeys—Extra property keys whose values become redacted before queueing.
beforeSend—(event) => event | null. Change or drop an event before it is queued.
onDiagnostic—Receives queue drops, storage errors, and quality-policy drops.

See Privacy Controls for the redaction options and beforeSend.

Diagnostics

onDiagnostic receives one of these objects. A throwing callback never stops the SDK.

DiagnosticMeaning
{ type: 'queue_drop', reason: 'max_count' | 'max_bytes' | 'expired', count }The offline queue exceeded 1,000 events or 512 KiB, or events were older than 7 days.
{ type: 'persistence_error' }localStorage could not be written.
{ type: 'event_drop', reason: 'sampled_out' | 'rate_limited' | 'duplicate_page', event }A quality policy dropped the event.
rtn.init('WRITE_KEY', {
  onDiagnostic: (diagnostic) => console.debug('[rtn diagnostic]', diagnostic),
});

On this page