From 496858d8e6c8c3018bc6794a34cf21d5ebe7b4d1 Mon Sep 17 00:00:00 2001 From: tom goriunov Date: Wed, 15 Nov 2023 16:02:03 -0300 Subject: [PATCH] GA: fix inline-script CSP issue (#1358) Fixes #1353 --- nextjs/csp/policies/googleAnalytics.ts | 2 +- ui/shared/GoogleAnalytics.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nextjs/csp/policies/googleAnalytics.ts b/nextjs/csp/policies/googleAnalytics.ts index 437d2c527c..a6d3f7b84a 100644 --- a/nextjs/csp/policies/googleAnalytics.ts +++ b/nextjs/csp/policies/googleAnalytics.ts @@ -16,7 +16,7 @@ export function googleAnalytics(): CspDev.DirectiveDescriptor { ], 'script-src': [ // inline script hash, see ui/shared/GoogleAnalytics.tsx - '\'sha256-NTmEg2dBnojQfTYrYJEmp3nG7V66756qPbQMCIBrctk=\'', + '\'sha256-WXRwCtfSfMoCPzPUIOUAosSaADdGgct0/Lhmnbm7MCA=\'', 'https://www.googletagmanager.com', '*.google-analytics.com', '*.analytics.google.com', diff --git a/ui/shared/GoogleAnalytics.tsx b/ui/shared/GoogleAnalytics.tsx index efd8473d9e..70639752a4 100644 --- a/ui/shared/GoogleAnalytics.tsx +++ b/ui/shared/GoogleAnalytics.tsx @@ -20,7 +20,7 @@ const GoogleAnalytics = () => { window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); - gtag('config', '${ id }'); + gtag('config', window.__envs.NEXT_PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID); ` }