@@ -5,18 +5,17 @@ export let trackEvent = (event, data) => {
5
5
console . log ( data ) ; // eslint-disable-line no-console
6
6
} ;
7
7
8
- if ( typeof window . ga !== 'undefined' ) {
8
+ if ( typeof window . gtag !== 'undefined' ) {
9
9
trackEvent = ( evt , data ) => {
10
- window . ga ( evt , data ) ;
10
+ window . gtag ( 'event' , evt , data ) ;
11
11
} ;
12
12
}
13
13
14
14
export const trackElement = ( el ) => {
15
15
return trackEvent ( 'send' , {
16
- hitType : 'event' ,
17
- eventCategory : el . getAttribute ( 'data-ga-category' ) || '' ,
18
- eventAction : el . getAttribute ( 'data-ga-action' ) || '' ,
19
- eventLabel : el . getAttribute ( 'data-ga-label' ) || '' ,
16
+ event_category : el . getAttribute ( 'data-ga-category' ) || '' ,
17
+ event_action : el . getAttribute ( 'data-ga-action' ) || '' ,
18
+ event_label : el . getAttribute ( 'data-ga-label' ) || '' ,
20
19
} ) ;
21
20
} ;
22
21
@@ -42,10 +41,9 @@ export default function initAnalytics() {
42
41
43
42
const afterPrint = ( ) => {
44
43
return trackEvent ( 'send' , {
45
- hitType : 'event' ,
46
- eventCategory : 'Print Intent' ,
47
- eventAction : 'Print Intent' ,
48
- eventLabel : window . location . pathname . split ( '/' ) . slice ( - 3 ) . join ( '/' ) ,
44
+ event_category : 'Print Intent' ,
45
+ event_action : 'Print Intent' ,
46
+ event_label : window . location . pathname . split ( '/' ) . slice ( - 3 ) . join ( '/' ) ,
49
47
} ) ;
50
48
} ;
51
49
0 commit comments