Skip to content

Commit 9d579b2

Browse files
committed
resolving discussions
1 parent 992ac4a commit 9d579b2

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

articles/azure-monitor/app/javascript-sdk-advanced.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ These configuration fields are optional and default to false unless otherwise st
7373
| samplingPercentage | numeric | 100 | Percentage of events that is sent. Default is 100, meaning all events are sent. Set it if you wish to preserve your data cap for large-scale applications. |
7474
| autoTrackPageVisitTime | boolean | false | If true, on a pageview, the _previous_ instrumented page's view time is tracked and sent as telemetry and a new timer is started for the current pageview. It's sent as a custom metric named `PageVisitTime` in `milliseconds` and is calculated via the Date [now()](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/now) function (if available) and falls back to (new Date()).[getTime()](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime) if now() is unavailable (IE8 or less). Default is false. |
7575
| disableAjaxTracking | boolean | false | If true, Ajax calls aren't autocollected. Default is false. |
76-
| disableFetchTracking | boolean | false | If true, Fetch requests aren't autocollected. Default is false (Since v2.8.0, previously true) |
76+
| disableFetchTracking | boolean | false | The default setting for `disableFetchTracking` is `false`, meaning it's enabled. However, in versions prior to 2.8.10, it was disabled by default. When set to `true`, Fetch requests aren't automatically collected. The default setting changed from `true` to `false` in version 2.8.0. |
7777
| excludeRequestFromAutoTrackingPatterns | string[] \| RegExp[] | undefined | Provide a way to exclude specific route from automatic tracking for XMLHttpRequest or Fetch request. If defined, for an Ajax / fetch request that the request url matches with the regex patterns, auto tracking is turned off. Default is undefined. |
7878
| addRequestContext | (requestContext: IRequestionContext) => {[key: string]: any} | undefined | Provide a way to enrich dependencies logs with context at the beginning of api call. Default is undefined. You need to check if `xhr` exists if you configure `xhr` related context. You need to check if `fetch request` and `fetch response` exist if you configure `fetch` related context. Otherwise you may not get the data you need. |
7979
| overridePageViewDuration | boolean | false | If true, default behavior of trackPageView is changed to record end of page view duration interval when trackPageView is called. If false and no custom duration is provided to trackPageView, the page view performance is calculated using the navigation timing API. Default is false. |
@@ -86,7 +86,7 @@ These configuration fields are optional and default to false unless otherwise st
8686
| disableFlushOnBeforeUnload | boolean | false | Default false. If true, flush method isn't called when onBeforeUnload event triggers |
8787
| enableSessionStorageBuffer | boolean | true | Default true. If true, the buffer with all unsent telemetry is stored in session storage. The buffer is restored on page load |
8888
| cookieCfg | [ICookieCfgConfig](javascript-sdk-advanced.md#cookies)<br>[Optional]<br>(Since 2.6.0) | undefined | Defaults to cookie usage enabled see [ICookieCfgConfig](javascript-sdk-advanced.md#cookies) settings for full defaults. |
89-
| ~~isCookieUseDisabled~~<br>disableCookiesUsage | alias for [`cookieCfg.enabled`](javascript-sdk-advanced.md#cookies)<br>[Optional] | false | Default false. A boolean that indicates whether to disable the use of cookies by the SDK. If true, the SDK doesn't store or read any data from cookies. isCookieUseDisable is deprecated in favor of disableCookiesUsage, when both are provided disableCookiesUsage takes precedence.<br>(Since v2.6.0) If `cookieCfg.enabled` is defined it will take precedence over these values, Cookie usage can be re-enabled after initialization via the core.getCookieMgr().setEnabled(true). |
89+
| disableCookiesUsage | alias for [`cookieCfg.enabled`](javascript-sdk-advanced.md#cookies)<br>[Optional] | false | Default false. A boolean that indicates whether to disable the use of cookies by the SDK. If true, the SDK doesn't store or read any data from cookies.<br>(Since v2.6.0) If `cookieCfg.enabled` is defined it takes precedence. Cookie usage can be re-enabled after initialization via the core.getCookieMgr().setEnabled(true). |
9090
| cookieDomain | alias for [`cookieCfg.domain`](javascript-sdk-advanced.md#cookies)<br>[Optional] | null | Custom cookie domain. It's helpful if you want to share Application Insights cookies across subdomains.<br>(Since v2.6.0) If `cookieCfg.domain` is defined it takes precedence over this value. |
9191
| cookiePath | alias for [`cookieCfg.path`](javascript-sdk-advanced.md#cookies)<br>[Optional]<br>(Since 2.6.0) | null | Custom cookie path. It's helpful if you want to share Application Insights cookies behind an application gateway.<br>If `cookieCfg.path` is defined, it takes precedence. |
9292
| isRetryDisabled | boolean | false | Default false. If false, retry on 206 (partial success), 408 (timeout), 429 (too many requests), 500 (internal server error), 503 (service unavailable), and 0 (offline, only if detected) |
@@ -130,7 +130,7 @@ You can control cookies by enabling or disabling them, setting custom domains an
130130

131131
### Cookie configuration
132132

133-
ICookieMgrConfig is a cookie configuration for instance-based cookie management added in 2.6.0. The options provided allow you to enable or disable the use of cookies by the SDK.[0] You can also set custom cookie domains and paths and customize the functions for fetching, setting, and deleting cookies.
133+
ICookieMgrConfig is a cookie configuration for instance-based cookie management added in 2.6.0. The options provided allow you to enable or disable the use of cookies by the SDK. You can also set custom cookie domains and paths and customize the functions for fetching, setting, and deleting cookies.
134134

135135
The ICookieMgrConfig options are defined in the following table.
136136

@@ -173,27 +173,6 @@ Tree shaking eliminates unused code from the final JavaScript bundle.
173173

174174
To take advantage of tree shaking, import only the necessary components of the SDK into your code. By doing so, unused code isn't included in the final bundle, reducing its size and improving performance.
175175

176-
For example, if you only need to track page views and exceptions, you can import only the required components of the SDK as follows:
177-
178-
```javascript
179-
import { ApplicationInsights } from "@microsoft/applicationinsights-web";
180-
import { PageView, Exception } from "@microsoft/applicationinsights-web/dist/classes/Telemetry/PageView";
181-
182-
const appInsights = new ApplicationInsights({
183-
config: {
184-
connectionString: "YOUR_CONNECTION_STRING",
185-
extensions: [
186-
new PageView(),
187-
new Exception()
188-
],
189-
...
190-
}
191-
});
192-
appInsights.loadAppInsights();
193-
```
194-
195-
In this example, only the PageView and Exception components of the SDK are imported, and the rest of the SDK components aren't included in the final bundle.
196-
197176
### Tree shaking enhancements and recommendations
198177

199178
In version 2.6.0, we deprecated and removed the internal usage of these static helper classes to improve support for tree-shaking algorithms. It lets npm packages safely drop unused code.

articles/azure-monitor/app/javascript-sdk.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js",
8080
crossOrigin: "anonymous",
8181
onInit: function (sdk) {
8282
sdk.addTelemetryInitializer(function (envelope) {
83+
envelope.data = envelope.data || {};
8384
envelope.data.someField = 'This item passed through my telemetry initializer';
8485
});
8586
}, // Once the application insights instance has loaded and initialized this method will be called
@@ -109,6 +110,9 @@ When you enable the App Insights JavaScript SDK, the following data classes are
109110
- Device information (for example, Browser, OS, version, language, model)
110111
- Session information
111112

113+
> [!Note]
114+
> For some applications, such as single-page applications (SPAs), the duration may not be recorded and will default to 0.
115+
112116
For more information, see the following link: https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-monitor/app/data-retention-privacy.md
113117

114118
## Confirm data is flowing

0 commit comments

Comments
 (0)