This commit is contained in:
Piotr Rogowski 2022-07-31 19:37:56 +02:00
parent a63a501991
commit 892181e0c5
No known key found for this signature in database
GPG Key ID: 4A842D702D9C6F8F
4 changed files with 19 additions and 0 deletions

1
.env
View File

@ -2,6 +2,7 @@ NPM_GITHUB_TOKEN=
VITE_ENVIRONMENT=development
VITE_WEB_URL=http://localhost:3000
VITE_SENTRY_DSN=
VITE_GTM_ID=
# TODO: remove this later
VITE_CDN_URL=

11
package-lock.json generated
View File

@ -23,6 +23,7 @@
"pako": "^2.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-ga4": "^1.4.1",
"react-markdown": "^8.0.3",
"react-perfect-scrollbar": "^1.5.8",
"react-redux": "^8.0.2",
@ -6402,6 +6403,11 @@
"react": "^18.2.0"
}
},
"node_modules/react-ga4": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/react-ga4/-/react-ga4-1.4.1.tgz",
"integrity": "sha512-ioBMEIxd4ePw4YtaloTUgqhQGqz5ebDdC4slEpLgy2sLx1LuZBC9iYCwDymTXzcntw6K1dHX183ulP32nNdG7w=="
},
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@ -12104,6 +12110,11 @@
"scheduler": "^0.23.0"
}
},
"react-ga4": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/react-ga4/-/react-ga4-1.4.1.tgz",
"integrity": "sha512-ioBMEIxd4ePw4YtaloTUgqhQGqz5ebDdC4slEpLgy2sLx1LuZBC9iYCwDymTXzcntw6K1dHX183ulP32nNdG7w=="
},
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",

View File

@ -33,6 +33,7 @@
"pako": "^2.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-ga4": "^1.4.1",
"react-markdown": "^8.0.3",
"react-perfect-scrollbar": "^1.5.8",
"react-redux": "^8.0.2",

View File

@ -3,6 +3,7 @@ import { Provider } from 'react-redux';
import { HashRouter } from 'react-router-dom';
import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
import ReactGA from 'react-ga4';
import App from './App';
import store from './store';
import {
@ -20,6 +21,11 @@ if (isProduction) {
tracesSampleRate: 0.2,
environment: environment as string,
});
if (import.meta.env.VITE_GTM_ID) {
ReactGA.initialize(import.meta.env.VITE_GTM_ID);
ReactGA.send({ hitType: 'pageview', page: window.location.hash });
}
}
const container = document.getElementById('root');