Braze JavaScript SDK
    Preparing search index...

    Type Alias InitializationOptions

    type InitializationOptions = {
        appVersion?: string;
        appVersionNumber?: string;
        deviceId?: string;
        devicePropertyAllowlist?: DevicePropertyKey[];
        enableLogging?: boolean;
        enableSdkAuthentication?: boolean;
        flushIntervalInSeconds?: number;
        minimumIntervalBetweenTriggerActionsInSeconds?: number;
        openUriCallback?: (
            uri: string,
            openLinkInNewTab: boolean,
            event: Event | undefined,
        ) => void;
        sdkVersion: string;
        sessionTimeoutInSeconds?: number;
    }
    Index

    Properties

    appVersion?: string

    If you provide a value for this option, user events sent to Braze will be associated with the given version, which can be used for user segmentation.

    appVersionNumber?: string

    A numerical app version value which can be used for user segmentation. This value must be sent with four fields, such as "1.2.3.4", otherwise it will be ignored.

    Note: appVersion must also be set, either with the same value or a unique name for this version.

    deviceId?: string

    By default, Braze will assign a random guid as the device ID. Provide a value for this configuration option to override that default with a value of your own.

    devicePropertyAllowlist?: DevicePropertyKey[]

    By default, the Braze SDK automatically detects and collects all device properties in [[DeviceInfo]]. To override this behavior, provide an array of [[DevicePropertyKey]]. To disable all properties being sent to Braze servers, provide an empty array. Note that without some properties, not all features will function properly. For instance, without the time zone, local timezone delivery will not function.

    enableLogging?: boolean

    Set to true to enable logging by default. Note that this will cause Braze to log to the javascript console, which is visible to all users! You should probably remove this or provide an alternate logger with [[setLogger]] before you release your page to production.

    enableSdkAuthentication?: boolean

    Set to true to enable the SDK Authentication feature. For more information about SDK Authentication, see our Product Documentation.

    flushIntervalInSeconds?: number

    By default, the Braze SDK will flush data in the cache every 10 seconds. Providing this option will override the interval. The minimum flush interval is 3 seconds.

    minimumIntervalBetweenTriggerActionsInSeconds?: number

    By default, a trigger action will only fire if at least 30 seconds have elapsed since the last trigger action. Provide a value for this configuration option to override that default with a value of your own. We do not recommend making this value any smaller than 10 to avoid spamming the user with notifications.

    openUriCallback?: (
        uri: string,
        openLinkInNewTab: boolean,
        event: Event | undefined,
    ) => void

    A function called when handling links within in-app messages.

    Type Declaration

      • (uri: string, openLinkInNewTab: boolean, event: Event | undefined): void
      • Parameters

        • uri: string

          The URI to open

        • openLinkInNewTab: boolean

          Whether the link should be opened in a new tab

        • event: Event | undefined

          The event that triggered the redirect

        Returns void

    sdkVersion: string

    The SDK version of the consuming SDK

    sessionTimeoutInSeconds?: number

    By default, sessions time out after 30 minutes of inactivity. Provide a value for this configuration option to override that default with a value of your own.