Configuration settings for how telemetry is sent

IConfig

interface IConfig {
    accountId?: string;
    addIntEndpoints?: boolean;
    addRequestContext?: ((requestContext?: IRequestContext) => ICustomProperties);
    ajaxPerfLookupDelay?: number;
    appId?: string;
    autoExceptionInstrumented?: boolean;
    autoTrackPageVisitTime?: boolean;
    autoUnhandledPromiseInstrumented?: boolean;
    bufferOverride?: IStorageBuffer;
    convertUndefined?: any;
    cookieDomain?: string;
    cookiePath?: string;
    correlationHeaderDomains?: string[];
    correlationHeaderExcludedDomains?: string[];
    correlationHeaderExcludePatterns?: RegExp[];
    customHeaders?: [{
        header: string;
        value: string;
    }];
    disableAjaxTracking?: boolean;
    disableCookiesUsage?: boolean;
    disableCorrelationHeaders?: boolean;
    disableDataLossAnalysis?: boolean;
    disableExceptionTracking?: boolean;
    disableFetchTracking?: boolean;
    disableFlushOnBeforeUnload?: boolean;
    disableFlushOnUnload?: boolean;
    disableIkeyDeprecationMessage?: boolean;
    disableTelemetry?: boolean;
    disableUserInitMessage?: boolean;
    disableXhr?: boolean;
    distributedTracingMode?: number;
    emitLineDelimitedJson?: boolean;
    enableAjaxErrorStatusText?: boolean;
    enableAjaxPerfTracking?: boolean;
    enableAutoRouteTracking?: boolean;
    enableCorsCorrelation?: boolean;
    enableDebug?: boolean;
    enableRequestHeaderTracking?: boolean;
    enableResponseHeaderTracking?: boolean;
    enableSessionStorageBuffer?: boolean;
    enableUnhandledPromiseRejectionTracking?: boolean;
    eventsLimitInMem?: number;
    excludeRequestFromAutoTrackingPatterns?: string[] | RegExp[];
    isBeaconApiDisabled?: boolean;
    isBrowserLinkTrackingEnabled?: boolean;
    isCookieUseDisabled?: boolean;
    isRetryDisabled?: boolean;
    isStorageUseDisabled?: boolean;
    maxAjaxCallsPerView?: number;
    maxAjaxPerfLookupAttempts?: number;
    maxBatchInterval?: number;
    maxBatchSizeInBytes?: number;
    namePrefix?: string;
    onunloadDisableBeacon?: boolean;
    onunloadDisableFetch?: boolean;
    overridePageViewDuration?: boolean;
    samplingPercentage?: number;
    sdkExtension?: string;
    sessionCookiePostfix?: string;
    sessionExpirationMs?: number;
    sessionRenewalMs?: number;
    throttleMgrCfg?: {
        [key: number]: IThrottleMgrConfig;
    };
    url?: string;
    userCookiePostfix?: string;
    userOverrideEndpointUrl?: string;
}

Properties

accountId?: string

An optional account id, if your app groups users into accounts. No spaces, commas, semicolons, equals, or vertical bars.

addIntEndpoints?: boolean

[Optional] Flag to indicate whether the internal looking endpoints should be automatically added to the excludeRequestFromAutoTrackingPatterns collection. (defaults to true). This flag exists as the provided regex is generic and may unexpectedly match a domain that should not be excluded.

addRequestContext?: ((requestContext?: IRequestContext) => ICustomProperties)

Provide a way to enrich dependencies logs with context at the beginning of api call. Default is undefined.

ajaxPerfLookupDelay?: number

The amount of time to wait before re-attempting to find the windows.performance timings for an ajax request, time is in milliseconds and is passed directly to setTimeout() Defaults to 25.

appId?: string

AppId is used for the correlation between AJAX dependencies happening on the client-side with the server-side requets. When Beacon API is enabled, it cannot be used automatically, but can be set manually in the configuration. Default is null

null
autoExceptionInstrumented?: boolean

Internal only

autoTrackPageVisitTime?: boolean

If true, on a pageview, the previous instrumented page's view time is tracked and sent as telemetry and a new timer is started for the current pageview. It is sent as a custom metric named PageVisitTime in milliseconds and is calculated via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less). Default is false.

autoUnhandledPromiseInstrumented?: boolean

Internal only

bufferOverride?: IStorageBuffer

If specified, overrides the storage & retrieval mechanism that is used to manage unsent telemetry.

convertUndefined?: any

Provide user an option to convert undefined field to user defined value.

cookieDomain?: string

Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.

""
cookiePath?: string

Custom cookie path. This is helpful if you want to share Application Insights cookies behind an application gateway.

""
correlationHeaderDomains?: string[]
correlationHeaderExcludedDomains?: string[]

Disable correlation headers for specific domain

correlationHeaderExcludePatterns?: RegExp[]

Disable correlation headers using regular expressions

customHeaders?: [{
    header: string;
    value: string;
}]

The ability for the user to provide extra headers

disableAjaxTracking?: boolean

If true, Ajax calls are not autocollected. Default is false

false
disableCookiesUsage?: boolean

If true, the SDK will not store or read any data from cookies. Default is false. If you have also specified a cookieCfg then enabled property (if specified) will take precedent over this value.

false
disableCorrelationHeaders?: boolean

If false, the SDK will add two headers ('Request-Id' and 'Request-Context') to all dependency requests to correlate them with corresponding requests on the server side. Default is false.

false
disableDataLossAnalysis?: boolean

If false, internal telemetry sender buffers will be checked at startup for items not yet sent. Default is true

true
disableExceptionTracking?: boolean

If true, exceptions are not autocollected. Default is false

false
disableFetchTracking?: boolean

If true, Fetch requests are not autocollected. Default is false (Since 2.8.0, previously true).

false
disableFlushOnBeforeUnload?: boolean

Default false. If true, flush method will not be called when onBeforeUnload, onUnload, onPageHide or onVisibilityChange (hidden state) event(s) trigger.

disableFlushOnUnload?: boolean

Default value of disableFlushOnBeforeUnload. If true, flush method will not be called when onPageHide or onVisibilityChange (hidden state) event(s) trigger.

disableIkeyDeprecationMessage?: boolean

[Optional] Disable iKey deprecation error message.

true
disableTelemetry?: boolean

If true, telemetry is not collected or sent. Default is false

false
disableUserInitMessage?: boolean

[Optional] Sets to true if user wants to disable sending internal log message 'SendBrowserInfoOnUserInit' default to be false for versions 2.8.x and 3.0.x, true for versions 3.1.x and later

disableXhr?: boolean

Don't use XMLHttpRequest or XDomainRequest (for IE < 9) by default instead attempt to use fetch() or sendBeacon. If no other transport is available it will still use XMLHttpRequest

distributedTracingMode?: number

Sets the distributed tracing mode. If AI_AND_W3C mode or W3C mode is set, W3C trace context headers (traceparent/tracestate) will be generated and included in all outgoing requests. AI_AND_W3C is provided for back-compatibility with any legacy Application Insights instrumented services

AI_AND_W3C
emitLineDelimitedJson?: boolean

The JSON format (normal vs line delimited). True means line delimited JSON.

enableAjaxErrorStatusText?: boolean

An optional value that will track Response Error data through trackDependency function.

false
enableAjaxPerfTracking?: boolean

Flag to enable looking up and including additional browser window.performance timings in the reported ajax (XHR and fetch) reported metrics. Defaults to false.

enableAutoRouteTracking?: boolean

Automatically track route changes in Single Page Applications (SPA). If true, each route change will send a new Pageview to Application Insights.

enableCorsCorrelation?: boolean

If true, the SDK will add two headers ('Request-Id' and 'Request-Context') to all CORS requests to correlate outgoing AJAX dependencies with corresponding requests on the server side. Default is false

false
enableDebug?: boolean

If true, debugging data is thrown as an exception by the logger. Default false

false
enableRequestHeaderTracking?: boolean

An optional value that will track Request Header through trackDependency function.

false
enableResponseHeaderTracking?: boolean

An optional value that will track Response Header through trackDependency function.

false
enableSessionStorageBuffer?: boolean

If true, the buffer with all unsent telemetry is stored in session storage. The buffer is restored on page load. Default is true.

true
enableUnhandledPromiseRejectionTracking?: boolean

Default false. Define whether to track unhandled promise rejections and report as JS errors. When disableExceptionTracking is enabled (dont track exceptions) this value will be false.

false
eventsLimitInMem?: number

[Optional] The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.

excludeRequestFromAutoTrackingPatterns?: string[] | RegExp[]

Provide a way to exclude specific route from automatic tracking for XMLHttpRequest or Fetch request. For an ajax / fetch request that the request url matches with the regex patterns, auto tracking is turned off.

undefined.
isBeaconApiDisabled?: boolean

If false, the SDK will send all telemetry using the Beacon API.

true
isBrowserLinkTrackingEnabled?: boolean

Default is false. If true, the SDK will track all Browser Link requests.

false
isCookieUseDisabled?: boolean

Use either disableCookiesUsage or specify a cookieCfg with the enabled value set. If true, the SDK will not store or read any data from cookies. Default is false. As this field is being deprecated, when both isCookieUseDisabled and disableCookiesUsage are used disableCookiesUsage will take precedent.

false
isRetryDisabled?: boolean

Default false. If false, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error), 503 (service unavailable), and 0 (offline, only if detected)

false
isStorageUseDisabled?: boolean

If true, the SDK will not store or read any data from local and session storage. Default is false.

false
maxAjaxCallsPerView?: number

Default 500 - controls how many ajax calls will be monitored per page view. Set to -1 to monitor all (unlimited) ajax calls on the page.

maxAjaxPerfLookupAttempts?: number

The maximum number of times to look for the window.performance timings (if available), this is required as not all browsers populate the window.performance before reporting the end of the XHR request and for fetch requests this is added after its complete Defaults to 3

maxBatchInterval?: number

How long to batch telemetry for before sending (milliseconds)

15 seconds
maxBatchSizeInBytes?: number

Max size of telemetry batch. If batch exceeds limit, it is sent and a new batch is started

100000
namePrefix?: string

An optional value that will be used as name postfix for localStorage and session cookie name.

null
onunloadDisableBeacon?: boolean

Default false. when tab is closed, the SDK will send all remaining telemetry using the Beacon API

false
onunloadDisableFetch?: boolean

If fetch keepalive is supported do not use it for sending events during unload, it may still fallback to fetch() without keepalive

overridePageViewDuration?: boolean

If true, default behavior of trackPageView is changed to record end of page view duration interval when trackPageView is called. If false and no custom duration is provided to trackPageView, the page view performance is calculated using the navigation timing API. Default is false

false
samplingPercentage?: number

Percentage of events that will be sent. Default is 100, meaning all events are sent.

100
sdkExtension?: string

Sets the sdk extension name. Only alphabetic characters are allowed. The extension name is added as a prefix to the 'ai.internal.sdkVersion' tag (e.g. 'ext_javascript:2.0.0'). Default is null.

null
sessionCookiePostfix?: string

An optional value that will be used as name postfix for session cookie name. If undefined, namePrefix is used as name postfix for session cookie name.

null
sessionExpirationMs?: number

A session is logged if it has continued for this amount of time in milliseconds. Default 24h.

24*60*60*1000
sessionRenewalMs?: number

A session is logged if the user is inactive for this amount of time in milliseconds. Default 30 mins.

30*60*1000
throttleMgrCfg?: {
    [key: number]: IThrottleMgrConfig;
}

[Optional] Sets throttle mgr configuration by key

url?: string

Used when initizialing from snippet only. The url from where the JS SDK will be downloaded.

userCookiePostfix?: string

An optional value that will be used as name postfix for user cookie name. If undefined, no postfix is added on user cookie name.

null
userOverrideEndpointUrl?: string

[Optional] Specifies a Highest Priority custom endpoint URL where telemetry data will be sent. This URL takes precedence over the 'config.endpointUrl' and any endpoint in the connection string.