azure-application-insightsuser-tracking

Usergroup tracking with application insights


We want to run our queries to get the pageviews, exceptions, etc against not only against the users themself, but also against usergroups. This will help us prioritize future development.

So my question is if it's possible to add an usergroup or even better some sort of tags to the user that we can use to query over.

I know we can do this by creating all the custom calls, but is there a default way? If not, what is the best way to add those parameters to the custom calls? At the moment I’m using the javscript function appInsights.setAuthenticatedUserContext() to pass the user information


Solution

  • you could add the user group or tags using custom properties in any/all events you send.

    https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics

    telemetryClient.TrackEvent( "the event", 
       new Dictionary<string,string> { {"UserGroup", theUserGroup } } );
    

    etc.

    Once you get that working the way you want, you can then use telelmetry initializers:

    https://learn.microsoft.com/en-us/azure/application-insights/app-insights-api-filtering-sampling#add-properties

    and create an initializer to create and set those custom properties on all telemetry sent from the application, instead of only sending it in calls you wrote explicitly like above.

    Edit to add: Also, if you set this information up using custom dimensions, you can now use it in filters in the new usage tools that were announced at //build 2017: https://learn.microsoft.com/en-us/azure/application-insights/app-insights-usage-segmentation