Configuration interface specifically for AnalyticsPlugin This interface defines only the configuration properties that the Analytics plugin uses.

interface IAnalyticsConfig {
    autoTrackPageVisitTime?: boolean;
    disableExceptionTracking?: boolean;
    disableFlushOnBeforeUnload?: boolean;
    disableFlushOnUnload?: boolean;
    enableAutoRouteTracking?: boolean;
    enableDebug?: boolean;
    enableUnhandledPromiseRejectionTracking?: boolean;
    expCfg?: IExceptionConfig;
    isBrowserLinkTrackingEnabled?: boolean;
    isStorageUseDisabled?: boolean;
    namePrefix?: string;
    overridePageViewDuration?: boolean;
    routeTraceStrategy?: eRouteTraceStrategy;
    samplingPercentage?: number;
    sessionExpirationMs?: number;
    sessionRenewalMs?: number;
}

Properties

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.

false
disableExceptionTracking?: boolean

If true, exceptions are not autocollected.

false
disableFlushOnBeforeUnload?: boolean

If true, flush method will not be called when onBeforeUnload event triggers.

false
disableFlushOnUnload?: boolean

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

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.

false
enableDebug?: boolean

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

false
enableUnhandledPromiseRejectionTracking?: boolean

Define whether to track unhandled promise rejections and report as JS errors.

false
expCfg?: IExceptionConfig

Exception configuration for additional exception handling options.

{ inclScripts: false, expLog: undefined, maxLogs: 50 }
isBrowserLinkTrackingEnabled?: boolean

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

false
isStorageUseDisabled?: boolean

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

false
namePrefix?: string

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

""
"MyApp" // Results in localStorage keys like "ai_session_MyApp"
overridePageViewDuration?: boolean

If true, default behavior of trackPageView is changed to record end of page view duration interval when trackPageView is called.

false
routeTraceStrategy?: eRouteTraceStrategy

Controls the trace context strategy for SPA route changes. Determines how trace contexts are managed and correlated across virtual page views in Single Page Applications, affecting telemetry correlation and operation tracking.

eRouteTraceStrategy.Server

3.4.0

samplingPercentage?: number

Percentage of events that will be sent. Value must be between 0 and 100.

100
50 // Only send 50% of events
sessionExpirationMs?: number

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

86400000 (24 hours)
sessionRenewalMs?: number

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

1800000 (30 minutes)