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


Investing deeply in #Terraform on #Azure https://t.co/FkI5tIdCSM

August 18, 2017 09:27

Azure Service Bus .NET Standard Client Generally Available #dotnet https://t.co/OApdNciezA

August 18, 2017 09:25

If you are using @Azure #ContainerRegistry the team is looking for feedbacks: https://t.co/3worKrTubj cc @SteveLasker #Docker #Container

August 18, 2017 06:51

RT @nirmsk: Azure App Service Linux customer sotry: https://t.co/lNhu6Pq0OI "Using App Service on Linux instead of infrastructure services"

August 18, 2017 06:32

What is containerd ? https://t.co/nL6u5mVozD

August 17, 2017 12:21

New release of #Docker Enterprise Edition w/ both #Windows & #Linux containers support! #DockerEE https://t.co/N9e81qQgGj

August 17, 2017 11:44

#CloudCoverShow Episode 233: #Azure Event Grid with Bahram Banisadr https://t.co/2JNJ0eZdI6

August 17, 2017 11:35

#CloudCoverShow Episode 232: #Azure #Container Instances https://t.co/Opu3y1j8aD

August 17, 2017 11:11

Announcing #aspnet Core 2.0 #dotnetcore https://t.co/vNRZpGgAv8

August 17, 2017 11:06

#Microservices and #Docker containers: Architecture, Patterns and Development guidance https://t.co/wQN5KeAHqT

August 17, 2017 11:05

#Maven: Deploy #Java Web Apps to #Azure https://t.co/GFT4IDVssV

August 17, 2017 08:17

Announcing deploy to #Azure app service #Jenkins plugin and more https://t.co/CitUtOPmDp

August 17, 2017 08:15

Microsoft’s Lightweight Linux Runtime Environment Comes to Windows Server https://t.co/0k56clGMhK

August 17, 2017 07:50

With Event Grid, #Microsoft Provides the Missing Half of #Azure #Serverless Computing https://t.co/FoRuMpAZ8M

August 17, 2017 07:48

#Kubernetes Connector for #Azure Container Instances! https://t.co/SY7QwjnrlV

August 17, 2017 07:40