File tree Expand file tree Collapse file tree 4 files changed +25
-15
lines changed
Expand file tree Collapse file tree 4 files changed +25
-15
lines changed Original file line number Diff line number Diff line change 11SENTRY_DSN = ' https://XXXX.ingest.sentry.io/00000000'
2- GA_GCODE = ' G-XXXXXXXXXXX '
2+ GA_UACODE = UA-XXXXXXXXXX
Original file line number Diff line number Diff line change @@ -7,15 +7,19 @@ import TaskControl from '../components/TaskControl/TaskControl';
77import HeaderMenu from '../components/HeaderMenu/HeaderMenu' ;
88import HoursScreen from './hours/HoursScreen' ;
99import Dashboard from './dashboard/Dashboard' ;
10- import analytics from '../services/GaService' ;
10+ import GaService from '../services/GaService' ;
1111
1212const { Header } = Layout ;
1313
1414const Main = ( ) => {
1515 const location = useLocation ( ) ;
1616
1717 useEffect ( ( ) => {
18- analytics ?. pageview ( location . pathname ) . event ( 'Event' , 'test' ) . send ( ) ;
18+ let path = location . pathname ;
19+ if ( path . includes ( 'index.html' ) ) {
20+ path = '/' ;
21+ }
22+ GaService . pageView ( path ) ;
1923 } , [ location . pathname ] ) ;
2024
2125 return (
@@ -34,10 +38,10 @@ const Main = () => {
3438 < TaskControl />
3539 </ Header >
3640 < Switch >
37- < Redirect exact from = "/" to = "/projects" />
3841 < Route path = "/hours" component = { HoursScreen } />
3942 < Route path = "/projects" component = { ProjectsScreen } />
4043 < Route path = "/dashboard" component = { Dashboard } />
44+ < Redirect from = "*" to = "/projects" />
4145 </ Switch >
4246 </ Layout >
4347 ) ;
Original file line number Diff line number Diff line change 11import ua from 'universal-analytics' ;
22
3- const gaCode = process . env . GA_GCODE ;
3+ const isProd = true ; //process.env.NODE_ENV === 'production';
4+
5+ const gaCode = process . env . GA_UACODE ;
46let analytics : any | null = null ;
57console . log ( gaCode ) ;
68if ( gaCode ) {
79 debugger ;
810 analytics = ua ( gaCode ) ;
911}
1012
11- export default analytics ;
13+ const GaService = {
14+ pageView ( path : string ) {
15+ if ( isProd ) {
16+ analytics ?. pageview ( path ) . send ( ) ;
17+ }
18+ } ,
19+ event ( category : string , action : string ) {
20+ if ( isProd ) {
21+ analytics ?. event ( category , action ) . send ( ) ;
22+ }
23+ } ,
24+ } ;
25+
26+ export default GaService ;
Original file line number Diff line number Diff line change @@ -10460,15 +10460,6 @@ universal-analytics@^0.4.23:
1046010460 request "^2.88.2"
1046110461 uuid "^3.0.0"
1046210462
10463- universal-analytics@0.4.23 :
10464- version "0.4.23"
10465- resolved "https://registry.yarnpkg.com/universal-analytics/-/universal-analytics-0.4.23.tgz#d915e676850c25c4156762471bdd7cf2eaaca8ac"
10466- integrity sha512-lgMIH7XBI6OgYn1woDEmxhGdj8yDefMKg7GkWdeATAlQZFrMrNyxSkpDzY57iY0/6fdlzTbBV03OawvvzG+q7A==
10467- dependencies :
10468- debug "^4.1.1"
10469- request "^2.88.2"
10470- uuid "^3.0.0"
10471-
1047210463universalify@^0.1.0 :
1047310464 version "0.1.2"
1047410465 resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
You can’t perform that action at this time.
0 commit comments