diff --git a/web/app/components/base/ga/index.tsx b/web/app/components/base/ga/index.tsx index 33f8ffb010..759a91d18e 100644 --- a/web/app/components/base/ga/index.tsx +++ b/web/app/components/base/ga/index.tsx @@ -24,7 +24,8 @@ const GA: FC = ({ if (IS_CE_EDITION) return null - const nonce = process.env.NODE_ENV === 'production' ? (headers() as unknown as UnsafeUnwrappedHeaders).get('x-nonce') ?? '' : '' + const nonceValue = process.env.NODE_ENV === 'production' ? (headers() as unknown as UnsafeUnwrappedHeaders).get('x-nonce') : null + const nonce = nonceValue || undefined return ( <> @@ -40,20 +41,20 @@ const GA: FC = ({ window.gtag('config', '${gaIdMaps[gaType]}'); `, }} - nonce={nonce ?? undefined} + nonce={nonce} /> {/* Load GA script */}