Applicationinsights-js: start/stopTrackPage are documented as recording page view duration when they record PLT

Created on 21 Apr 2017  路  5Comments  路  Source: microsoft/ApplicationInsights-JS

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.

  • Starts timing how long the user views a page or other item. Call this when the page opens.
    * This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
    * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
    */
    startTrackPage(name?: string): any;

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?

bug

All 5 comments

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

Was this page helpful?
0 / 5 - 0 ratings