You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We get an error when calling appInsights.trackPageView() after setting configuration autoTrackPageVisitTime to true
Source line:
ApplicationInsights.prototype.trackPageView=function(pageView,customProperties){try{this._pageViewManager.trackPageView(pageView,customProperties);if(this.config.autoTrackPageVisitTime){this._pageVisitTimeManager.trackPreviousPageVisit(pageView.name,pageView.uri);// PS!!! The error occurs on the line above, saying _pageVisitTimeManager is undefined}[…]
Stack trace:
TypeError: Cannot read property 'trackPreviousPageVisit' of undefined
at ApplicationInsights.trackPageView (node_modules\@microsoft\applicationinsights-web\dist\applicationinsights-web.js:2697:49)
at Initialization.trackPageView (node_modules\@microsoft\applicationinsights-web\dist\applicationinsights-web.js:5771:31)
Suspected cause:
PageVisitTimeManager is missing in the bundling for the files in the folders "dist" and "browser" under "node_modules/@microsoft/applicationinsights-web".
Details:
The @microsoft/applicationinsigts-xxx packages are compiled/bundled into three formats in the folders under [node_modules/[packagename]: "browser", "dist" and "dist-esm".
The "dist-esm" folder contains ESM module format import statements and is referenced by the "module" property in package.json. For applications using WebPack this will become the perferred source files since WebPack prefers this when inspecting package.json.
The files in the "dist" and "browser" folders seem to be in a UMD module format, but they also seem to be bundled to include all the source code from the other depended-upon packages.
I expected the files under "browser" to be a no-modules alternative that allows you to simply add the script through a standard script element on an HTML page. (TIP: If this is the intent, this file may be referenced by a "browser" property in package.json, which it is currently not).
I then expected the files under "dist" to be in a UMD format - which it is - but I did not expect it to be bundled. In the application where we experience the problem we are still using AMD/RequireJS, and it would work fine to have UMD module format without bundling (it would require some more path configuration for RequireJS though).
Anyway: It seems like the PageVisitTimeManager class/module was left out in this bundling process, so whenever you set autoTrackPageVisitTime to true, an error is thrown when calling trackPageView().
PS! I have tested scripts under both "browser" and "dist", but I experience the same problem in both.
The text was updated successfully, but these errors were encountered:
Application Insights JS SDK Version: 2.0.0-rc.1
Module format: UMD/Bundled
Problem files:
[node_modules]/@microsoft/applicationinsights-web/browser/ai.2.js
[node_modules]/@microsoft/applicationinsights-web/dist/applicationinsights-web.js
Description:
We get an error when calling appInsights.trackPageView() after setting configuration autoTrackPageVisitTime to true
Source line:
Stack trace:
Suspected cause:
PageVisitTimeManager is missing in the bundling for the files in the folders "dist" and "browser" under "node_modules/@microsoft/applicationinsights-web".
Details:
The @microsoft/applicationinsigts-xxx packages are compiled/bundled into three formats in the folders under [node_modules/[packagename]: "browser", "dist" and "dist-esm".
The "dist-esm" folder contains ESM module format import statements and is referenced by the "module" property in package.json. For applications using WebPack this will become the perferred source files since WebPack prefers this when inspecting package.json.
The files in the "dist" and "browser" folders seem to be in a UMD module format, but they also seem to be bundled to include all the source code from the other depended-upon packages.
I expected the files under "browser" to be a no-modules alternative that allows you to simply add the script through a standard script element on an HTML page. (TIP: If this is the intent, this file may be referenced by a "browser" property in package.json, which it is currently not).
I then expected the files under "dist" to be in a UMD format - which it is - but I did not expect it to be bundled. In the application where we experience the problem we are still using AMD/RequireJS, and it would work fine to have UMD module format without bundling (it would require some more path configuration for RequireJS though).
Anyway: It seems like the PageVisitTimeManager class/module was left out in this bundling process, so whenever you set autoTrackPageVisitTime to true, an error is thrown when calling trackPageView().
PS! I have tested scripts under both "browser" and "dist", but I experience the same problem in both.
The text was updated successfully, but these errors were encountered: