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


RT @seanmckmsft: We now have a feedback forum for #AzureKubernetesService at https://t.co/0isxSTIwhc. Please use this for feature requests…

July 21, 2018 07:20

Azure Container Registry Build Supports All Windows Versions (Preview of Preview) https://t.co/OCkqVP4S9v

July 19, 2018 09:53

How #Microsoft has evolved under Satya Nadella https://t.co/b2e9B6wWu0

July 19, 2018 09:33

@serbrech you've made my day! :)

July 16, 2018 07:07

RT @brendandburns: The @kubernetesio extension for @code now supports creating/integrating minikube clusters from the editor! (and a prett…

July 11, 2018 21:12

Un début de journée normal avec @SFR! @SFR_SAV je vous ai déjà contacté en privé. J'attends un remboursement pour l… https://t.co/6TxfWSJyzJ

July 11, 2018 05:22

@benjguin Moi je tourne à la bière belge ;-)

July 10, 2018 19:25

Introducing Dev Spaces for @Azure #Kubernetes Service https://t.co/nleSg9UrW0

July 10, 2018 10:16

RT @AbelSquidHead: Did you know you can create public projects in #VSTS now? Cool stuff!! https://t.co/IhdCfmNVEx

July 07, 2018 12:19

@SFR_SAV Vous ne pourrez rien me dire de plus que le service téléphonique, autant continuer en public que les gens… https://t.co/UxGr9SVVkW

July 06, 2018 17:28

@philippep92 @petitpatapouf @SFR_SAV @Laurent_MAILLOT @LafibreOrange Preneur ici aussi #Orange, on a voté l'autoris… https://t.co/6DmO566rR5

July 06, 2018 17:25

@philippep92 @petitpatapouf @SFR_SAV @Laurent_MAILLOT Idem dans le 94 à Gentilly. Le service client @SFR_SAV m'a di… https://t.co/eBF3N4H8PH

July 06, 2018 17:11

.@60millions @UFCquechoisir @Arcep est-ce qu'il y a des actions en cours pour régler les problèmes de qualité #SFRhttps://t.co/ZAsoN6POo6

July 06, 2018 16:54

A tous les gens qui ont des soucis avec #SFR, appelez le service client (@SFR / 1023), ils sont obligés de vous déd… https://t.co/1hkWgjjklV

July 06, 2018 16:51

Encore une panne générale de #SFR... Réponse de @SFR_SAV au téléphone: "on est en train de migrer nos clients ADSL… https://t.co/kQaE9pcC7T

July 06, 2018 16:49