categories: [ Azure ] tags: [ Application Insights ] [ Rangers Research ] [ Windows Store App ]
created: 12 May 2014 @ 21:58 modified: 24 Apr 2017 @ 13:57
If you haven't heard or read about Application Insights you should go to MSDN and read up on all the awesomeness that you can get by using this new feature of VSO. You can also take a look at the Channel 9 series on Application Insights for Visual Studio Online by Charles Sterling.
Also see Using Application Insights with a new Windows Store App for an example of adding Application Insights from the creation of a new project.
Installing Application Insights from NuGet
To add Application Insights to your project install the Application Insights Telemetry SDK for Windows Store Apps (Id: Microsoft.ApplicationInsights.Telemetry.WindowsStore)
Install through the Manage NuGet Packages
or using Package Manger Console
The Application Insights NuGet package is now installed in your application
Getting your instrumentation key
Navigate to a dashboard on VSO and click the admin/settings button in the top right and then click on Keys & Downloads, or browse to https://AccountName.visualstudio.com/_appanalytics/_admin/keysanddownloads. Select the application you are wanting to collect usage data for
and then navigate down to the Windows 8.1 Store SDK section and you will see your instrumentation key
From here on it's the same as if you started with a clean application and opted to install Application Insights with the start of your application
Changing App Configuration
All applications (at the moment) new or current will get the error below if you haven't already changed the Platform of your store application
To get rid of this message and put Application Insights in a state where you can start logging application usage you will need to change the configuration of your app to not be Any CPU.
Open Configuration Manager
Set the platform to x86, x64, or ARM
Initializing Application Insights
Open the App.xaml.cs file and at the end of the App() method add the following code
At this point you can run your application and you will get some basic information like the Operating System, Screen Resolution and a view metrics like session time. You'll need to wait about 15 minutes for the information to display on your dashboard but will look something like below.
To see the data head over to the Usage Tab on VSO Application Insights
Logging app feature usage
My existing application happens to be an empty Split Page application so I will just log which of the groups the user clicks into. To do this (if you are using the Split Page Application) navigate to ItemsPage.xaml.cs file and change the ItemView_ItemClick method to be like below
We are simple logging that the Item Click event was fired and logging the title of the group that was clicked. This when you click around in the sample app will log to Application Insights as you click around and generate some data. To see the features that were logged head over to Event Insights under the Features tab
It's really simple to get started with Application Insights and get that feedback from your application when it's out there in the wild.