Skip to content

Commit 2d01ecc

Browse files
committed
Adding 'cr' JS SDK config option
1 parent 46bf5c4 commit 2d01ecc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

articles/azure-monitor/app/javascript-feature-extensions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Users can set up the Click Analytics Auto-Collection plug-in via JavaScript (Web
9090
!function(v,y,T){<!-- Removed the JavaScript (Web) SDK Loader Script code for brevity -->}(window,document,{
9191
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js",
9292
crossOrigin: "anonymous",
93+
// cr: 0,
9394
cfg: configObj // configObj is defined above.
9495
});
9596
</script>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Two methods are available to add the code to enable Application Insights via the
6060
// useXhr: 1,
6161
crossOrigin: "anonymous",
6262
// onInit: null,
63+
// cr: 0,
6364
cfg: { // Application Insights Configuration
6465
connectionString: "YOUR_CONNECTION_STRING"
6566
}});
@@ -80,6 +81,7 @@ Two methods are available to add the code to enable Application Insights via the
8081
| useXhr | boolean | Optional | This setting is used only for reporting SDK load failures. For example, this setting is useful when the JavaScript (Web) SDK Loader Script is preventing the HTML page from loading, causing fetch() to be unavailable.<br><br>Reporting first attempts to use fetch() if available and then fallback to XHR. Set this setting to `true` to bypass the fetch check. This setting is only required if your application is being used in an environment where fetch would fail to send the failure events such as if the JavaScript (Web) SDK Loader Script isn't loading successfully.
8182
| crossOrigin | string | Optional | By including this setting, the script tag added to download the SDK includes the crossOrigin attribute with this string value. Use this setting when you need to provide support for CORS. When not defined (the default), no crossOrigin attribute is added. Recommended values are not defined (the default), "", or "anonymous". For all valid values, see the [cross origin HTML attribute](https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin) documentation.
8283
| onInit | function(aiSdk) { ... } | Optional | This callback function is called after the main SDK script has been successfully loaded and initialized from the CDN (based on the src value). This callback function is useful when you need to insert a telemetry initializer. It's passed one argument, which is a reference to the SDK instance that's being called for and is also called before the first initial page view. If the SDK has already been loaded and initialized, this callback is still called. NOTE: During the processing of the sdk.queue array, this callback is called. You CANNOT add any more items to the queue because they're ignored and dropped. (Added as part of JavaScript (Web) SDK Loader Script version 5--the sv:"5" value within the script). |
84+
| cr | boolean | Optional | If the SDK fails to load and the endpoint value defined for `src` is supported by Application Insights, this configuration option attempts to immediately load the SDK from one of the following backup CDN endpoints:<br><br><ul><li>js.monitor.azure.com</li><li>js.cdn.applicationinsights.io</li><li>js.cdn.monitor.azure.com</li><li>js0.cdn.applicationinsights.io</li><li>js0.cdn.monitor.azure.com</li><li>js2.cdn.applicationinsights.io</li><li>js2.cdn.monitor.azure.com</li><li>az416426.vo.msecnd.net</li></ul><br><br>While az416426.vo.msecnd.net is supported, it's not recommended. If the SDK loads successfully from a backup CDN endpoint, it loads from the one that is most available. If it fails to load from any of them, the SDK Failure message appears.<br><br>When not defined, the default value is `true`. If you don’t want to load the SDK from the backup CDN endpoints, set this configuration option to `false`. Because from which backup CDN endpoint the SDK loads from is determined by availability, you can set it to `false` if you need to know from which CDN endpoint it will load from.<br><br>If you’re loading the SDK from your own privately hosted CDN endpoint, this configuration option is not applicable.
8385

8486
#### [npm package](#tab/npmpackage)
8587

0 commit comments

Comments
 (0)