Skip to content

Commit 684d302

Browse files
committed
Another look at fixing the appinights exception
1 parent 460d6c0 commit 684d302

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

packages/typescriptlang-org/gatsby-browser.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@ exports.onRouteUpdate = ({ location, prevLocation }) => {
1919
// loggingLevelConsole: 1
2020
}
2121

22-
// prettier-ignore
23-
// @ts-ignore
24-
var aiName = window[sdkInstance], aisdk = window[aiName] || function (e) { function n(e) { t[e] = function () { var n = arguments; t.queue.push(function () { t[e].apply(t, n) }) } } var t = { config: e }; t.initialize = !0; var i = document, a = window; setTimeout(function () { var n = i.createElement("script"); n.async = true; n.src = e.url || "https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js", i.getElementsByTagName("script")[0].parentNode.appendChild(n) }); try { t.cookie = i.cookie } catch (e) { } t.queue = [], t.version = 2; for (var r = ["Event", "PageView", "Exception", "Trace", "DependencyData", "Metric", "PageViewPerformance"]; r.length;)n("track" + r.pop()); n("startTrackPage"), n("stopTrackPage"); var s = "Track" + r[0]; if (n("start" + s), n("stop" + s), n("setAuthenticatedUserContext"), n("clearAuthenticatedUserContext"), n("flush"), !(!0 === e.disableExceptionTracking || e.extensionConfig && e.extensionConfig.ApplicationInsightsAnalytics && !0 === e.extensionConfig.ApplicationInsightsAnalytics.disableExceptionTracking)) { n("_" + (r = "onerror")); var o = a[r]; a[r] = function (e, n, i, a, s) { var c = o && o(e, n, i, a, s); return !0 !== c && t["_" + r]({ message: e, url: n, lineNumber: i, columnNumber: a, error: s }), c }, e.autoExceptionInstrumented = !0 } return t }(config);
25-
window[aiName] = aisdk
26-
27-
const locationWithoutPlaygroundCode = location.pathname
28-
.split("#code")[0]
29-
.split("#src")[0]
30-
31-
const prevHref = (prevLocation && prevLocation.pathname) || ""
32-
const previousLocationWithoutPlaygroundCode = prevHref
33-
.split("#code")[0]
34-
.split("#src")[0]
35-
36-
const referrerWithoutPlaygroundCode =
37-
document.referrer && document.referrer.split("#code")[0].split("#src")[0]
38-
3922
let hasLocalStorage = false
4023
try {
4124
hasLocalStorage = typeof localStorage !== `undefined`
4225
} catch (error) {}
4326

4427
try {
28+
// prettier-ignore
29+
// @ts-ignore
30+
var aiName = window[sdkInstance], aisdk = window[aiName] || function (e) { function n(e) { t[e] = function () { var n = arguments; t.queue.push(function () { t[e].apply(t, n) }) } } var t = { config: e }; t.initialize = !0; var i = document, a = window; setTimeout(function () { var n = i.createElement("script"); n.async = true; n.src = e.url || "https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js", i.getElementsByTagName("script")[0].parentNode.appendChild(n) }); try { t.cookie = i.cookie } catch (e) { } t.queue = [], t.version = 2; for (var r = ["Event", "PageView", "Exception", "Trace", "DependencyData", "Metric", "PageViewPerformance"]; r.length;)n("track" + r.pop()); n("startTrackPage"), n("stopTrackPage"); var s = "Track" + r[0]; if (n("start" + s), n("stop" + s), n("setAuthenticatedUserContext"), n("clearAuthenticatedUserContext"), n("flush"), !(!0 === e.disableExceptionTracking || e.extensionConfig && e.extensionConfig.ApplicationInsightsAnalytics && !0 === e.extensionConfig.ApplicationInsightsAnalytics.disableExceptionTracking)) { n("_" + (r = "onerror")); var o = a[r]; a[r] = function (e, n, i, a, s) { var c = o && o(e, n, i, a, s); return !0 !== c && t["_" + r]({ message: e, url: n, lineNumber: i, columnNumber: a, error: s }), c }, e.autoExceptionInstrumented = !0 } return t }(config);
31+
window[aiName] = aisdk
32+
33+
const locationWithoutPlaygroundCode = location.pathname
34+
.split("#code")[0]
35+
.split("#src")[0]
36+
37+
const prevHref = (prevLocation && prevLocation.pathname) || ""
38+
const previousLocationWithoutPlaygroundCode = prevHref
39+
.split("#code")[0]
40+
.split("#src")[0]
41+
42+
const referrerWithoutPlaygroundCode =
43+
document.referrer && document.referrer.split("#code")[0].split("#src")[0]
44+
4545
// @ts-ignore
4646
aisdk.trackPageView({
4747
uri: locationWithoutPlaygroundCode,

0 commit comments

Comments
 (0)