Skip to content

Commit ac4adda

Browse files
authored
feat: 1323 add ga tag to assess usage of full map view (#1340)
added GA tag to Download Latest, Open Full Quality Report and Open Detailed Map
1 parent c5f7844 commit ac4adda

File tree

6 files changed

+154
-149
lines changed

6 files changed

+154
-149
lines changed

web-app/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
"i18next-browser-languagedetector": "^8.0.0",
2626
"i18next-http-backend": "^2.5.2",
2727
"leaflet": "^1.9.4",
28-
"maplibre-gl": "^4.7.1",
28+
"maplibre-gl": "^5.7.0",
2929
"material-react-table": "^2.13.0",
3030
"mui-datatables": "^4.3.0",
3131
"mui-nested-menu": "^3.4.0",
3232
"openapi-fetch": "^0.9.3",
33-
"pmtiles": "^4.2.1",
33+
"pmtiles": "^4.3.0",
3434
"react": "^17.0.0 || ^18.0.0",
3535
"react-dom": "^17.0.0 || ^18.0.0",
3636
"react-ga4": "^2.1.0",
@@ -39,7 +39,7 @@
3939
"react-hook-form": "^7.52.1",
4040
"react-i18next": "^14.1.2",
4141
"react-leaflet": "^4.2.1",
42-
"react-map-gl": "^7.1.7",
42+
"react-map-gl": "^8.0.4",
4343
"react-redux": "^8.1.3",
4444
"react-router-dom": "^6.16.0",
4545
"react-scripts": "5.0.1",

web-app/public/locales/en/feeds.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,6 @@
160160
"no": "No",
161161
"notSure": "Unsure"
162162
}
163-
}
163+
},
164+
"openDetailedMap": "Open Detailed Map"
164165
}

web-app/src/app/components/CoveredAreaMap.tsx

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Typography,
1010
Fab,
1111
} from '@mui/material';
12+
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
1213
import { Link } from 'react-router-dom';
1314
import MapIcon from '@mui/icons-material/Map';
1415
import TravelExploreIcon from '@mui/icons-material/TravelExplore';
@@ -34,6 +35,7 @@ import ModeOfTravelIcon from '@mui/icons-material/ModeOfTravel';
3435
import { GtfsVisualizationMap } from './GtfsVisualizationMap';
3536
import ZoomOutMapIcon from '@mui/icons-material/ZoomOutMap';
3637
import { useRemoteConfig } from '../context/RemoteConfigProvider';
38+
import ReactGA from 'react-ga4';
3739

3840
interface CoveredAreaMapProps {
3941
boundingBox?: LatLngExpression[];
@@ -127,6 +129,14 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
127129
if (newView !== null) setView(newView);
128130
};
129131

132+
const handleOpenDetailedMapClick = (): void => {
133+
ReactGA.event({
134+
category: 'engagement',
135+
action: 'gtfs_visualization_open_detailed_map',
136+
label: 'Open Detailed Map',
137+
});
138+
};
139+
130140
const getGbfsLatestVersionVisualizationUrl = (
131141
feed: GBFSFeedType,
132142
): string | undefined => {
@@ -217,8 +227,15 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
217227
>
218228
{view === 'gtfsVisualizationView' &&
219229
config.enableGtfsVisualizationMap && (
220-
<Button component={Link} to='./map'>
221-
Open Full Map with Filters
230+
<Button
231+
variant='contained'
232+
disableElevation
233+
component={Link}
234+
to='./map'
235+
onClick={handleOpenDetailedMapClick}
236+
endIcon={<OpenInNewIcon></OpenInNewIcon>}
237+
>
238+
{t('openDetailedMap')}
222239
</Button>
223240
)}
224241
{feed?.data_type === 'gbfs' ? (
@@ -275,13 +292,15 @@ const CoveredAreaMap: React.FC<CoveredAreaMapProps> = ({
275292
</Tooltip>
276293
{config.enableGtfsVisualizationMap && (
277294
<Tooltip title={t('gtfsVisualizationTooltip')}>
278-
<ToggleButton
279-
value='gtfsVisualizationView'
280-
disabled={!config.enableGtfsVisualizationMap}
281-
aria-label='Bounding Box View'
282-
>
283-
<ModeOfTravelIcon />
284-
</ToggleButton>
295+
<span>
296+
<ToggleButton
297+
value='gtfsVisualizationView'
298+
disabled={!config.enableGtfsVisualizationMap}
299+
aria-label='Bounding Box View'
300+
>
301+
<ModeOfTravelIcon />
302+
</ToggleButton>
303+
</span>
285304
</Tooltip>
286305
)}
287306
</ToggleButtonGroup>

web-app/src/app/screens/Feed/components/FeedSummary.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
selectGtfsDatasetRouteTypes,
5454
} from '../../../store/selectors';
5555
import { getRouteTypeTranslatedName } from '../../../constants/RouteTypes';
56+
import ReactGA from 'react-ga4';
5657

5758
export interface FeedSummaryProps {
5859
feed: GTFSFeedType | GTFSRTFeedType | undefined;
@@ -78,6 +79,14 @@ export default function FeedSummary({
7879
const totalRoutes = useSelector(selectGtfsDatasetRoutesTotal);
7980
const routeTypes = useSelector(selectGtfsDatasetRouteTypes);
8081

82+
const handleOpenDetailedMapClick = (): void => {
83+
ReactGA.event({
84+
category: 'engagement',
85+
action: 'gtfs_visualization_open_detailed_map',
86+
label: 'Open Detailed Map',
87+
});
88+
};
89+
8190
return (
8291
<ContentBox
8392
width={width}
@@ -170,6 +179,7 @@ export default function FeedSummary({
170179
to='./map'
171180
color={'primary'}
172181
disabled={totalRoutes == undefined}
182+
onClick={handleOpenDetailedMapClick}
173183
>
174184
<TravelExploreIcon></TravelExploreIcon>
175185
</IconButton>
@@ -203,6 +213,7 @@ export default function FeedSummary({
203213
to='./map'
204214
color={'primary'}
205215
disabled={routeTypes == undefined}
216+
onClick={handleOpenDetailedMapClick}
206217
>
207218
<TravelExploreIcon></TravelExploreIcon>
208219
</IconButton>

web-app/src/app/screens/Feed/index.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import DownloadIcon from '@mui/icons-material/Download';
6666
import GbfsFeedInfo from './components/GbfsFeedInfo';
6767
import GbfsVersions from './components/GbfsVersions';
6868
import generateFeedStructuredData from './StructuredData.functions';
69+
import ReactGA from 'react-ga4';
6970

7071
const wrapComponent = (
7172
feedLoadingStatus: string,
@@ -124,6 +125,22 @@ const wrapComponent = (
124125
);
125126
};
126127

128+
const handleDownloadLatestClick = (): void => {
129+
ReactGA.event({
130+
category: 'engagement',
131+
action: 'download_latest_dataset',
132+
label: 'Download Latest Dataset',
133+
});
134+
};
135+
136+
const handleOpenFullQualityReportClick = (): void => {
137+
ReactGA.event({
138+
category: 'engagement',
139+
action: 'open_full_quality_report',
140+
label: 'Open Full Quality Report',
141+
});
142+
};
143+
127144
export default function Feed(): React.ReactElement {
128145
const { t } = useTranslation('feeds');
129146
const theme = useTheme();
@@ -532,6 +549,7 @@ export default function Feed(): React.ReactElement {
532549
rel='noreferrer nofollow'
533550
id='download-latest-button'
534551
endIcon={<DownloadIcon></DownloadIcon>}
552+
onClick={handleDownloadLatestClick}
535553
>
536554
{t('downloadLatest')}
537555
</Button>
@@ -544,6 +562,7 @@ export default function Feed(): React.ReactElement {
544562
target='_blank'
545563
rel='noreferrer nofollow'
546564
endIcon={<OpenInNewIcon></OpenInNewIcon>}
565+
onClick={handleOpenFullQualityReportClick}
547566
>
548567
{t('openFullQualityReport')}
549568
</Button>

0 commit comments

Comments
 (0)