From afe79b079a2bf076826588ae76e301bd4a3d5308 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 29 Aug 2024 14:46:50 +0100 Subject: [PATCH] 121116 updated to Ga4 --- pages/_app.js | 4 +++- pages/_document.js | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pages/_app.js b/pages/_app.js index d5ed2ded..51a446d4 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -6,7 +6,8 @@ import { useStore, Provider } from "react-redux"; import { persistStore } from "redux-persist"; import { PersistGate } from "redux-persist/integration/react"; import { SessionProvider as AuthProvider } from "next-auth/react"; - +import { Tracking } from "../components/tracking"; +import { GoogleAnalytics } from "@next/third-parties/google"; const MyApp = ({ Component, pageProps: { session, ...pageProps } }) => { const store = useStore((state) => state); const persistor = persistStore(store, {}, function () { @@ -21,6 +22,7 @@ const MyApp = ({ Component, pageProps: { session, ...pageProps } }) => { loading={} > + diff --git a/pages/_document.js b/pages/_document.js index 7c532ec1..285b594d 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -38,11 +38,12 @@ class MyDocument extends Document { csp += `base-uri 'self';`; csp += `form-action 'self' ` + process.env.NEXTAUTH_URL + ` ;`; csp += `object-src 'self' data:;`; - csp += - `script-src 'self' ` + - process.env.NEXTAUTH_URL + - ` 'unsafe-inline' https://www.googletagmanager.com https://maps.googleapis.com 'nonce-${generatedNonce}' 'unsafe-eval';`; - csp += `style-src 'self' https://fonts.googleapis.com 'unsafe-inline' data:;`; + csp += `default-src 'self' https://www.google-analytics.com;`; + csp += `connect-src 'self' https://region1.google-analytics.com;`; + csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`; + csp += `style-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://www.google-analytics.com https://tagmanager.google.com/ https://www.googletagmanager.com/ https://fonts.googleapis.com/;`; + csp += `img-src 'self' 'unsafe-inline' https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ data:;`; + csp += `font-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://fonts.gstatic.com/ data:;`; return ( @@ -50,10 +51,11 @@ class MyDocument extends Document { {useGATracking && ( )} + {/* */} {useGATracking && (