none
Using appInsights.startTrackPage & appInsights.stopTrackPage - for tracking AJAX calls

    Question

  • Hi,

    I have appInsights.startTrackPage and appInsights.startTrackPage function calls in my JavaScript. Between these 2 calls I have AJAX call made. 

    My problem is even though AI is logging TrackPage event, AJAX call is not getting logged under dependencies. My primary intention is to measure AJAX call performance. 

    Any troubleshooting hits are appreciated. 

    Mak


    MaKeer

    Friday, November 23, 2018 12:51 AM

Answers

  • Only XmlHttpRequest is automatically collected/tracked with app insights. You will need to manually use `trackDependency` to track this type of request. Alternatively, you can manually append trackDependency to the prototype of Xrm.WebApi.online.execute at runtime so that it autocollects it for you.
    Monday, December 3, 2018 6:54 PM

All replies

  • I'm going to do a bit more digging on this.  For anyone else that may be reading this, you can look through our documentation on Timing page views.
    Wednesday, November 28, 2018 3:03 AM
    Moderator
  • Hey Mak, are you talking about autocollection of ajax requests? If so, could you add

    enableDebug: true, verboseLogging: true, maxBatchInterval: 1

    to your settings? Is any telemetry sent after your stopTrackPage call? Could you provide a fiddler trace or any details in your browser F12 debugger.

    Nothing in startTrackPage should block autocollection, and I was unable to repro issue, so a code snippet would be helpful as well.

    Thanks!

    Friday, November 30, 2018 11:14 PM
  • I think I found the issue here.

    We are using App Insights tracking call in Dynamics 365 Web Resource, and if we use Xrm.WebApi.online.execute method to call CRM Web API, it does not getting tracked in App Insights. However if I replace Xrm.WebApi.online.execute calls with standard XmlHttpRequest call to same CRM Web API it is getting tracked.

    I am not sure why this is happening this way, may be someone from App Insights team can give more details

    Thanks

    Mak


    MaKeer

    Monday, December 3, 2018 8:55 AM
  • Only XmlHttpRequest is automatically collected/tracked with app insights. You will need to manually use `trackDependency` to track this type of request. Alternatively, you can manually append trackDependency to the prototype of Xrm.WebApi.online.execute at runtime so that it autocollects it for you.
    Monday, December 3, 2018 6:54 PM