'integrated google analytics in react application but blocking analytics.js by content-security-policy which is added from backend asp.net core

enter image description here

string script_src = $"script-src 'self' 'unsafe-eval' 'unsafe-inline';";

context.Response.Headers.Add("Content-Security-Policy", new StringValues($"default-src 'self'; {script_src} style-src 'self' https://fonts.googleapis.com 'unsafe-inline'; font-src 'self' https://fonts.gstatic.com data: ; img-src 'self' blob: data: ; object-src 'self'; frame-ancestors 'none'; base-uri 'self'; upgrade-insecure-requests"));

above is existing code want to allow for this also https://www.google-analytics.com



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source