I am calling API startTrackPage() to start tracking when a page opens and stopTrackPage() to start tracking when user moves to a url. I understood this from the API documentation (see below). But this duration (how long a page is viewed) is showing up a page load duration in the portal.
The documentation here (https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics#page-views) says that startTrackPage() and stopTrackPage() are used for measuring "PageLoadTimes".
So in summary, I want to measure page load time and page view time and how can I do it accurately with existing APIs?
I believe the docs.microsoft.com documentation is correct, and the code comment is incorrect. These methods are used for recording load time of the page. To record page view time you can use trackMetric for a custom metric
@OsvaldoRosado I believe the API reference for this repo should be updated as well
https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#starttrackpage
If startTrackPage and stopTrackPage are used for recording load time of the page, then it should be reflected there as well. This issue has also caught me off guard and led me here.
/cc: @markwolff @jpiyali
Hey @Fallenstedt, I'm going to update the typings to clarify this, as well as the docs. I'll update once the types are published.
@Fallenstedt @shkrishms Updated types, docs also updated.
npm i @types/[email protected]
https://www.npmjs.com/package/@types/applicationinsights-js/v/1.0.9