File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9393 </ script >
9494</ body >
9595
96+ <!-- Matomo -->
97+ < script >
98+ // set this to true to enable Matomo tracking
99+ var enable_tracking = false ;
100+ if ( enable_tracking ) {
101+ var _paq = window . _paq = window . _paq || [ ] ;
102+ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
103+ _paq . push ( [ 'trackPageView' ] ) ;
104+ _paq . push ( [ 'enableLinkTracking' ] ) ;
105+ ( function ( ) {
106+ var u = "//dev.openknowledgemaps.org/piwik_stats/" ;
107+ _paq . push ( [ 'setTrackerUrl' , u + 'matomo.php' ] ) ;
108+ _paq . push ( [ 'setSiteId' , '1' ] ) ;
109+ var d = document , g = d . createElement ( 'script' ) , s = d . getElementsByTagName ( 'script' ) [ 0 ] ;
110+ g . async = true ; g . src = u + 'matomo.js' ; s . parentNode . insertBefore ( g , s ) ;
111+ } ) ( ) ;
112+ }
113+ </ script >
114+ <!-- End Matomo Code -->
115+
96116</ html >
Original file line number Diff line number Diff line change 115115 </ script >
116116</ body >
117117
118+ <!-- Matomo -->
119+ < script >
120+ // set this to true to enable Matomo tracking
121+ var enable_tracking = false ;
122+ if ( enable_tracking ) {
123+ var _paq = window . _paq = window . _paq || [ ] ;
124+ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
125+ _paq . push ( [ 'trackPageView' ] ) ;
126+ _paq . push ( [ 'enableLinkTracking' ] ) ;
127+ ( function ( ) {
128+ var u = "//dev.openknowledgemaps.org/piwik_stats/" ;
129+ _paq . push ( [ 'setTrackerUrl' , u + 'matomo.php' ] ) ;
130+ _paq . push ( [ 'setSiteId' , '1' ] ) ;
131+ var d = document , g = d . createElement ( 'script' ) , s = d . getElementsByTagName ( 'script' ) [ 0 ] ;
132+ g . async = true ; g . src = u + 'matomo.js' ; s . parentNode . insertBefore ( g , s ) ;
133+ } ) ( ) ;
134+ }
135+ </ script >
136+ <!-- End Matomo Code -->
137+
118138</ html >
Original file line number Diff line number Diff line change @@ -4,9 +4,16 @@ import { connect } from "react-redux";
44import { openCitationModal } from "../../actions" ;
55import { useLocalizationContext } from "../../components/LocalizationProvider" ;
66import { STREAMGRAPH_MODE } from "../../reducers/chartType" ;
7+ import useMatomo from "../../utils/useMatomo" ;
78
89const CitationButton = ( { isStreamgraph, onClick } ) => {
910 const localization = useLocalizationContext ( ) ;
11+ const { trackEvent } = useMatomo ( ) ;
12+
13+ const handleClick = ( ) => {
14+ onClick ( ) ;
15+ trackEvent ( "Added components" , "Open cite modal" , "Cite button" ) ;
16+ } ;
1017
1118 return (
1219 // html template starts here
@@ -18,7 +25,7 @@ const CitationButton = ({ isStreamgraph, onClick }) => {
1825 ? localization . cite_title_sg
1926 : localization . cite_title_km
2027 }
21- onClick = { onClick }
28+ onClick = { handleClick }
2229 >
2330 < span id = "citationlink" >
2431 < i className = "fa fa-quote-right fa-fw" aria-hidden = "true" > </ i > { " " }
Original file line number Diff line number Diff line change @@ -3,14 +3,28 @@ import React from "react";
33import okmapsRoundLogo from "../../../images/okmaps-logo-round.svg" ;
44
55import { getDateTimeFromTimestamp } from "../../utils/dates" ;
6+ import useMatomo from "../../utils/useMatomo" ;
67
78const CreatedBy = ( { timestamp, faqsUrl } ) => {
89 const dateTime = getDateTimeFromTimestamp ( timestamp ) ;
10+ const { trackEvent } = useMatomo ( ) ;
11+
12+ const trackVisLink = ( ) =>
13+ trackEvent (
14+ "Added components" ,
15+ "Open this visualization" ,
16+ "Visualization link in footer"
17+ ) ;
918
1019 return (
1120 < div className = "builtwith" id = "builtwith" >
1221 < img src = { okmapsRoundLogo } alt = "OKMaps round logo" /> { " " }
13- < a href = { window . location . href } target = "_blank" rel = "noreferrer" >
22+ < a
23+ href = { window . location . href }
24+ target = "_blank"
25+ rel = "noreferrer"
26+ onClick = { trackVisLink }
27+ >
1428 This visualization
1529 </ a > { " " }
1630 was created by{ " " }
You can’t perform that action at this time.
0 commit comments