From 8410d467f28d987b2cd8cfd7f045d31a41c0c5ed Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 19 Dec 2023 14:32:59 +0200 Subject: [PATCH] Add google analytics --- package.json | 1 + src/layout/ClientLayout.tsx | 3 --- src/pages/_app.js | 2 ++ yarn.lock | 12 ++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7e9052d42..c69df0ba8 100644 --- a/package.json +++ b/package.json @@ -131,6 +131,7 @@ "lodash.truncate": "^4.4.2", "next": "11.1.4", "next-themes": "^0.0.14", + "nextjs-google-analytics": "^2.3.3", "nextjs-progressbar": "^0.0.16", "node-html-markdown": "^1.2.0", "qr-code-styling": "^1.6.0-rc.1", diff --git a/src/layout/ClientLayout.tsx b/src/layout/ClientLayout.tsx index 0d8e2ffc1..6606c1313 100644 --- a/src/layout/ClientLayout.tsx +++ b/src/layout/ClientLayout.tsx @@ -5,7 +5,6 @@ import { LazyConnectionsProvider } from 'src/components/lazy-connection/LazyConn import OnBoardingContextsWrapper from 'src/components/onboarding/contexts/OnBoardingContextsWrapper' import { ResponsiveSizeProvider } from 'src/components/responsive' import config from 'src/config' -import { initGa } from 'src/ga' import { AuthProvider } from '../components/auth/AuthContext' import { MyAccountsProvider } from '../components/auth/MyAccountsContext' import { SubstrateProvider, SubstrateWebConsole } from '../components/substrate' @@ -16,8 +15,6 @@ const ChatFloatingModal = dynamic(() => import('../components/chat/ChatFloatingM ssr: false, }) -initGa(config.ga) - const ClientLayout: React.FunctionComponent = ({ children }) => { return ( diff --git a/src/pages/_app.js b/src/pages/_app.js index 1ae894787..113dae203 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -34,6 +34,7 @@ import '@subsocial/definitions/interfaces/types-lookup' import '@subsocial/definitions/interfaces/augment-types' import '@subsocial/definitions/interfaces/augment-api' import AnalyticProvider from 'src/providers/AnalyticContext' +import { GoogleAnalytics } from 'nextjs-google-analytics' dayjs.extend(relativeTime) dayjs.extend(localizedFormat) @@ -71,6 +72,7 @@ function MyApp(props) { /> {/* */} + diff --git a/yarn.lock b/yarn.lock index 6017d08cb..00718aade 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6836,6 +6836,11 @@ fsevents@^2.1.2, fsevents@~2.3.1, fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== +fsevents@^2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -9934,6 +9939,13 @@ next@11.1.4: "@next/swc-linux-x64-gnu" "11.1.4" "@next/swc-win32-x64-msvc" "11.1.4" +nextjs-google-analytics@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/nextjs-google-analytics/-/nextjs-google-analytics-2.3.3.tgz#8393804b89915b22d94e0fabb786bdd4012cb888" + integrity sha512-Y6sI6A7wt5dji8hYBnVkOh9LTyImSLFZXx3FpyQgVW7W4b4qEFHjH2u3fhDJsrRZeLlUGM8/RuHD/mhHc2Axfg== + optionalDependencies: + fsevents "^2.3.2" + nextjs-progressbar@^0.0.16: version "0.0.16" resolved "https://registry.yarnpkg.com/nextjs-progressbar/-/nextjs-progressbar-0.0.16.tgz#d2c1e54ffc2c6d52b64282c0d764a44241fbc36e"