Search

BLOGS

AZURE APPLICATION INSIGHTS(AI) AND CAPTURING DYNAMICS 365 CLIENT SIDE TELEMETRY

What is Application Insights?

Application Insights is an extensible Application Performance Management (APM) service for web developers on multiple platforms. Use it to monitor your live web application. It allow you to monitor the end user performance of an application. It will automatically detect performance anomalies. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app. It's designed to help you continuously improve performance and usability. It works for apps on a wide variety of platforms including .NET, Node.js and J2EE, hosted on-premises or in the cloud. It integrates with your DevOps process, and has connection points to a variety of development tools. It can monitor and analyze telemetry from mobile apps by integrating with Visual Studio App Center.

In the past, performance monitoring was more about monitoring servers and their performance. It’s very easy to track the CRM form client-side performance using Application Insights. The Application Insight is not expensive, the basic plan is free and 1 GB of data is included every month.

What does Application Insights monitor?
  1. Request rates, response times, and failure rates 
  2. Dependency rates, response times, and failure rates 
  3. Exceptions
  4. AJAX calls from web pages
  5. User and session counts.
  6. Performance counters from your Windows or Linux server machines
  7. Host diagnostics from Docker or Azure.
  8. Diagnostic trace logs from your app
  9. Custom events and metrics that you write yourself in the client or server code, to track business events


Follow the below steps to configure the Application Insights for Dynamics 365,

  1. Create an Application Insights in the Azure portal.
  2. Open the Application Insights and Click on the Getting started under the Configure menu and then click on the Monitor and Diagnose Client Side Application.

  1. In the Client application monitoring and diagnosis form, copy the instrumentation key and paste it in a notepad file.

 

  1. Log in to Dynamics 365 and create a web resource for Application Insights and add the below-mentioned scripts. Update your Application Insights Instrumentation key in the highlighted area on the script.
if (ApplicationInsights === "undefined") {
 var ApplicationInsights = {};
}

ApplicationInsights = {
 trackApplicationInsight: function (entityName, properties) {
 var appInsights = window.appInsights || function (config) { function i(config) { t[config] = function () { var i = arguments; t.queue.push(function () { t[config].apply(t, i) }) } } var t = { config: config }, u = document, e = window, o = "script", s = "AuthenticatedUserContext", h = "start", c = "stop", l = "Track", a = l + "Event", v = l + "Page", y = u.createElement(o), r, f; y.src = config.url || "https://az416426.vo.msecnd.net/scripts/a/ai.0.js"; u.getElementsByTagName(o)[0].parentNode.appendChild(y); try { t.cookie = u.cookie } catch (p) { } for (t.queue = [], t.version = "1.0", r = ["Event", "Exception", "Metric", "PageView", "Trace", "Dependency"]; r.length;) i("track" + r.pop()); return i("set" + s), i("clear" + s), i(h + a), i(c + a), i(h + v), i(c + v), i("flush"), config.disableExceptionTracking || (r = "onerror", i("_" + r), f = e[r], e[r] = function (config, i, u, e, o) { var s = f && f(config, i, u, e, o); return s !== !0 && t["_" + r](config, i, u, e, o), s }), t }(
 {
 instrumentationKey: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
 });
 window.appInsights = appInsights;

appInsights.trackPageView(entityName, Xrm.Page.context.getClientUrl(), properties);
 }
}
  1. For whichever entity the performance telemetry needs to be captured add the below JavaScript code to the entity JavaScript web resource.
function accountOnLoad()
{
 var operationType = '';
 if (Xrm.Page.ui.getFormType() == 1) { operationType = 'Create'; } else { operationType = 'Update'; }

var properties = { User: Xrm.Page.context.getUserName(), ObjectId: Xrm.Page.data.entity.getId(), OperationType: operationType, TriggerEvent: 'Form Load' };
 ApplicationInsights.trackApplicationInsight('Account', properties);
}

function accountOnSave()
{
 var operationType = '';
 if (Xrm.Page.ui.getFormType() == 1) { operationType = 'Create'; } else { operationType = 'Update'; }

var properties = { User: Xrm.Page.context.getUserName(), ObjectId: Xrm.Page.data.entity.getId(), OperationType: operationType, TriggerEvent: 'Form Save' };
 ApplicationInsights.trackApplicationInsight('Account', properties);
}
  1. Add the created Application Insights web resource to the Entity Form Properties and add the JavaScript function to the form on-load and on-save event, so that the complete performance metrics will be captured by the Application Insights for these.

 

  1. You can add as much as details you want to capture by adding to the properties. These properties information will be captured as custom data in the Application Insights.
var properties = { User: Xrm.Page.context.getUserName(), ObjectId: Xrm.Page.data.entity.getId(), OperationType: operationType, TriggerEvent: 'Form Save' };  
ApplicationInsights.trackApplicationInsight('Account', properties);

  1. Now the client side performance telemetry will be captured on the on-load and on-save of the entity form. This function can be added to any events like button click, business process stage change, etc to capture the client side performance and exceptions
  1. Application Insights has lots of out of the box dashboards, charts and live metrices stream to monitor the metrices easily.

Print
Posted: Jan 21, 2019,
Categories: Dynamics 365,
Comments: 0,
Author: Urish Arora
Rate this article:
5.0

Urish AroraUrish Arora

Other posts by Urish Arora

, Contact author

Please login or register to post comments.

Name:
Email:
Subject:
Message:
x

SEARCH

 

 

«July 2019»
MonTueWedThuFriSatSun
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

Latest Blogs

Posted: Jan 21, 2019

Top 25 Reasons to love Microsoft Dynamics 365 for Sales

This blog lists 25 reasons or features of Dynamics 365 for sales people to strengthen their relationship with the cutomers

Read more
Posted: Jan 21, 2019

AZURE APPLICATION INSIGHTS(AI) AND CAPTURING DYNAMICS 365 CLIENT SIDE TELEMETRY

This blog is about capturing the Dynamics 365 client side performance telemetry with Azure Application Insights

Read more
Posted: Nov 5, 2017

Upgrade strategy: SharePoint 2010 vs SharePoint 2013 vs SharePoint 2016

This blog is about the comparison of SharePoint versions 2010, 2013 and 2016.

Read more
RSS

About Author

URISH ARORA

Principal IT Consultant | Architect

A Microsoft Technologies Principal Consultant (Contractor) and Technical Design Authority specializing in Microsoft Technical Due Diligence, Enterprise Architecture, large scale Microsoft implementations, Service Orientation (SOA) and creatively applying technologies to business process automation.

Recent Posts

Top 25 Reasons to love Microsoft Dynamics 365 for Sales

This blog...
  • 169
  • Article rating: 5.0
RSS

Disclaimer

The information contained on this Site/Blog is intended solely to provide general guidance. I make no representations as to the accuracy or completeness of any information on this Site/Blog or found by following any link on this Site/Blog. I will not be responsible, or liable for any errors or omissions in this information nor for the availability of this information.

I will not be responsible, or liable for any losses, injuries, or damages from the display or use of this information. The reader accepts full responsibility for its use. The views expressed on this Site/Blog are my personal views and do not necessarily reflect views of my employer. The posts and opinions expressed on this Site/Blog are solely my own. They do not represent (nor are they intended to represent) the positions, opinions or policies of my employer or any other company or person. Opinions expressed in comments on this Site/Blog are third party information for which I accept no responsibility or liability.

Follow Me

 

 

 

Tag cloud: UrishArora.com with Urish Arora; UrishArora; Principal IT Consultant | Architect and Technical Design Authority specializing in Microsoft Technical Due Diligence Dynamics 365; Dynamics 365 Authority; Top Technical Blogs; Urish Arora - Australia's leading expert on Digital Transformation;  Digital Transformation; Top Articles on MS Dynamics CRM, SharePoint, & more.

Copyright 2019 by Urish Arora Terms Of Use Privacy Statement
Back To Top