@@ -15,14 +15,10 @@ export default class SwupGaPlugin extends Plugin {
15
15
}
16
16
17
17
mount ( ) {
18
- this . swup . hooks . on ( 'page:view' , this . trackPageView ) ;
18
+ this . on ( 'page:view' , this . trackPageView ) ;
19
19
}
20
20
21
- unmount ( ) {
22
- this . swup . hooks . off ( 'page:view' , this . trackPageView ) ;
23
- }
24
-
25
- trackPageView = ( ) => {
21
+ trackPageView ( ) {
26
22
const title = document . title ;
27
23
const url = window . location . pathname + window . location . search ;
28
24
@@ -37,7 +33,7 @@ export default class SwupGaPlugin extends Plugin {
37
33
}
38
34
}
39
35
40
- trackPageViewInGtag = ( { title, url } ) => {
36
+ trackPageViewInGtag ( { title, url } ) {
41
37
const { gaMeasurementId } = this . options ;
42
38
if ( ! gaMeasurementId ) {
43
39
console . error ( 'The gaMeasurementId option is required for gtag.js' ) ;
@@ -50,7 +46,7 @@ export default class SwupGaPlugin extends Plugin {
50
46
} ) ;
51
47
}
52
48
53
- trackPageViewInGa = ( { title, url } ) => {
49
+ trackPageViewInGa ( { title, url } ) {
54
50
window . ga ( 'set' , 'title' , title ) ;
55
51
window . ga ( 'set' , 'page' , url ) ;
56
52
window . ga ( 'send' , 'pageview' ) ;
0 commit comments