7

We can send 'application version' property with every insight in c# like in this tutorial by adding a initializer.

    class AppVersionTelemetryInitializer : Microsoft.ApplicationInsights.Extensibility.ITelemetryInitializer
{
    public void Initialize(Microsoft.ApplicationInsights.Channel.ITelemetry telemetry)
    {
        telemetry.Context.Component.Version = ApplicationInsightsHelper.ApplicationVersion;
    }
}

https://blogs.msdn.microsoft.com/visualstudioalm/2015/01/07/application-insights-support-for-multiple-environments-stamps-and-app-versions/

How can I do this with javascript?

Akila
  • 123
  • 6

2 Answers2

3

If you are using the @microsoft/applicationinsights-web SDK (for client-side Javascript), you can set the application version in this way:

const appInsights = new ApplicationInsights(...);
appInsights.loadAppInsights();  // important, otherwise the `application` object is missing
appInsights.context.application.ver = "YOUR_VERSION_HERE";

This way, you'll be able to drill down into metrics by application version in the dashboards.

Andrea Spadaccini
  • 12,378
  • 5
  • 40
  • 54
0

You can formulate the App version/Tags and send it in custom property or metrics via trackpageview.

Config file is not possible, but enum or some key/value pair can be maintained for each release in webpages & slice the custom param in Azure portal AI blade or API calls.

  • 4
    There's a standard way of sending the Application Version. It shows "undefined" in Azure unless you set it yourself. That way you can segment by Application Version. The poster wants to know how to configure this setting in JavaScript client-side. – Kevin Ghadyani Jan 31 '18 at 17:02