@@ -18,9 +18,55 @@ const logAction = (action, state) => {
1818 // TODO trackSiteSearch ?
1919 // https://developer.matomo.org/guides/tracking-javascript-guide
2020 return trackMatomoEvent ( "List controls" , "Search" , "Search box" ) ;
21+ case "ZOOM_IN" :
22+ return trackZoomIn ( action , state ) ;
23+ case "ZOOM_OUT" :
24+ return trackZoomOut ( action ) ;
25+ case "SELECT_PAPER" :
26+ return trackSelectPaper ( action ) ;
27+ case "DESELECT_PAPER" :
28+ return trackDeselectPaper ( action ) ;
2129 default :
2230 return ;
2331 }
2432} ;
2533
2634export default logAction ;
35+
36+ const trackZoomIn = ( action , state ) => {
37+ if ( ! action . isFromBackButton ) {
38+ return ;
39+ }
40+
41+ if ( action . selectedPaperData ) {
42+ return trackSelectPaper ( action ) ;
43+ }
44+
45+ if ( state . selectedPaper ) {
46+ return trackDeselectPaper ( action ) ;
47+ }
48+
49+ trackMatomoEvent ( "Browser buttons" , "Zoom in" , "Back/Forward button" ) ;
50+ } ;
51+
52+ const trackZoomOut = ( action ) => {
53+ if ( action . isFromBackButton ) {
54+ trackMatomoEvent ( "Browser buttons" , "Zoom out" , "Back/Forward button" ) ;
55+ }
56+ } ;
57+
58+ const trackSelectPaper = ( action ) => {
59+ if ( action . isFromBackButton ) {
60+ trackMatomoEvent ( "Browser buttons" , "Select paper" , "Back/Forward button" ) ;
61+ }
62+ } ;
63+
64+ const trackDeselectPaper = ( action ) => {
65+ if ( action . isFromBackButton ) {
66+ trackMatomoEvent (
67+ "Browser buttons" ,
68+ "Deselect paper" ,
69+ "Back/Forward button"
70+ ) ;
71+ }
72+ } ;
0 commit comments