locked
View browser usage over a given time period RRS feed

  • Question

  • Using this AI agent to transmit telemetry data to App Insights for my .NET 4.x web apps.  Is there a good way to view which browser versions  (Chrome, Firefox, etc) are being used for a given period of time.  Is there a good way to view which TLS/SSL versions are being used for a given period of time?

    Tuesday, May 5, 2020 5:30 AM

Answers

  • There is a way to capture both items, but they aren't included in the base agent for .NET Framework.

    Is there a good way to view which browser versions  (Chrome, Firefox, etc) are being used for a given period of time.

    There are two options for capturing this data.

    1.  (Recommended) Use the browser-side App Insights package to capture client info. In this case the device info will be captured by default. The data can be queried from the `pageViews` table.
      pageViews
      | summarize CountByBrowser=count() by client_Browser, bin(timestamp, 1d)
      | top 10 by CountByBrowser
      | render columnchart kind=stacked 
    2. Use a custom TelemetryInitializer to capture the information server-side with each request. In this case, you would decide where you want to store the data, usually either in the user data or in a custom dimension. You can find an example on how you might do the in this Stack post: https://stackoverflow.com/questions/51155252/user-agent-information-in-azure-application-insights
    public class MyCustomTelemetryInitializer: ITelemetryInitializer
    {
        readonly IHttpContextAccessor _httpContextAccessor;
    
        public MyCustomTelemetryInitializer(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
        }
    
        public void Initialize(ITelemetry telemetry)
        {
            if (telemetry is RequestTelemetry requestTelemetry)
            {
                requestTelemetry.Context.User.Id = _httpContextAccessor.HttpContext.Request.Headers["User-Agent"];
            }
        }
    }

    More info about TelemetryInitializers in general can be found in the docs: https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling

     Is there a good way to view which TLS/SSL versions are being used for a given period of time?

    As with the second option above, a custom TelemetryInitializer will allow you to send custom data to App Insights. Getting the TLS version will be a bit more complicated however. There is a long discussion on how to do this in this Stack Overflow thread. Primarily by using reflection to access the properties in the underlying request stream. https://stackoverflow.com/questions/48589590/which-tls-version-was-negotiated



    Friday, May 8, 2020 7:18 PM