interface IApplicationInsights {
    _onerror(exception: IAutoExceptionTelemetry): void;
    addDependencyListener(dependencyListener: DependencyListenerFunction): IDependencyListenerHandler;
    addPlugin<T>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: ((added?: boolean) => void)): void;
    addTelemetryInitializer(telemetryInitializer: ((item: ITelemetryItem) => boolean | void)): void;
    addUnloadCb(handler: UnloadHandler): void;
    appInsights: AnalyticsPlugin;
    clearAuthenticatedUserContext(): void;
    context: ITelemetryContext;
    evtNamespace(): string;
    flush: ((async?: boolean, callBack?: (() => void)) => void | IPromise<void>);
    getCookieMgr(): ICookieMgr;
    getPlugin<T>(pluginIdentifier: string): ILoadedPlugin<T>;
    getSender: (() => Sender);
    onunloadFlush: ((async?: boolean) => void);
    setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie?: boolean): void;
    startTrackEvent(name: string): void;
    startTrackPage(name?: string): void;
    stopTrackEvent(name: string, properties?: {
        [key: string]: string;
    }, measurements?: {
        [key: string]: number;
    }): void;
    stopTrackPage(name?: string, url?: string, properties?: {
        [key: string]: string;
    }, measurements?: {
        [key: string]: number;
    }): void;
    trackDependencyData(dependency: IDependencyTelemetry): void;
    trackEvent(event: IEventTelemetry, customProperties?: {
        [key: string]: any;
    }): void;
    trackException(exception: IExceptionTelemetry, customProperties?: {
        [key: string]: any;
    }): void;
    trackMetric(metric: IMetricTelemetry, customProperties?: {
        [key: string]: any;
    }): void;
    trackPageView(pageView: IPageViewTelemetry, customProperties?: {
        [key: string]: any;
    }): void;
    trackPageViewPerformance(pageViewPerformance: IPageViewPerformanceTelemetry, customProperties?: {
        [key: string]: any;
    }): void;
    trackTrace(trace: ITraceTelemetry, customProperties?: {
        [key: string]: any;
    }): void;
    unload(isAsync?: boolean, unloadComplete?: ((unloadState: ITelemetryUnloadState) => void), cbTimeout?: number): void | IPromise<ITelemetryUnloadState>;
    updateCfg<T>(newConfig: T, mergeExisting?: boolean): void;
}

Hierarchy (view full)

Implemented by

Properties

appInsights: AnalyticsPlugin
context: ITelemetryContext
flush: ((async?: boolean, callBack?: (() => void)) => void | IPromise<void>)

Attempt to flush data immediately; If executing asynchronously (the default) and you DO NOT pass a callback function then a IPromise will be returned which will resolve once the flush is complete. The actual implementation of the IPromise will be a native Promise (if supported) or the default as supplied by ts-async library

Type declaration

    • (async?, callBack?): void | IPromise<void>
    • Parameters

      • Optionalasync: boolean

        send data asynchronously when true

      • OptionalcallBack: (() => void)

        if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called. If the caller doesn't return true the caller should assume that it may never be called.

          • (): void
          • Returns void

      Returns void | IPromise<void>

      • If a callback is provided true to indicate that callback will be called after the flush is complete otherwise the caller should assume that any provided callback will never be called, Nothing or if occurring asynchronously a IPromise which will be resolved once the unload is complete, the IPromise will only be returned when no callback is provided and async is true.
getSender: (() => Sender)
onunloadFlush: ((async?: boolean) => void)

Methods

  • Add an ajax listener which is called just prior to the request being sent and before the correlation headers are added. This allows you to access the headers and modify the values used to generate the distributed tracing correlation headers (added in v2.8.4), or to drop the correlation (added in v3.3.7).

    Parameters

    Returns IDependencyListenerHandler

    • A IDependencyListenerHandler to enable the initializer to be removed
  • Add a new plugin to the installation

    Type Parameters

    Parameters

    • plugin: T

      The new plugin to add

    • replaceExisting: boolean

      should any existing plugin be replaced

    • doAsync: boolean

      Should the add be performed asynchronously

    • OptionaladdCb: ((added?: boolean) => void)
        • (added?): void
        • Parameters

          • Optionaladded: boolean

          Returns void

    Returns void

  • Parameters

    Returns void

  • Add a handler that will be called when the SDK is being unloaded

    Parameters

    • handler: UnloadHandler

      the handler

    Returns void

  • Returns the unique event namespace that should be used when registering events

    Returns string

  • Get the current cookie manager for this instance

    Returns ICookieMgr

  • Parameters

    • authenticatedUserId: string
    • OptionalaccountId: string
    • OptionalstoreInCookie: boolean

    Returns void

  • Parameters

    • name: string

    Returns void

  • Parameters

    • Optionalname: string

    Returns void

  • Parameters

    • name: string
    • Optionalproperties: {
          [key: string]: string;
      }
      • [key: string]: string
    • Optionalmeasurements: {
          [key: string]: number;
      }
      • [key: string]: number

    Returns void

  • Parameters

    • Optionalname: string
    • Optionalurl: string
    • Optionalproperties: {
          [key: string]: string;
      }
      • [key: string]: string
    • Optionalmeasurements: {
          [key: string]: number;
      }
      • [key: string]: number

    Returns void

  • Parameters

    • event: IEventTelemetry
    • OptionalcustomProperties: {
          [key: string]: any;
      }
      • [key: string]: any

    Returns void

  • Parameters

    • exception: IExceptionTelemetry
    • OptionalcustomProperties: {
          [key: string]: any;
      }
      • [key: string]: any

    Returns void

  • Parameters

    • metric: IMetricTelemetry
    • OptionalcustomProperties: {
          [key: string]: any;
      }
      • [key: string]: any

    Returns void

  • Parameters

    • pageView: IPageViewTelemetry
    • OptionalcustomProperties: {
          [key: string]: any;
      }
      • [key: string]: any

    Returns void

  • Parameters

    Returns void

  • Parameters

    • trace: ITraceTelemetry
    • OptionalcustomProperties: {
          [key: string]: any;
      }
      • [key: string]: any

    Returns void

  • Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous unload call return true stating that all plugins reported that they also unloaded, the recommended approach is to create a new instance and initialize that instance. This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable to successfully remove any global references or they may just be completing the unload process asynchronously. If you pass isAsync as true (also the default) and DO NOT pass a callback function then an IPromise will be returned which will resolve once the unload is complete. The actual implementation of the IPromise will be a native Promise (if supported) or the default as supplied by ts-async library

    Parameters

    • OptionalisAsync: boolean

      Can the unload be performed asynchronously (default)

    • OptionalunloadComplete: ((unloadState: ITelemetryUnloadState) => void)

      An optional callback that will be called once the unload has completed

        • (unloadState): void
        • Parameters

          • unloadState: ITelemetryUnloadState

          Returns void

    • OptionalcbTimeout: number

      An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.

    Returns void | IPromise<ITelemetryUnloadState>

    Nothing or if occurring asynchronously a IPromise which will be resolved once the unload is complete, the IPromise will only be returned when no callback is provided and isAsync is true

  • Update the configuration used and broadcast the changes to all loaded plugins, this does NOT support updating, adding or removing any the plugins. It will notify (if supported) that the configuration has changed but it will not remove or add any new plugins

    Type Parameters

    Parameters

    • newConfig: T

      The new configuration is apply

    • OptionalmergeExisting: boolean

      Should the new configuration merge with the existing or just replace it. Default is to merge.

    Returns void