File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import _debug from 'app/utils/debug';
88import Notifications from 'app/pages/common/Notifications' ;
99import Loading from 'app/components/Loading' ;
1010
11+ import send , { DNT } from 'common/utils/analytics' ;
12+
1113import Modals from './common/Modals' ;
1214import Sandbox from './Sandbox' ;
1315import NewSandbox from './NewSandbox' ;
@@ -88,9 +90,10 @@ class Routes extends React.Component<Props> {
8890 routeDebugger (
8991 `Sending '${ location . pathname + location . search } ' to ga.`
9092 ) ;
91- if ( typeof window . ga === 'function' ) {
93+ if ( typeof window . ga === 'function' && ! DNT ) {
9294 window . ga ( 'set' , 'page' , location . pathname + location . search ) ;
93- window . ga ( 'send' , 'pageview' ) ;
95+
96+ send ( 'pageview' ) ;
9497 }
9598 }
9699 return null ;
Original file line number Diff line number Diff line change 1+ export const DNT = ! ! (
2+ window . doNotTrack ||
3+ window . navigator . doNotTrack ||
4+ window . navigator . msDoNotTrack
5+ ) ;
6+
7+ export default function track ( eventName , secondArg : any ) {
8+ if ( window . ga && ! DNT ) {
9+ window . ga ( 'send' , secondArg ) ;
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments