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 mentions in one of his latest blog posts and you are creating a new application, this is very similar for you. Click the Add Application Insights to Project dropdown, 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:
Microsoft.ApplicationInsights.Telemetry.WindowsStore.ClientAnalyticsSession.Default.Start
("license key from ApplicationInsights.config");
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 it 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:
void ItemView_ItemClick(object sender, ItemClickEventArgs e)
{
var properties = new Dictionary<string, object>()
{{"Title", ((SampleDataGroup)e.ClickedItem).Title}};
Microsoft.ApplicationInsights.Telemetry.WindowsStore.ClientAnalyticsChannel.Default.LogEvent
("Store/ItemView", properties);
var groupId = ((SampleDataGroup)e.ClickedItem).UniqueId;
this.Frame.Navigate(typeof(SplitPage), groupId);
}
We are simply 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.
Conclusion
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.