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
Hi,
I saw that browser exceptions are NOT getting tracked. I vaguely remember this working couple of weeks back though. I tried a couple of ways to initialize ApplicationInsights (See below) and both the times it did not work. I specifically threw an exception from code and that did not get tracked either.
Log.trackException("e8835311-44c5-418c-8fc8-dbd4b003c5ed",, Error("Testing browser exception")); works
throw new Error("Testing Un handled browser exception"); does NOT get tracked.
I did not set DisableTrackingException property anywhere.
Below are the ways I tried (separately, not together) 1. Through Import Module:
import { AppInsights } from "applicationinsights-js";
AppInsights.downloadAndSetup({
instrumentationKey: "xxx-xxxxx",
url: "src/ai.0.js"
});
AppInsights.trackPageView();
window.onerror = AppInsights._onerror;
shkrishms
changed the title
Browser Exceptions (UnHandled) are not tracked by AppInSights
Browser Exceptions (UnHandled) are not tracked by AppInSights : Update needed
Apr 25, 2017
Hi,
I saw that browser exceptions are NOT getting tracked. I vaguely remember this working couple of weeks back though. I tried a couple of ways to initialize ApplicationInsights (See below) and both the times it did not work. I specifically threw an exception from code and that did not get tracked either.
Some observations:
Log.traceInfo("e8835311-44c5-418c-8fc8-dbd4b003c5eb",...) works.
Log.trackException("e8835311-44c5-418c-8fc8-dbd4b003c5ed",, Error("Testing browser exception")); works
throw new Error("Testing Un handled browser exception"); does NOT get tracked.
I did not set DisableTrackingException property anywhere.
Below are the ways I tried (separately, not together)
1. Through Import Module:
import { AppInsights } from "applicationinsights-js";
AppInsights.downloadAndSetup({
instrumentationKey: "xxx-xxxxx",
url: "src/ai.0.js"
});
AppInsights.trackPageView();
window.onerror = AppInsights._onerror;
2. Through JavaScript on master page through the below snippet.
<script type="text/javascript"> 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,s}),t }({ instrumentationKey:"xxxxxxxxx" }); window.appInsights=appInsights; appInsights.trackPageView();</script>
The text was updated successfully, but these errors were encountered: