Telemetry – Get more info about the users (Part 1)

Do you want to have an overview of what users are doing in your application? You can use for that Application Insights which is available on Azure.

Since I see some new info about telemetry in Business Central directly from Microsoft, I would like to share with you things on which I had been working for some time. But first, if you never used the Application Insights, you can read below how to start.

Setup on Azure

To start monitoring your application you would need to create an Application Insights app on Azure Portal first. The 5GB is every month is free which is for sure enough to start.

 

Then you will get your key which needs to be set one of the next steps into the Business Central application. 

To finish the setup, you can create a dashboard for your Application Insights resource. There are two ways to do so.

Either manually or you can use the Dashboard provide by BCTech Team. More info about the second option you can find here https://github.com/microsoft/BCTech/tree/master/samples/AppInsights/Dashboard . 

If you are ISV then to add key in your app.json you will need to wait till April version since it is available in the runtime 5.0.

Example from BCTech

On BCTech GitHub you can find Microsoft Repository with samples on how to connect to Application Insights. Here is a direct link: https://github.com/microsoft/BCTech/tree/master/samples/AppInsights . The only thing which you need to do is to change the apiKey in the codeunit TestAppInsights.

If you would install the app provided you can test it using the page Test Application Insights

When you first want to emit the even you need to approve the request to external service.

After a while, you will see in the Azure Portal that the events had been tracked. 

What can you track?

With the example prepared by BCTech, you can track 4 different types in the Application Insights. 

Track Custom Events 

It allows you to track custom events with a set of properties (in the text) and if needed metrics (which are in decimal). More information you can find here:  https://docs.microsoft.com/en-us/azure/azure-monitor/app/data-model-event-telemetry In the Application Insights later you can build the reports based on the metrics and the properties. 

Track Trace

Trace you can use to send custom messages when something has been done in Business Central. Also, you can pass the custom properties. More information you can find here: https://docs.microsoft.com/en-us/azure/azure-monitor/app/data-model-trace-telemetry 

Track page view

Page view event you can use to track if the object in Business Central had been opened. There is no information about how long the page was open.

Track exception

The last one is tracking exceptions. You can learn more about them here: https://docs.microsoft.com/en-us/azure/azure-monitor/app/data-model-exception-telemetry Later you can see the exceptions as a failure in the Application Insights. 

Summary

In this part, I showed you how to start with the custom Telemetry. In the next part, I will show you what adjustments I have done to the code BCTech examples.  Here you can continue to Part 2: http://www.mynavblog.com/2020/02/29/telemetry-get-more-info-about-the-users-part-2/

6 Comments

Add a Comment

Your email address will not be published.