Options
All
  • Public
  • Public/Protected
  • All
Menu

Initialization options for the LaunchDarkly browser SDK.

Hierarchy

  • LDOptionsBase
    • LDOptions

Index

Properties

Optional allAttributesPrivate

allAttributesPrivate: undefined | false | true

Whether all user attributes (except the user key) should be marked as private, and not sent to LaunchDarkly in analytics events.

By default, this is false.

Optional allowFrequentDuplicateEvents

allowFrequentDuplicateEvents: undefined | false | true

Whether or not to send an analytics event for a flag evaluation even if the same flag was evaluated with the same value within the last five minutes.

By default, this is false (duplicate events within five minutes will be dropped).

Optional baseUrl

baseUrl: undefined | string

The base URL for the LaunchDarkly server.

Most users should use the default value.

Optional bootstrap

bootstrap: "localStorage" | LDFlagSet

The initial set of flags to use until the remote set is retrieved.

If "localStorage" is specified, the flags will be saved and retrieved from browser local storage. Alternatively, an LDFlagSet can be specified which will be used as the initial source of flag values. In the latter case, the flag values will be available via variation immediately after calling initialize() (normally they would not be available until the client signals that it is ready).

For more information, see the SDK Reference Guide.

Optional diagnosticOptOut

diagnosticOptOut: undefined | false | true

Set to true to opt out of sending diagnostics data.

Unless diagnosticOptOut is set to true, the client will send some diagnostics data to the LaunchDarkly servers in order to assist in the development of future SDK improvements. These diagnostics consist of an initial payload containing some details of SDK in use, the SDK's configuration, and the platform the SDK is being run on, as well as payloads sent periodically with information on irregular occurrences such as dropped events.

Optional diagnosticRecordingInterval

diagnosticRecordingInterval: undefined | number

The interval at which periodic diagnostic data is sent, in milliseconds.

The default is 900000 (every 15 minutes) and the minimum value is 6000. See diagnosticOptOut for more information on the diagnostics data being sent.

Optional evaluationReasons

evaluationReasons: undefined | false | true

Whether LaunchDarkly should provide additional information about how flag values were calculated.

The additional information will then be available through the client's LDClient.variationDetail method. Since this increases the size of network requests, such information is not sent unless you set this option to true.

Optional eventCapacity

eventCapacity: undefined | number

The capacity of the analytics events queue.

The client buffers up to this many events in memory before flushing. If the capacity is exceeded before the queue is flushed, events will be discarded. Increasing the capacity means that events are less likely to be discarded, at the cost of consuming more memory. Note that in regular usage flag evaluations do not produce individual events, only summary counts, so you only need a large capacity if you are generating a large number of click, pageview, or identify events (or if you are using the event debugger).

The default value is 100.

Optional eventUrlTransformer

eventUrlTransformer: undefined | ((url: string) => string)

A function which, if present, can change the URL in analytics events to something other than the actual browser URL. It will be called with the current browser URL as a parameter, and returns the value that should be stored in the event's url property.

Optional eventsUrl

eventsUrl: undefined | string

The base URL for the LaunchDarkly events server.

Most users should use the default value.

Optional fetchGoals

fetchGoals: undefined | false | true

Whether the client should make a request to LaunchDarkly for A/B testing goals.

This is true by default, meaning that this request will be made on every page load. Set it to false if you are not using A/B testing and want to skip the request.

Optional flushInterval

flushInterval: undefined | number

The interval in between flushes of the analytics events queue, in milliseconds.

The default value is 2000ms.

Optional hash

hash: undefined | string

The signed user key for Secure Mode.

For more information, see the JavaScript SDK Reference Guide on Secure mode.

Optional logger

logger: LDLogger

An object that will perform logging for the client.

If not specified, the default is createConsoleLogger in the browser SDK, or a logger from the winston package in Electron.

Optional privateAttributeNames

privateAttributeNames: Array<string>

The names of user attributes that should be marked as private, and not sent to LaunchDarkly in analytics events. You can also specify this on a per-user basis with LDUser.privateAttributeNames.

Optional samplingInterval

samplingInterval: undefined | number

If specified, enables event sampling so that only some fraction of analytics events will be sent pseudo-randomly.

When set to greater than zero, there is a 1 in samplingInterval chance that events will be sent: for example, a value of 20 means that on average 1 in 20, or 5%, of all events will be sent.

deprecated

This feature will be removed in a future version.

Optional sendEvents

sendEvents: undefined | false | true

Whether to send analytics events back to LaunchDarkly. By default, this is true.

Optional sendEventsOnlyForVariation

sendEventsOnlyForVariation: undefined | false | true

Whether analytics events should be sent only when you call variation (true), or also when you call allFlags (false).

By default, this is false (events will be sent in both cases).

Optional sendLDHeaders

sendLDHeaders: undefined | false | true

Whether or not to include custom HTTP headers when requesting flags from LaunchDarkly.

Currently these are used to track what version of the SDK is active. This defaults to true (custom headers will be sent). One reason you might want to set it to false is that the presence of custom headers causes browsers to make an extra OPTIONS request (a CORS preflight check) before each flag request, which could affect performance.

Optional streamReconnectDelay

streamReconnectDelay: undefined | number

How long (in milliseconds) to wait after a failure of the stream connection before trying to reconnect.

This only applies if streaming has been enabled by setting streaming to true or subscribing to "change" events. The default is 1000ms.

Optional streamUrl

streamUrl: undefined | string

The base URL for the LaunchDarkly streaming server.

Most users should use the default value.

Optional streaming

streaming: undefined | false | true

Whether or not to open a streaming connection to LaunchDarkly for live flag updates.

If this is true, the client will always attempt to maintain a streaming connection; if false, it never will. If you leave the value undefined (the default), the client will open a streaming connection if you subscribe to "change" or "change:flag-key" events (see LDClient.on).

This is equivalent to calling client.setStreaming() with the same value.

Optional useReport

useReport: undefined | false | true

Whether or not to use the REPORT verb to fetch flag settings.

If this is true, flag settings will be fetched with a REPORT request including a JSON entity body with the user object.

Otherwise (by default) a GET request will be issued with the user passed as a base64 URL-encoded path parameter.

Do not use unless advised by LaunchDarkly.

Optional wrapperName

wrapperName: undefined | string

For use by wrapper libraries to set an identifying name for the wrapper being used.

This will be sent as diagnostic information to the LaunchDarkly servers to allow recording metrics on the usage of these wrapper libraries.

Optional wrapperVersion

wrapperVersion: undefined | string

For use by wrapper libraries to set version to be included alongside wrapperName.

If wrapperName is unset, this field will be ignored.

Generated using TypeDoc