Applicationinsights web

Applicationinsights web DEFAULT

NuGet packages (57)

Showing the top 5 NuGet packages that depend on Microsoft.ApplicationInsights.Web:


Nuget Package for Ingeniux Dynamic Site Server Runtime API


Platform host.


This package integrates Application Insights with Glimpse for .NET web applications. Glimpse is a web debugging and diagnostics tool used to gain a better understanding of whats happening inside of your ASP.NET + application. Applications Insights is a service that allows developers to monitor performance, availability, and usage of their applications.


Common Four Roads Telligent Libraries -IncludeReferencedProjects


Web API MVC 5 Application with auto update implementation via self-package as NuGet package

GitHub repositories (51)

Showing the top 5 popular GitHub repositories that depend on Microsoft.ApplicationInsights.Web:


Experience, Learn and Code the latest breakthrough innovations with Microsoft AI


The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.


Windows Application Driver


SharePoint / Office Developer Patterns and Practices - Archived older solutions. Please see for updated guidance


NuGet Gallery is a package repository that powers Use this repo for reporting issues.

VersionDownloadsLast updated
, 7/28/
beta3 1, 7/2/
beta2 1, 6/4/
beta1 5/7/
, 2/18/
beta1 3, 12/18/
, 11/11/
beta1 10/23/
, 9/15/
beta3 9/8/
beta2 3, 6/16/
beta1 5, 4/30/
1,, 4/24/
beta5 1, 4/8/
beta3 4, 3/6/
beta2 4, 2/22/
beta1 2/21/
1,, 2/22/
27, 2/19/
beta2 2, 2/5/
beta1 13, 1/11/
14, 2/22/
, 1/28/
, 12/9/
beta4 2, 11/22/
beta3 11/20/
beta2 11/15/
beta1 4, 10/18/
, 10/16/
, 10/8/
, 9/23/
beta2 1, 9/16/
beta1 12, 7/12/
1,, 5/29/
beta4 2, 5/1/
beta3 6, 4/1/
beta2 7, 2/20/
2,, 2/8/
2,, 1/31/
beta3 9, 1/9/
beta2 60, 11/29/
2,, 10/19/
, 10/11/
beta2 3, 9/25/
beta1 20, 8/16/
1,, 8/10/
, 8/7/
beta4 5, 7/20/
beta3 3, 7/12/
beta2 21, 6/19/
beta1 5, 6/7/
1,, 5/23/
, 5/10/
beta4 9, 4/19/
beta3 3, 4/11/
beta2 14, 3/12/
3,, 2/23/
, 2/9/
beta2 12, 12/19/
beta1 24, 11/2/
4,, 7/8/
1,, 6/30/
beta5 9, 6/19/
beta4 13, 6/1/
beta3 14, 5/10/
beta2 2, 4/29/
beta1 1, 4/21/
1,, 4/10/
beta3 9, 3/18/
beta2 12, 2/9/
beta1 17, 12/21/
7,, 12/8/
beta6 7, 12/2/
beta4 9, 11/18/
beta2 50, 9/28/
beta1 24, 7/18/
2,, 6/15/
beta4 28, 4/28/
beta3 9, 4/18/
beta2 18, 3/29/
1,, 3/14/
rc1 9, 2/18/
beta4 4, 1/12/
beta3 6, 11/24/
beta1 1, 10/5/
1,, 11/4/
, 8/7/
94, 7/7/
, 6/23/
70, 5/22/
build 47, 5/1/
build 8, 4/21/
build 52, 3/27/
build 8, 3/12/
build 92, 2/18/
build 1, 2/16/
build 23, 2/4/
build 99, 12/4/
build 54, 11/3/
build 23, 10/16/
build 49, 8/27/
build 27, 6/27/


&#; Microsoft Corporation. All rights reserved.

Share this package on FacebookTweet this packageUse the Atom feed to subscribe to new versions of Microsoft.ApplicationInsights.Web

trackException Change

This update has a couple of non-breaking API changes. Namely, is now consistent with the Node.js SDK. The only change here is the named argument is renamed from to . A shim is in place so any existing usages of will still work, and the old field is marked as optional, so any type-checked files will still "compile". There are no breaking changes with this change, but you are encouraged to use as your named argument field as error will be deprecated in a future major version.

Old New Correlation Header Domain Whitelisting #

Second, the ability to only send correlation headers to specific, whitelisted domains is now available as a configuration option , . It accepts an of domain . Wildcards ("*") are okay. By populating this array, all other domains which your application makes requests to will not have correlation headers included. This setting makes it easy to avoid OPTIONS requests to services outside of your control.

You can use the inclusion list and the exclusion list in conjunction with each other to add correlation headers to a particular domain, , and at the same time exclude headers from a prefixed version of it, .

Tag Override Change #

Performing custom tag overrides is now more consistent with all of the other Application Insights SDKs, in that it is modified via a simple key-value dictionary. There are no breaking changes with this update, and if you are setting any tags via the old way, they will still work as they do now. You are encouraged to update them since the old way will be deprecated in a future major version release.

Old New Changelog

# - config: add ability to whitelist specific domains for adding correlation headers # - docs: fix sample configuration settings # - common: replace Array.some with Array.forEach to simplify polyfill story, add tests # - snippet: add missing methods to lazy loaders # - tags can now be set with same API as other AI SDKs # - rename IExceptionTelemetry.error --> IExceptionTelemetry.exception # - react: fix plugin causing jest tests to fail # - docs: add mention of how to update current context's operation # - react: remove analytics package dependency # - docs: update context refresh information # - Remove code from adding libVer from extensions # - automatically add tag, add to pageview telemetry # - fix issue with not affecting send buffers

  1. Urdu poetry image
  2. Fabric flower wall
  3. Farmhouse toaster cover

Configure Application Insights for your ASP.NET website

This procedure configures your ASP.NET web app to send telemetry to the Application Insights feature of the Azure Monitor service. It works for ASP.NET apps that are hosted either in your own IIS servers on-premises or in the cloud.


To add Application Insights to your ASP.NET website, you need to:


We recommend connection strings over instrumentation keys. New Azure regions require the use of connection strings instead of instrumentation keys.

A connection string identifies the resource that you want to associate with your telemetry data. It also allows you to modify the endpoints that your resource will use as a destination for your telemetry. You'll need to copy the connection string and add it to your application's code or to an environment variable.

Create a basic ASP.NET web app

  1. Open Visual Studio
  2. Select File > New > Project.
  3. Select ASP.NET Web Application(.NET Framework) C#.
  4. Enter a project name, and then select Create.
  5. Select MVC > Create.

Add Application Insights automatically

This section will guide you through automatically adding Application Insights to a template-based ASP.NET web app. From within your ASP.NET web app project in Visual Studio:

  1. Select Project > Add Application Insights Telemetry > Application Insights Sdk (local) > Next > Finish > Close.

  2. Open the ApplicationInsights.config file.

  3. Before the closing tag, add a line that contains the instrumentation key for your Application Insights resource. You can find your instrumentation key on the overview pane of the newly created Application Insights resource that you created as part of the prerequisites for this article.

  4. Select Project > Manage NuGet Packages > Updates. Then update each NuGet package to the latest stable release.

  5. Run your application by selecting IIS Express. A basic ASP.NET app opens. As you browse through the pages on the site, telemetry will be sent to Application Insights.

Add Application Insights manually

This section will guide you through manually adding Application Insights to a template-based ASP.NET web app. This section assumes that you're using a web app based on the standard MVC web app template for the ASP.NET Framework.

  1. Add the following NuGet packages and their dependencies to your project:

  2. In some cases, the ApplicationInsights.config file is created for you automatically. If the file is already present, skip to step 4.

    If it's not created automatically, you'll need to create it yourself. At the same level in your project as the Global.asax file, create a new file called ApplicationInsights.config.

  3. Copy the following XML configuration into your newly created file:

  4. Before the closing tag, add your instrumentation key for your Application Insights resource. You can find your instrumentation key on the overview pane of the newly created Application Insights resource that you created as part of the prerequisites for this article.

  5. At the same level of your project as the ApplicationInsights.config file, create a folder called ErrorHandler with a new C# file called AiHandleErrorAttribute.cs. The contents of the file will look like this:

  6. In the App_Start folder, open the FilterConfig.cs file and change it to match the sample:

  7. If Web.config is already updated, skip this step. Otherwise, update the file as follows:

You have now successfully configured server-side application monitoring. If you run your web app, you'll see telemetry begin to appear in Application Insights.

The previous sections provided guidance on methods to automatically and manually configure server-side monitoring. To add client-side monitoring, use the client-side JavaScript SDK. You can monitor any web page's client-side transactions by adding a JavaScript snippet before the closing tag of the page's HTML.

Although it's possible to manually add the snippet to the header of each HTML page, we recommend that you instead add the snippet to a primary page. That action will inject the snippet into all pages of a site.

For the template-based ASP.NET MVC app from this article, the file that you need to edit is _Layout.cshtml. You can find it under Views > Shared. To add client-side monitoring, open _Layout.cshtml and follow the snippet-based setup instructions from the article about client-side JavaScript SDK configuration.


There's a known issue in the current version of Visual Studio storing the instrumentation key in a user secret is broken for .NET Framework-based apps. The key ultimately has to be hardcoded into the applicationinsights.config file to work around this bug. This article is designed to avoid this issue entirely, by not using user secrets.

Open-source SDK

Read and contribute to the code.

For the latest updates and bug fixes, consult the release notes.

Next steps


View all page feedback

Monitorando Web Apps com o Application Insights, Logic Apps e o Slack

Application Insights for web pages

Find out about the performance and usage of your web page or app. If you add Application Insights to your page script, you get timings of page loads and AJAX calls, counts, and details of browser exceptions and AJAX failures, as well as users and session counts. All these can be segmented by page, client OS and browser version, geo location, and other dimensions. You can set alerts on failure counts or slow page loading. And by inserting trace calls in your JavaScript code, you can track how the different features of your web page application are used.

Application Insights can be used with any web pages - you just add a short piece of JavaScript. If your web service is Java or ASP.NET, you can use the server-side SDKs in conjunction with the client-side JavaScript SDK to get an end-to-end understanding of your app's performance.

Adding the JavaScript SDK


Connection Strings are recommended over instrumentation keys. New Azure regions require the use of connection strings instead of instrumentation keys. Connection string identifies the resource that you want to associate your telemetry data with. It also allows you to modify the endpoints your resource will use as a destination for your telemetry. You will need to copy the connection string and add it to your application's code or to an environment variable.

  1. First you need an Application Insights resource. If you don't already have a resource and instrumentation key, follow the create a new resource instructions.
  2. Copy the instrumentation key (also known as "iKey") or connection string for the resource where you want your JavaScript telemetry to be sent (from step 1.) You will add it to the or setting of the Application Insights JavaScript SDK.
  3. Add the Application Insights JavaScript SDK to your web page or app via one of the following two options:


Only use one method to add the JavaScript SDK to your application. If you use the NPM Setup, don't use the Snippet and vice versa.


NPM Setup installs the JavaScript SDK as a dependency to your project, enabling IntelliSense, whereas the Snippet fetches the SDK at runtime. Both support the same features. However, developers who desire more custom events and configuration generally opt for NPM Setup whereas users looking for quick enablement of out-of-the-box web analytics opt for the Snippet.

npm based setup

Install via NPM.


Typings are included with this package, so you do not need to install a separate typings package.

Snippet based setup

If your app does not use npm, you can directly instrument your webpages with Application Insights by pasting this snippet at the top of each your pages. Preferably, it should be the first script in your section so that it can monitor any potential issues with all of your dependencies and optionally any JavaScript errors. If you are using Blazor Server App, add the snippet at the top of the file in the section.

To assist with tracking which version of the snippet your application is using, starting from version the page view event will include a new tag "ai.internal.snippet" that will contain the identified snippet version.

The current Snippet (listed below) is version "5", the version is encoded in the snippet as sv:"#" and the current version is also available on GitHub.


For readability and to reduce possible JavaScript errors, all of the possible configuration options are listed on a new line in snippet code above, if you don't want to change the value of a commented line it can be removed.

Reporting Script load failures

This version of the snippet detects and reports failures when loading the SDK from the CDN as an exception to the Azure Monitor portal (under the failures > exceptions > browser), this exception provides visibility into failures of this type so that you are aware that your application is not reporting telemetry (or other exceptions) as expected. This signal is an important measurement in understanding that you have lost telemetry because the SDK did not load or initialize which can lead to:

  • Under-reporting of how users are using (or trying to use) your site;
  • Missing telemetry on how your end users are using your site;
  • Missing JavaScript errors that could potentially be blocking your end users from successfully using your site.

For details on this exception see the SDK load failure troubleshooting page.

Reporting of this failure as an exception to the portal does not use the configuration option from the application insights configuration and therefore if this failure occurs it will always be reported by the snippet, even when the window.onerror support is disabled.

Reporting of SDK load failures is specifically NOT supported on IE 8 (or less). This assists with reducing the minified size of the snippet by assuming that most environments are not exclusively IE 8 or less. If you have this requirement and you wish to receive these exceptions, you will need to either include a fetch poly fill or create you own snippet version that uses instead of , it is recommended that you use the provided snippet source code as a starting point.


If you are using a previous version of the snippet, it is highly recommended that you update to the latest version so that you will receive these previously unreported issues.

Snippet configuration options

All configuration options have now been move towards the end of the script to help avoid accidentally introducing JavaScript errors that would not just cause the SDK to fail to load, but also it would disable the reporting of the failure.

Each configuration option is shown above on a new line, if you don't wish to override the default value of an item listed as [optional] you can remove that line to minimize the resulting size of your returned page.

The available configuration options are

srcstring [required]The full URL for where to load the SDK from. This value is used for the "src" attribute of a dynamically added <script /> tag. You can use the public CDN location or your own privately hosted one.
namestring [optional]The global name for the initialized SDK, defaults to . So will be a reference to the initialized instance. Note: if you provide a name value or a previous instance appears to be assigned (via the global name appInsightsSDK) then this name value will also be defined in the global namespace as , this is required by the SDK initialization code to ensure it's initializing and updating the correct snippet skeleton and proxy methods.
ldnumber in ms [optional]Defines the load delay to wait before attempting to load the SDK. Default value is 0ms and any negative value will immediately add a script tag to the <head> region of the page, which will then block the page load event until to script is loaded (or fails).
useXhrboolean [optional]This setting is used only for reporting SDK load failures. Reporting will first attempt to use fetch() if available and then fallback to XHR, setting this value to true just bypasses the fetch check. Use of this value is only be required if your application is being used in an environment where fetch would fail to send the failure events.
crossOriginstring [optional]By including this setting, the script tag added to download the SDK will include the crossOrigin attribute with this string value. When not defined (the default) no crossOrigin attribute is added. Recommended values are not defined (the default); ""; or "anonymous" (For all valid values see HTML attribute: documentation)
cfgobject [required]The configuration passed to the Application Insights SDK during initialization.

Connection String Setup

For either the NPM or Snippet setup, you can also configure your instance of Application Insights using a Connection String. Simply replace the field with the field.

Sending telemetry to the Azure portal

By default the Application Insights JavaScript SDK autocollects a number of telemetry items that are helpful in determining the health of your application and the underlying user experience. These include:

  • Uncaught exceptions in your app, including information on
    • Stack trace
    • Exception details and message accompanying the error
    • Line & column number of error
    • URL where error was raised
  • Network Dependency Requests made by your app XHR and Fetch (fetch collection is disabled by default) requests, include information on
    • Url of dependency source
    • Command & Method used to request the dependency
    • Duration of the request
    • Result code and success status of the request
    • ID (if any) of user making the request
    • Correlation context (if any) where request is made
  • User information (for example, Location, network, IP)
  • Device information (for example, Browser, OS, version, language, model)
  • Session information

Telemetry initializers

Telemetry initializers are used to modify the contents of collected telemetry before being sent from the user's browser. They can also be used to prevent certain telemetry from being sent, by returning . Multiple telemetry initializers can be added to your Application Insights instance, and they are executed in order of adding them.

The input argument to is a callback that takes a as an argument and returns a or . If returning , the telemetry item is not sent, else it proceeds to the next telemetry initializer, if any, or is sent to the telemetry collection endpoint.

An example of using telemetry initializers:


Most configuration fields are named such that they can be defaulted to false. All fields are optional except for .

Instrumentation key that you obtained from the Azure portal.
accountIdAn optional account ID, if your app groups users into accounts. No spaces, commas, semicolons, equals, or vertical barsstring
sessionRenewalMsA session is logged if the user is inactive for this amount of time in milliseconds.numeric

(30 mins)
sessionExpirationMsA session is logged if it has continued for this amount of time in milliseconds.numeric

(24 hours)
maxBatchSizeInBytesMax size of telemetry batch. If a batch exceeds this limit, it is immediately sent and a new batch is startednumeric
maxBatchIntervalHow long to batch telemetry for before sending (milliseconds)numeric
disable​ExceptionTrackingIf true, exceptions are not autocollected.boolean
disableTelemetryIf true, telemetry is not collected or sent.boolean
enableDebugIf true, internal debugging data is thrown as an exception instead of being logged, regardless of SDK logging settings. Default is false.
Note: Enabling this setting will result in dropped telemetry whenever an internal error occurs. This can be useful for quickly identifying issues with your configuration or usage of the SDK. If you do not want to lose telemetry while debugging, consider using or instead of .
loggingLevelConsoleLogs internal Application Insights errors to console.
0: off,
1: Critical errors only,
2: Everything (errors & warnings)
loggingLevelTelemetrySends internal Application Insights errors as telemetry.
0: off,
1: Critical errors only,
2: Everything (errors & warnings)
diagnosticLogInterval(internal) Polling interval (in ms) for internal logging queuenumeric
samplingPercentagePercentage of events that will be sent. Default is , meaning all events are sent. Set this if you wish to preserve your data cap for large-scale applications.numeric
autoTrackPageVisitTimeIf 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 in 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.boolean
disableAjaxTrackingIf true, Ajax calls are not autocollected.boolean
disableFetchTrackingIf true, Fetch requests are not autocollected.boolean
overridePageViewDurationIf 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.boolean
maxAjaxCallsPerViewDefault - controls how many Ajax calls will be monitored per page view. Set to -1 to monitor all (unlimited) Ajax calls on the page.numeric
disableDataLossAnalysisIf false, internal telemetry sender buffers will be checked at startup for items not yet sent.boolean
disable​CorrelationHeadersIf 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.boolean
correlationHeader​ExcludedDomainsDisable correlation headers for specific domainsstring[]
correlationHeader​ExcludePatternsDisable correlation headers using regular expressionsregex[]
correlationHeader​DomainsEnable correlation headers for specific domainsstring[]
disableFlush​OnBeforeUnloadIf true, flush method will not be called when onBeforeUnload event triggersboolean
enableSessionStorageBufferIf true, the buffer with all unsent telemetry is stored in session storage. The buffer is restored on page loadboolean
cookieCfgDefaults to cookie usage enabled see ICookieCfgConfig settings for full defaults.ICookieCfgConfig
(Since )

If true, the SDK will not store or read any data from cookies. Note that this disables the User and Session cookies and renders the usage blades and experiences useless. isCookieUseDisable is deprecated in favor of disableCookiesUsage, when both are provided disableCookiesUsage takes precedence.
(Since v) And if is also defined it will take precedence over these values, Cookie usage can be re-enabled after initialization via the core.getCookieMgr().setEnabled(true).
alias for
cookieDomainCustom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains.
(Since v) If is defined it will take precedence over this value.
alias for
cookiePathCustom cookie path. This is helpful if you want to share Application Insights cookies behind an application gateway.
If is defined it will take precedence over this value.
alias for
(Since )
isRetryDisabledIf false, retry on (partial success), (timeout), (too many requests), (internal server error), (service unavailable), and 0 (offline, only if detected)boolean
isStorageUseDisabledIf true, the SDK will not store or read any data from local and session storage.boolean
isBeaconApiDisabledIf false, the SDK will send all telemetry using the Beacon APIboolean
onunloadDisableBeaconWhen tab is closed, the SDK will send all remaining telemetry using the Beacon APIboolean
sdkExtensionSets the sdk extension name. Only alphabetic characters are allowed. The extension name is added as a prefix to the 'ai.internal.sdkVersion' tag (for example, 'ext_javascript').string
isBrowserLink​TrackingEnabledIf true, the SDK will track all Browser Link requests.boolean
appIdAppId is used for the correlation between AJAX dependencies happening on the client-side with the server-side requests. When Beacon API is enabled, it cannot be used automatically, but can be set manually in the configuration.string
enable​CorsCorrelationIf 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.boolean
namePrefixAn optional value that will be used as name postfix for localStorage and cookie name.string
enable​AutoRoute​TrackingAutomatically track route changes in Single Page Applications (SPA). If true, each route change will send a new Pageview to Application Insights. Hash route changes () are also recorded as new page views.boolean
enableRequest​HeaderTrackingIf true, AJAX & Fetch request headers is tracked.boolean
enableResponse​HeaderTrackingIf true, AJAX & Fetch request's response headers is tracked.boolean
distributedTracingModeSets 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. See example here.or
(Since v)
(v or earlier)
enable​AjaxErrorStatusTextIf true, include response error data text in dependency event on failed AJAX requests.boolean
enable​AjaxPerfTrackingFlag to enable looking up and including additional browser window.performance timings in the reported (XHR and fetch) reported metrics.boolean
maxAjaxPerf​LookupAttemptsThe 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.numeric
ajaxPerfLookupDelayThe amount of time to wait before re-attempting to find the window.performance timings for an request, time is in milliseconds and is passed directly to setTimeout().numeric
25 ms
enableUnhandled​PromiseRejection​TrackingIf true, unhandled promise rejections will be autocollected and reported as a JavaScript error. When disableExceptionTracking is true (don't track exceptions), the config value will be ignored and unhandled promise rejections will not be reported.boolean
disable​InstrumentationKey​ValidationIf true, instrumentation key validation check is bypassed.boolean
enablePerfMgrWhen enabled (true) this will create local perfEvents for code that has been instrumented to emit perfEvents (via the doPerf() helper). This can be used to identify performance issues within the SDK based on your usage or optionally within your own instrumented code. More details are available by the basic documentation. Since vboolean
perfEvtsSendAllWhen enablePerfMgr is enabled and the IPerfManager fires a INotificationManager.perfEvent() this flag determines whether an event is fired (and sent to all listeners) for all events (true) or only for 'parent' events (false <default>).
A parent IPerfEvent is an event where no other IPerfEvent is still running at the point of this event being created and it's parent property is not null or undefined. Since v
idLengthIdentifies the default length used to generate new random session and user id values. Defaults to 22, previous default value was 5 (v or less), if you need to keep the previous maximum length you should set this value to 5.numeric

Cookie Handling

From version , cookie management is now available directly from the instance and can be disabled and re-enabled after initialization.

If disabled during initialization via the or configurations, you can now re-enable via the ICookieMgr function.

The instance based cookie management also replaces the previous CoreUtils global functions of , , and . And to benefit from the tree-shaking enhancements also introduced as part of version you should no longer uses the global functions.


Cookie Configuration for instance based cookie management added in version

NameDescriptionType and Default
enabledA boolean that indicates whether the use of cookies by the SDK is enabled by the current instance. If false, the instance of the SDK initialized by this configuration will not store or read any data from cookiesboolean
domainCustom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains. If not provided uses the value from root value.string
pathSpecifies the path to use for the cookie, if not provided it will use any value from the root value.string
getCookieFunction to fetch the named cookie value, if not provided it will use the internal cookie parsing / caching.
setCookieFunction to set the named cookie with the specified value, only called when adding or updating a cookie.
delCookieFunction to delete the named cookie with the specified value, separated from setCookie to avoid the need to parse the value to determine whether the cookie is being added or removed. If not provided it will use the internal cookie parsing / caching.

Simplified Usage of new instance Cookie Manager

Enable time-on-page tracking

By setting , the time a user spends on each page is tracked. On each new PageView, the duration the user spent on the previous page is sent as a custom metric named . This custom metric is viewable in the Metrics Explorer as a "log-based metric".

Enable Correlation

Correlation generates and sends data that enables distributed tracing and powers the application map, end-to-end transaction view, and other diagnostic tools.

The following example shows all possible configurations required to enable correlation, with scenario-specific notes below:

If any of your third-party servers that the client communicates with cannot accept the and headers, and you cannot update their configuration, then you'll need to put them into an exclude list via the configuration property. This property supports wildcards.

The server-side needs to be able to accept connections with those headers present. Depending on the configuration on the server-side it is often necessary to extend the server-side list by manually adding and .

Access-Control-Allow-Headers: , ,


If you are using OpenTelemtry or Application Insights SDKs released in or later, we recommend using WC3 TraceContext. See configuration guidance here.

Single Page Applications

By default, this SDK will not handle state-based route changing that occurs in single page applications. To enable automatic route change tracking for your single page application, you can add to your setup configuration.

Currently, we offer a separate React plugin, which you can initialize with this SDK. It will also accomplish route change tracking for you, as well as collect other React specific telemetry.


Use only if you are not using the React plugin. Both are capable of sending new PageViews when the route changes. If both are enabled, duplicate PageViews may be sent.


Browser/client-side data can be viewed by going to Metrics and adding individual metrics you are interested in:

Screenshot of the Metrics page in Application Insights showing graphic displays of metrics data for a web application.

You can also view your data from the JavaScript SDK via the Browser experience in the portal.

Select Browser and then choose Failures or Performance.

Screenshot of the Browser page in Application Insights showing how to add Browser Failures or Browser Performance to the metrics that you can view for your web application.


Screenshot of the Performance page in Application Insights showing graphic displays of Operations metrics for a web application.


Screenshot of the Performance page in Application Insights showing graphic displays of Dependency metrics for a web application.


To query your telemetry collected by the JavaScript SDK, select the View in Logs (Analytics) button. By adding a statement of , you will only see data from the JavaScript SDK and any server-side telemetry collected by other SDKs will be excluded.

Source Map Support

The minified callstack of your exception telemetry can be unminified in the Azure portal. All existing integrations on the Exception Details panel will work with the newly unminified callstack.

Link to Blob storage account

You can link your Application Insights resource to your own Azure Blob Storage container to automatically unminify call stacks. To get started, see automatic source map support.

Drag and drop

  1. Select an Exception Telemetry item in the Azure portal to view its "End-to-end transaction details"
  2. Identify which source maps correspond to this call stack. The source map must match a stack frame's source file, but suffixed with
  3. Drag and drop the source maps onto the call stack in the Azure portal An animated image showing how to drag and drop source map files from a build folder into the Call Stack window in the Azure portal.

Application Insights Web Basic

For a lightweight experience, you can instead install the basic version of Application Insights

This version comes with the bare minimum number of features and functionalities and relies on you to build it up as you see fit. For example, it performs no autocollection (uncaught exceptions, AJAX, etc.). The APIs to send certain telemetry types, like , , etc., are not included in this version, so you will need to provide your own wrapper. The only API that is available is . A sample is located here.


For runnable examples, see Application Insights JavaScript SDK Samples.

Upgrading from the old version of Application Insights

Breaking changes in the SDK V2 version:

  • To allow for better API signatures, some of the API calls, such as trackPageView and trackException, have been updated. Running in Internet Explorer 8 and earlier versions of the browser is not supported.
  • The telemetry envelope has field name and structure changes due to data schema updates.
  • Moved to . Some fields were also changed ( --> ).
    • To manually refresh the current pageview ID (for example, in SPA apps), use .


      To keep the trace ID unique, where you previously used , now use . Both ultimately end up being the operation ID.

If you're using the current application insights PRODUCTION SDK () and want to see if the new SDK works in runtime, update the URL depending on your current SDK loading scenario.

  • Download via CDN scenario: Update the code snippet that you currently use to point to the following URL:

  • npm scenario: Call to download the full ApplicationInsights script from CDN and initialize it with instrumentation key:

Test in internal environment to verify monitoring telemetry is working as expected. If all works, update your API signatures appropriately to SDK V2 version and deploy in your production environments.

SDK performance/overhead

At just 36 KB gzipped, and taking only ~15 ms to initialize, Application Insights adds a negligible amount of loadtime to your website. By using the snippet, minimal components of the library are quickly loaded. In the meantime, the full script is downloaded in the background.

While the script is downloading from the CDN, all tracking of your page is queued. Once the downloaded script finishes asynchronously initializing, all events that were queued are tracked. As a result, you will not lose any telemetry during the entire life cycle of your page. This setup process provides your page with a seamless analytics system, invisible to your users.


  • npm version
  • gzip compressed size
  • 15 ms overall initialization time
  • Zero tracking missed during life cycle of page

Browser support

ES3/IE8 Compatibility

As an SDK there are numerous users that cannot control the browsers that their customers use. As such we need to ensure that this SDK continues to "work" and does not break the JS execution when loaded by an older browser. While it would be ideal to not support IE8 and older generation (ES3) browsers, there are numerous large customers/users that continue to require pages to "work" and as noted they may or cannot control which browser that their end users choose to use.

This does NOT mean that we will only support the lowest common set of features, just that we need to maintain ES3 code compatibility and when adding new features they will need to be added in a manner that would not break ES3 JavaScript parsing and added as an optional feature.

See GitHub for full details on IE8 support

Open-source SDK

The Application Insights JavaScript SDK is open-source to view the source code or to contribute to the project visit the official GitHub repository.

For the latest updates and bug fixes consult the release notes.

Next steps


Web applicationinsights

We quickly laid out the snack (which we had taken from the store) and poured it in a pile. It was easy to communicate with him. He turned out to be a pleasant conversationalist.

Aprenda mais sobre sua aplicação e seus usuários com Application Insights

After all, I knew that nothing would ever happen. Why didn't she tell me to stop, not follow her to the call of the deceiving lights. Why didn't you say: "Roll your lip. Nothing shines for you!".

Similar news:

No, I can't be happy about that, but I'm glad. Regina was distracted by her reflections, and the score was 40:30, not in her favor. She doesn't drink whiskey and cola. Of alcohol, Mills prefers martini. Emma, you rightly said that you made your choice, you are here.

1025 1026 1027 1028 1029