category: [ Azure ] tags: [ Application Insights ] [ Windows Store App ]
created: 18 Feb 2014 @ 09:31 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 an existing Windows Store App for an example of adding Application Insights to an existing application that could already be in the store.
Create a new Application
If you you have the Application Insights Tools for Visual Studio installed that Brian Harry mention in one of his latest blog posts and you are creating a new application, this is much similar for you. Click the Add Application Insights to Project drop down, that will make sure you are authenticated to VSO.
Once done you will be able to choose which VSO account you want to connect to and then you can click Configure to choose the application name (if you haven't created an application in Application Insights yet just type the name and one will be created for you automatically).
At this point the application is opened in your default browser
and a solution is created like
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
As the snippet mentions you need to grab the license key (aka: instrumentation key) from the ApplicationInsights.config
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
Because I am using a new application 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.
Gordon Beeming works at Nologo Studios in the sunny city of Durban, South Africa. He is the Lead for the Data and Services Team and has a strong focus on Developer Efficiencies and R&D. When he's not hacking away at a keyboard in Visual Studio he'll generally be relaxing with his family or hitting the black top getting in some mileage. He is a Visual Studio ALM Ranger and Visual Studio ALM MVP.