How to Configure Azure Application Insights

Virto Commerce Platform and Virto Commerce Storefront have native integration with Azure Monitor and Application Insights.

We recommend creating an Application Insights resource to monitor your e-commerce solution. With Application Insights, you have full observability into your application across all components and dependencies of your complex distributed architecture. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app. It’s designed to help you continuously improve performance and usability.

It works for apps hosted on-premises, hybrid, or any public cloud.

How to Configure Application Insights:

  1. From the Azure portal, create a new Application Insights resource (or use an existing one).

  1. Open Application Insights resource you just created.

  2. Copy Instrumentation Key

  3. Add APPINSIGHTS_INSTRUMENTATIONKEY environment variable with Instrumentation Key value. How to Configure apps in the portal - Azure App Service | Microsoft Docs

  4. If the env variable configured properly, you should see data in Live Stream.

How to monitor client-side metrics

You can add Application Insights to monitor client-side metrics. 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.

Just, Add Azure Application Insights JavaScript snippet.

Production and Dev Environments

The count of the events and telemetry which you can see in Application Insights depends on environment configuration.

To determine the runtime environment, ASP.NET Core reads from the following environment variable: ASPNETCORE_ENVIRONMENT.

  • Development sets ASPNETCORE_ENVIRONMENT to Development.
  • Production - the default. If ASPNETCORE_ENVIRONMENT has not been set.

You can setup it if via Environment Variable or Web.Config file.

Also, you can check the current runtime mode in the custom properties. We recommend to use Production for production environments.

Example: Development mode is activated.


Some of the settings can be configured in Application Insights section for App Service.


What is Azure Application Insights? - Azure Monitor | Microsoft Docs
Application Map in Azure Application Insights - Azure Monitor | Microsoft Docs
Azure Application Insights Transaction Diagnostics - Azure Monitor | Microsoft Docs
Use multiple environments in ASP.NET Core | Microsoft Docs