Using Application Insights in a Windows Store application

January 28, 2014 -

Introduction

Few months ago Microsoft announced the release of Visual Studio Online (VSO). One of the new feature that comes with VSO is Application Insights. It allows to monitor the performances of your applications and to find out what your users are doing the most or the less in your app. This kind of information may be very useful to optimize users’ experience in your app or propose new feature, based on behavior analysis.

Declare an application in the Visual Studio Online dashboard

Before using Application Insights, you have to declare the application in your dashboard on the VSO website. Go to your dashboard and click the item “Try Application Insights” :

image

In the Add application section, follow the wizard to declare a Windows Store app

image

Name your application an copy the generated ID.

You are now ready to use application insights in your app.

How do I set up Application Insights in my project ?

Setting up Application Insights in a Windows Store application is very easy. First, you should change the build configuration of your application and choose between x64, x86 and ARM. Any CPU is not supported because application insights is distributed as a winmd native component.

image

Once you have changed the build configuration of your projet, you can search for a Nuget package named Application Insights Telemetry SDK for Windows Store Apps :

image

Do not waste time to look for the reference in your project after you have installed the package, it will be visible only after Visual Studio has been restarted (don’t ask why, it was the case for me… Smile).

Build the solution and check you have no error in the console.

Using the Application Insights SDK in your application

The API is really easy to use. In the namespace Microsoft.ApplicationInsights.Telemetry.WindowsStore, you will find a class ClientAnalyticsSession that exposes a property Default. There are three interesting methods on this object :

  • Start : takes the id of your application insights app and starts the analytics session
  • LogEvent : logs a given event in your application (users behavior, most of the time)
  • LogPageView : logs a page view

Now, you can implement your own tag plan in your app. You just have to call the Start method when your application launches and it’s ok !

Application Insights, for what kind of information ?

Application Insights allows to get some performance information about your application, but also monitor usage patterns in the application. For example, you can know what are the versions most used by your users :

image

You can also check the different resolutions or hardware of your users :

image

Or the languages :

image

And of course the detail of each event that occurs in the application and that you have triggered through the API :

image

Conclusion

As you can see, it is really easy to use Application Insights in a Windows Store application and the dashboard on the VSO website is very cool and very useful to read all the information about your application.

So do not hesitate anymore, use it !

Hope this helps !

Julien Winking smile

Comments

Share

Tags


Twitter


#Kubernetes for Edge Computing: The Microsoft #Azure Approach https://t.co/D6pGrqIBKm

May 25, 2018 05:52

#Azure the cloud for all – highlights from Microsoft BUILD 2018 https://t.co/TH5poYxV0D

May 25, 2018 05:44

RT @satyanadella: @EmmanuelMacron Honored to join the #TechforGood Summit with @EmmanuelMacron. Collectively we have a responsibility to en…

May 23, 2018 15:44

@IOI__655321 @StravaSupport It would be nice if the sync was working all the time and does not take 5+ hours to app… https://t.co/YFOaVCMNRS

May 20, 2018 15:41

RT @brendandburns: More container wisdom from @jessfraz This time in multitenant kubernetes! Really great stuff. https://t.co/Y8xD3qWnVO

May 19, 2018 06:40

RT @Tyriar: VS @code tip: Turn VS Code into a quick notepad with highlighting by adding `"files.defaultLanguage": "markdown"` to your setti…

May 18, 2018 13:45

RT @brendandburns: Great article on how @azure is delivering on the vision of an intelligent edge for IoT via containers, kubernetes and th…

May 17, 2018 06:27

This is really awesome. #SurfaceHub2 https://t.co/HOhrMcRBBp

May 15, 2018 17:05

@benjiiim WOW!

May 15, 2018 17:03

#Azure confidential computing https://t.co/gSuQekTNrb

May 15, 2018 17:03

Azure #Kubernetes Service now has built-in http ingress application routing using #Azure DNS Zone -> https://t.co/tXuAC0cMEa

May 14, 2018 09:01

@lamouetterieuse Ce n'est pas avec docker compose mais il y a une notion de container group avec ACI: https://t.co/G4GLsfjGKP

May 11, 2018 19:57

#Azure SignalR Service, a fully-managed service to add real-time functionality https://t.co/wLiDQveigC

May 11, 2018 17:28

Virtual Network Service Endpoints for Azure #CosmosDB is now generally available https://t.co/ahJT2KnimD

May 11, 2018 16:18

Multi-container on #Azure #Linux Web App, w/ #docker compose and #Kubernetes manifests support! https://t.co/p4tiCPFH67

May 11, 2018 14:40