Fix Google Ana;ytics.

This commit is contained in:
James Cole 2019-07-13 20:57:29 +02:00
parent 3eb695f2ad
commit 2210b8054d
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -36,7 +36,7 @@ class SecureHeaders
* Handle an incoming request. May not be a limited user (ie. Sandstorm env. or demo user).
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Closure $next
*
* @return mixed
*/
@ -44,9 +44,11 @@ class SecureHeaders
{
$response = $next($request);
$google = '';
$googleImg = '';
$analyticsId = config('firefly.analytics_id');
if ('' !== $analyticsId) {
$google = 'www.googletagmanager.com/gtag/js'; // @codeCoverageIgnore
$google = 'www.googletagmanager.com/gtag/js https://www.google-analytics.com/analytics.js'; // @codeCoverageIgnore
$googleImg = 'https://www.google-analytics.com/';
}
$csp = [
"default-src 'none'",
@ -56,7 +58,7 @@ class SecureHeaders
"base-uri 'self'",
"font-src 'self' data:",
"connect-src 'self'",
"img-src 'self' data: https://api.tiles.mapbox.com",
sprintf("img-src 'self' data: https://api.tiles.mapbox.com %s", $googleImg),
"manifest-src 'self'",
];