IvanJosipovic / BlazorApplicationInsights

Application Insights for Blazor web applications

Home Page:https://BlazorApplicationInsights.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default configuration breaks Google Analytics tracking

samfromlv opened this issue · comments

In library description, in Install section there is sample snippet how to configure SDK in javascript.

There is setting enableCorsCorrelation which is set to true. In Application Insights SDK default for this setting is false. If enableCorsCorrelation is set to true, this can break CORS requests or fail OPTION requests made by the application.

For example using suggested configuration will break Google Analytics tracking with following error:

Access to XMLHttpRequest at 'https://www.google-analytics.com/j/collect?v=1&_v<removedforprivacy>' from origin 'https://www.<removedforprivacy>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Sample installation script should set enableCorsCorrelation to false or omit it.

Closing this as this field has been removed from the examples.