Documentation
    Preparing search index...

    Interface RumInitConfiguration

    Init Configuration for the RUM browser SDK.

    DD_RUM.init({
    applicationId: '<DATADOG_APPLICATION_ID>',
    clientToken: '<DATADOG_CLIENT_TOKEN>',
    site: '<DATADOG_SITE>',
    ...
    })
    interface RumInitConfiguration {
        actionNameAttribute?: string;
        allowedTracingUrls?: (MatchOption | TracingOption)[];
        allowedTrackingOrigins?: MatchOption[];
        allowFallbackToLocalStorage?: boolean;
        allowUntrustedEvents?: boolean;
        applicationId: string;
        beforeSend?: (
            event: RumEvent,
            context:
                | RumViewEventDomainContext
                | RumActionEventDomainContext
                | RumFetchResourceEventDomainContext
                | RumXhrResourceEventDomainContext
                | RumOtherResourceEventDomainContext
                | RumErrorEventDomainContext
                | RumLongTaskEventDomainContext
                | RumVitalEventDomainContext,
        ) => boolean;
        clientToken: string;
        compressIntakeRequests?: boolean;
        datacenter?: string;
        defaultPrivacyLevel?: DefaultPrivacyLevel;
        enablePrivacyForActionName?: boolean;
        env?: null
        | string;
        excludedActivityUrls?: MatchOption[];
        plugins?: RumPlugin[];
        profilingSampleRate?: number;
        propagateTraceBaggage?: boolean;
        proxy?: string | ProxyFn;
        replica?: ReplicaUserConfiguration;
        service?: null | string;
        sessionPersistence?: "local-storage" | "cookie";
        sessionReplaySampleRate?: number;
        sessionSampleRate?: number;
        silentMultipleInit?: boolean;
        site?: Site;
        startSessionReplayRecordingManually?: boolean;
        storeContextsAcrossPages?: boolean;
        subdomain?: string;
        telemetrySampleRate?: number;
        traceContextInjection?: TraceContextInjection;
        traceSampleRate?: number;
        trackAnonymousUser?: boolean;
        trackBfcacheViews?: boolean;
        trackFeatureFlagsForEvents?: FeatureFlagsForEvents[];
        trackingConsent?: TrackingConsent;
        trackLongTasks?: boolean;
        trackResources?: boolean;
        trackSessionAcrossSubdomains?: boolean;
        trackUserInteractions?: boolean;
        trackViewsManually?: boolean;
        usePartitionedCrossSiteSessionCookie?: boolean;
        useSecureSessionCookie?: boolean;
        version?: null | string;
        workerUrl?: string;
    }

    Hierarchy (View Summary)

    Index

    Custom Behavior

    compressIntakeRequests?: boolean

    Compress requests sent to the Datadog intake to reduce bandwidth usage when sending large amounts of data. The compression is done in a Worker thread. See Content Security Policy guidelines for further information.

    Data Collection

    trackFeatureFlagsForEvents?: FeatureFlagsForEvents[]

    Enables collection of features flags in additional events (e.g. long task, resource, action, vital).

    trackLongTasks?: boolean

    Enables collection of long task events.

    true
    
    trackResources?: boolean

    Enables collection of resource events.

    true
    

    Other

    actionNameAttribute?: string

    Specify your own attribute to use to name actions.

    See Declare a name for click actions for further information.

    allowedTracingUrls?: (MatchOption | TracingOption)[]

    A list of request URLs used to inject tracing headers. See Connect RUM and Traces for further information.

    allowedTrackingOrigins?: MatchOption[]

    List of origins where the SDK is allowed to run when used in a browser extension context. Matches urls against the extensions origin. If not provided and the SDK is running in a browser extension, a warning will be displayed.

    allowFallbackToLocalStorage?: boolean

    Allows the use of localStorage when cookies cannot be set. This enables the RUM Browser SDK to run in environments that do not provide cookie support.

    Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values See Monitor Electron Applications Using the Browser SDK for further information.

    use sessionPersistence: local-storage where you want to use localStorage instead

    allowUntrustedEvents?: boolean

    Allow listening to DOM events dispatched programmatically (untrusted events). Enabling this option can be useful if you heavily rely on programmatic events, such as in an automated UI test environment.

    false
    
    applicationId: string

    The RUM application ID.

    beforeSend?: (
        event: RumEvent,
        context:
            | RumViewEventDomainContext
            | RumActionEventDomainContext
            | RumFetchResourceEventDomainContext
            | RumXhrResourceEventDomainContext
            | RumOtherResourceEventDomainContext
            | RumErrorEventDomainContext
            | RumLongTaskEventDomainContext
            | RumVitalEventDomainContext,
    ) => boolean

    Access to every event collected by the RUM SDK before they are sent to Datadog. It allows:

    • Enrich your RUM events with additional context attributes
    • Modify your RUM events to modify their content, or redact sensitive sequences (see the list of editable properties)
    • Discard selected RUM events

    See Enrich And Control Browser RUM Data With beforeSend for further information.

    Type declaration

    clientToken: string

    The client token for Datadog. Required for authenticating your application with Datadog.

    datacenter?: string

    [Internal option] Set the datacenter from where the data is dual shipped

    defaultPrivacyLevel?: DefaultPrivacyLevel

    Allow to protect end user privacy and prevent sensitive organizational information from being collected.

    See Replay Privacy Options for further information.

    mask
    
    enablePrivacyForActionName?: boolean

    Enables privacy control for action names.

    env?: null | string

    The application’s environment, for example: prod, pre-prod, and staging. Follows the tag syntax requirements.

    excludedActivityUrls?: MatchOption[]

    A list of request origins ignored when computing the page activity. See How page activity is calculated for further information.

    plugins?: RumPlugin[]

    List of plugins to enable. The plugins API is unstable and experimental, and may change without notice. Please use only plugins provided by Datadog matching the version of the SDK you are using.

    propagateTraceBaggage?: boolean

    Whether to propagate user and account IDs in the baggage header of trace requests.

    false
    
    proxy?: string | ProxyFn

    Optional proxy URL, for example: https://www.proxy.com/path. See Proxy Your Browser RUM Data for further information.

    replica?: ReplicaUserConfiguration

    [Internal option] Configure the dual shipping to another datacenter

    service?: null | string

    The service name for your application. Follows the tag syntax requirements.

    sessionPersistence?: "local-storage" | "cookie"

    Which storage strategy to use for persisting sessions. Can be either 'cookie' or 'local-storage'.

    Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values

    "cookie"
    
    sessionReplaySampleRate?: number

    The percentage of tracked sessions with Browser RUM & Session Replay pricing features: 100 for all, 0 for none.

    See Configure Your Setup For Browser RUM and Browser RUM & Session Replay Sampling for further information.

    sessionSampleRate?: number

    The percentage of sessions tracked. A value between 0 and 100.

    100
    
    silentMultipleInit?: boolean

    Initialization fails silently if the RUM Browser SDK is already initialized on the page.

    false
    
    site?: Site

    The Datadog site parameter of your organization.

    datadoghq.com
    
    startSessionReplayRecordingManually?: boolean

    If the session is sampled for Session Replay, only start the recording when startSessionReplayRecording() is called, instead of at the beginning of the session. Default: if startSessionReplayRecording is 0, true; otherwise, false.

    See Session Replay Usage for further information.

    storeContextsAcrossPages?: boolean

    Store global context and user context in localStorage to preserve them along the user navigation. See Contexts life cycle for further information.

    false
    
    subdomain?: string

    If you are accessing Datadog through a custom subdomain, you can set subdomain to include your custom domain in the getSessionReplayLink() returned URL .

    See Connect Session Replay To Your Third-Party Tools for further information.

    telemetrySampleRate?: number

    The percentage of telemetry events sent. A value between 0 and 100.

    20
    
    traceContextInjection?: TraceContextInjection

    If you set a traceSampleRate, to ensure backend services' sampling decisions are still applied, configure the traceContextInjection initialization parameter to sampled.

    See Connect RUM and Traces for further information.

    sampled
    
    trackAnonymousUser?: boolean

    Track anonymous user for the same site and extend cookie expiration date

    true
    
    trackBfcacheViews?: boolean

    Enable the creation of dedicated views for pages restored from the Back-Forward cache.

    false
    
    trackingConsent?: TrackingConsent

    Set the initial user tracking consent state. See User tracking consent for further information.

    granted
    
    trackSessionAcrossSubdomains?: boolean

    Preserve the session across subdomains for the same site.

    Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values

    false
    
    trackUserInteractions?: boolean

    Enables automatic collection of users actions.

    See Tracking User Actions for further information.

    true
    
    trackViewsManually?: boolean

    Allows you to control RUM views creation. See Override default RUM view names for further information.

    usePartitionedCrossSiteSessionCookie?: boolean

    Use a partitioned secure cross-site session cookie. This allows the RUM Browser SDK to run when the site is loaded from another one (iframe). Implies useSecureSessionCookie.

    Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values

    false
    
    useSecureSessionCookie?: boolean

    Use a secure session cookie. This disables RUM events sent on insecure (non-HTTPS) connections.

    Important: If you are using the RUM and Logs Browser SDKs, this option must be configured with identical values

    false
    
    version?: null | string

    The application’s version, for example: 1.2.3, 6c44da20, and 2020.02.13. Follows the tag syntax requirements.

    Privacy

    workerUrl?: string

    URL pointing to the Datadog Browser SDK Worker JavaScript file. The URL can be relative or absolute, but is required to have the same origin as the web application. See Content Security Policy guidelines for further information.

    Profiling Not ready for production.

    profilingSampleRate?: number

    The percentage of users profiled. A value between 0 and 100.

    0
    

    Tracing

    traceSampleRate?: number

    The percentage of requests to trace: 100 for all, 0 for none. See Connect RUM and Traces for further information.