📜 ⬆️ ⬇️

Application Insights - we collect telemetry of Windows Phone and Windows applications



I am pleased to inform you that Application Insights now supports the collection of Windows telemetry and Windows Phone applications. Now you can get information about how users interact with your application, as well as diagnose problems that arise when the application is running. All captured data is visualized on the Azure Preview portal.

When you add Application Insights to your project, information about your application (users, sessions, pageviews, problems) starts to be collected automatically. In addition, there is an API that allows you to send events, metrics and exceptions. Let's see what features Application Insights provides.

Add Application Insights to your project


')
If you have not yet created a project, in the New Project window select from the list Windows or Windows Phone Apps, in the right part of the window check the box next to Add Application Insights to Project .



A window opens in which you will need to enter your account details with an Azure subscription. If you do not have an Azure subscription, you can activate the free (trial) or Pay As You Go (paid) version of the subscription.



If you already had a project created earlier by Windows or Windows Phone, then open it in Visual Studio 2013 (Update 3 or higher). Select Add Application Insights telemetry .



If you are not logged in before, do it now.

Run the application



Press F5 to run the application on the emulator or on the device. Application Insights will automatically collect information about sessions, users, page views, and application errors.

You will see a notification in Visual Studio that will alert you that the data has been successfully collected and sent.



In debug mode, telemetry will be sent immediately after it is generated. In release mode, telemetry is stored on the device and sent only when the application resumes.

View collected data



Open Application Insights in your application:



At first you will see only one or two points. For example:



Click Refresh if you want to see more information.

You can click on any chart to view detailed information.

Tracking information



On the Overview timeline page, click on the Users and Sessions diagrams to see the analytics.



Note:



Segmentation



You can view information based on various criteria. For example, to see how many users use a particular version of an application, open the Users diagram and select the segmentation by application version (Application Version):



Browse pages



In order to see which pages of your application are visited by users, add the following code to your application:

var telemetry = new TelemetryClient(); telemetry.TrackPageView("GameReviewPage"); 

Results will be available in the page views section.



This way you can view information about any page.

Custom events



You can track user behavior in different situations, for example, when you finish the game. Add the following code:

 telemetry.TrackEvent("GameOver"); 

The data will appear in the Custom Events grid. You can view general information about events or click on a specific event to view a detailed description.



You can also add string and numeric properties for each event.

 //   : var properties = new Dictionary <string, string> {{"Game", currentGame.Name}, {"Difficulty", currentGame.Difficulty}}; var measurements = new Dictionary <string, double> {{"Score", currentGame.Score}, {"Opponents", currentGame.OpponentCount}}; //  : telemetry.TrackEvent("GameOver", properties, measurements); 

Click on any event to see its detailed description.



For more information about custom events, you can see here .

Detection and diagnosis of program crashes



Installing a failure alert in the program





Fault Diagnostics



To find out how often your program crashes or compare the stability of one version compared to another, click on the Crashes icon and sort by application version ( Application Version ):



To learn about the exceptions that cause failures, open Diagnostic Search .

Please note that you can choose which data will be displayed.



To view detailed information about the exception, click on it.



View telemetry on the Application Insights portal



You can view telemetry not only directly in Visual Studio, but also on the Azure portal. Go to Browse -> Application Insights and select the application you created.



You will immediately see the telemetry collected by your application.



So, we have considered only the main possibilities of using Application Insights telemetry in Windows and Windows Phone applications. If you want to learn more about some of the features of Application Insights, you can follow one of the links listed below.

useful links


Source: https://habr.com/ru/post/250501/


All Articles