-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(analytics): log mode and no_trips in tapped_departure (#650)
- Loading branch information
1 parent
e8cb31f
commit 1fa3576
Showing
11 changed files
with
179 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// DestinationRowAnalytics.swift | ||
// iosApp | ||
// | ||
// Created by Horn, Melody on 2025-01-13. | ||
// Copyright © 2025 MBTA. All rights reserved. | ||
// | ||
|
||
import FirebaseAnalytics | ||
import shared | ||
|
||
protocol DestinationRowAnalytics { | ||
func tappedDeparture( | ||
routeId: String, | ||
stopId: String, | ||
pinned: Bool, | ||
alert: Bool, | ||
routeType: RouteType, | ||
noTrips: RealtimePatterns.NoTripsFormat? | ||
) | ||
} | ||
|
||
extension AnalyticsProvider: DestinationRowAnalytics { | ||
func tappedDeparture( | ||
routeId: String, | ||
stopId: String, | ||
pinned: Bool, | ||
alert: Bool, | ||
routeType: RouteType, | ||
noTrips: RealtimePatterns.NoTripsFormat? | ||
) { | ||
let mode = switch routeType { | ||
case .bus: "bus" | ||
case .commuterRail: "commuter rail" | ||
case .ferry: "ferry" | ||
case .heavyRail: "subway" | ||
case .lightRail: "subway" | ||
} | ||
let noTrips = switch onEnum(of: noTrips) { | ||
case .noSchedulesToday: "no service today" | ||
case .predictionsUnavailable: "predictions unavailable" | ||
case .serviceEndedToday: "service ended" | ||
case nil: "" | ||
} | ||
logEvent( | ||
"tapped_departure", | ||
parameters: [ | ||
"route_id": routeId, | ||
"stop_id": stopId, | ||
"pinned": pinned ? "true" : "false", | ||
"alert": alert ? "true" : "false", | ||
"mode": mode, | ||
"no_trips": noTrips, | ||
] | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.