ReadonlyappReadonlyconfigAccess to the Dynamic Configuration for the current instance
ReadonlycontextReadonlycoreReadonlypluginThe formatted string of the installed plugins that contain a version number
ReadonlypluginAn array of the installed plugins that provide a version
Manually send uncaught exception telemetry. This method is automatically triggered on a window.onerror event.
The exception to be sent.
Add an dependency telemetry initializer callback function to allow populating additional properties or drop the request.
It is called after the dependency call has completed and any available performance details are available. A dependency
initializer is similar to the TelemetryInitializer function but it allows you to block the reporting of the dependency
request so that it doesn't count against the maxAjaxCallsPerView.
The Dependency Telemetry Initializer function
Add an ajax listener which is called just prior to the request being sent and before the correlation headers are added, to allow you to access the headers and modify the values used to generate the distributed tracing correlation headers. (added in v2.8.4)
The Telemetry Initializer function
Add a new plugin to the installation
The new plugin to add
OptionalreplaceExisting: booleanshould any existing plugin be replaced, default is false
OptionaldoAsync: booleanShould the add be performed asynchronously
OptionaladdCb: ((added?: boolean) => void)[Optional] callback to call after the plugin has been added
Optionaladded: booleanAttempt 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
Optionalasync: booleansend 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.
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.Find and return the (first) plugin with the specified identifier if present
Initialize this instance of ApplicationInsights
MUST always be false, it is no longer supported from v3.x onwards
Optionallogger: IDiagnosticLoggerOptionalnotificationManager: INotificationManagerWatches and tracks changes for accesses to the current config, and if the accessed config changes the handler will be recalled.
The handler to call when the config changes
A watcher handler instance that can be used to remove itself when being unloaded
Set the authenticated user id and the account id. Used for identifying a specific signed-in user. Parameters must not contain whitespace or ,;=|
The method will only set the authenticatedUserId and accountId in the current page view. To set them for the whole session, you should set storeInCookie = true
The account ID to set
OptionalaccountId: stringThe account ID to set
Whether the values should be set for the whole session
Starts the timer for tracking a page load time. Use this instead of trackPageView if you want to control when the page view timer starts and stops,
but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call stopTrackPage to log the end of the page view
and send the event.
Optionalname: stringA string that idenfities this item, unique within this HTML document. Defaults to the document title.
Log an extended event that you started timing with startTrackEvent.
The string you used to identify this event in startTrackEvent.
Optionalproperties: { map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
Optionalmeasurements: { map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
Stops the timer that was started by calling startTrackPage and sends the pageview load time telemetry with the specified properties and measurements.
The duration of the page view will be the time between calling startTrackPage and stopTrackPage.
Optionalname: stringThe string you used as the name in startTrackPage. Defaults to the document title.
Optionalurl: stringa relative or absolute URL that identifies the page or other item. Defaults to the window location.
Optionalproperties: { additional data used to filter pages and metrics in the portal. Defaults to empty.
Optionalmeasurements: { metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
Log a dependency call (e.g. ajax)
Log a user action or other occurrence.
event to be sent
OptionalcustomProperties: ICustomPropertiesproperties that would be included as part of the event
Log an exception that you have caught.
exception to be sent
OptionalcustomProperties: ICustomPropertiesAdditional data used to filter pages and metrics in the portal. Defaults to empty.
Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
To send a single measurement, just use the name and average fields
of IMetricTelemetry.
If you take measurements frequently, you can reduce the telemetry bandwidth by
aggregating multiple measurements and sending the resulting average and modifying
the sampleCount field of IMetricTelemetry.
input object argument. Only name and average are mandatory.
OptionalcustomProperties: ICustomPropertiesAdditional custom properties to include in the event.
Logs that a page, or similar container was displayed to the user.
OptionalpageView: IPageViewTelemetrypage view to be sent
Log a bag of performance information via the customProperties field.
performance information to be sent
Log a diagnostic scenario such entering or leaving a function.
trace to be sent
OptionalcustomProperties: ICustomPropertiesAdditional custom properties to include in the event.
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 and do not provide
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
OptionalisAsync: booleanCan the unload be performed asynchronously (default)
OptionalunloadComplete: ((unloadState: ITelemetryUnloadState) => void)An optional callback that will be called once the unload has completed
OptionalcbTimeout: numberAn optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
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
The new configuration is apply
OptionalmergeExisting: booleanShould the new configuration merge with the existing or just replace it. Default is to merge.
Overwrite the lazy loaded fields of global window snippet to contain the actual initialized API methods
The global snippet
Application Insights API