From 7cb4a93387642138bce8493269625ec6058df7a9 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 29 May 2022 16:32:51 -0700 Subject: [PATCH] Change GA deprecated code. --- packages/webapp/src/app.tsx | 6 +++++- packages/webapp/src/components/editor-page/index.tsx | 2 +- .../webapp/src/components/forgot-password-page/index.tsx | 2 +- packages/webapp/src/components/login-page/index.tsx | 2 +- packages/webapp/src/components/maps-page/index.tsx | 2 +- packages/webapp/src/components/registration-page/index.tsx | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/webapp/src/app.tsx b/packages/webapp/src/app.tsx index 27660976..5902dce0 100644 --- a/packages/webapp/src/app.tsx +++ b/packages/webapp/src/app.tsx @@ -26,7 +26,11 @@ declare module '@mui/styles/defaultTheme' { } // Google Analytics Initialization. -ReactGA.initialize(AppConfig.getGoogleAnalyticsAccount()); +ReactGA.initialize([ + { + trackingId: AppConfig.getGoogleAnalyticsAccount(), + } +]); const queryClient = new QueryClient({ defaultOptions: { diff --git a/packages/webapp/src/components/editor-page/index.tsx b/packages/webapp/src/components/editor-page/index.tsx index 67c21af0..40d0eb4a 100644 --- a/packages/webapp/src/components/editor-page/index.tsx +++ b/packages/webapp/src/components/editor-page/index.tsx @@ -23,7 +23,7 @@ const EditorPage = ({ isTryMode }: EditorPropsType): React.ReactElement => { const client: Client = useSelector(activeInstance); useEffect(() => { - ReactGA.pageview(window.location.pathname + window.location.search); + ReactGA.send({ hitType: "pageview", page: window.location.pathname}); }, []); const findEditorMode = (isTryMode: boolean, mapId: number): EditorRenderMode | null => { diff --git a/packages/webapp/src/components/forgot-password-page/index.tsx b/packages/webapp/src/components/forgot-password-page/index.tsx index ab219b09..fda9c4d3 100644 --- a/packages/webapp/src/components/forgot-password-page/index.tsx +++ b/packages/webapp/src/components/forgot-password-page/index.tsx @@ -80,7 +80,7 @@ const ForgotPasswordPage = (): React.ReactElement => { const intl = useIntl(); useEffect(() => { document.title = intl.formatMessage({ id: 'forgot.page-title', defaultMessage: 'Forgot Password | WiseMapping' }); - ReactGA.pageview(window.location.pathname + window.location.search); + ReactGA.send({ hitType: "pageview", page: window.location.pathname}); },[]); return ( diff --git a/packages/webapp/src/components/login-page/index.tsx b/packages/webapp/src/components/login-page/index.tsx index ce2c83a2..f8d33b61 100644 --- a/packages/webapp/src/components/login-page/index.tsx +++ b/packages/webapp/src/components/login-page/index.tsx @@ -70,7 +70,7 @@ const LoginPage = (): React.ReactElement => { useEffect(() => { document.title = intl.formatMessage({id:'login.page-title',defaultMessage:'Login | WiseMapping'}); - ReactGA.pageview(window.location.pathname + window.location.search); + ReactGA.send({ hitType: "pageview", page: window.location.pathname}); },[]); return ( diff --git a/packages/webapp/src/components/maps-page/index.tsx b/packages/webapp/src/components/maps-page/index.tsx index fc931561..a6a50195 100644 --- a/packages/webapp/src/components/maps-page/index.tsx +++ b/packages/webapp/src/components/maps-page/index.tsx @@ -83,7 +83,7 @@ const MapsPage = (): ReactElement => { id: 'maps.page-title', defaultMessage: 'My Maps | WiseMapping', }); - ReactGA.pageview(window.location.pathname + window.location.search); + ReactGA.send({ hitType: "pageview", page: window.location.pathname}); }, []); const mutation = useMutation((id: number) => client.deleteLabel(id), { diff --git a/packages/webapp/src/components/registration-page/index.tsx b/packages/webapp/src/components/registration-page/index.tsx index 86500c00..178ce109 100644 --- a/packages/webapp/src/components/registration-page/index.tsx +++ b/packages/webapp/src/components/registration-page/index.tsx @@ -165,7 +165,7 @@ const RegistationPage = (): React.ReactElement => { id: 'registration.page-title', defaultMessage: 'Registration | WiseMapping', }); - ReactGA.pageview(window.location.pathname + window.location.search); + ReactGA.send({ hitType: "pageview", page: window.location.pathname}); },[]); return (