Skip to content

feat: implement analytics tracking plan - #28

Merged
Sloy merged 2 commits into
masterfrom
feat/analytics-tracking-plan
Oct 8, 2026
Merged

Sloy merged 2 commits into
masterfrom
feat/analytics-tracking-plan

Conversation

@Sloy

@Sloy Sloy commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Implements SEVAND-12 (Implement analytics tracking plan): the tracking plan in backlog/docs/doc-2 - Analytics-tracking-plan.md.

Changes

  • Screen views: tracked by a process-level ScreenViewTracker from SevNavigator.transitions, so recreating the activity no longer tracks them again. Every screen view sends trigger (launch, navigation, back). Stop Details Viewed sends source and highlightedLineId.
  • Line Stops Viewed no longer fires on route switches; Route Direction Switched does.
  • Session Summary sent on background by SessionTracker, with sessionType, lastScreen and the usageProfile / isCommuter user properties from a 30-day local history.
  • User properties through Tracker.setUserProperty: Amplitude identify, Firebase user properties.
  • Arrivals: Arrivals Displayed once per screen view (stop detail, favorites, nearby), Arrivals Failed on every failed request, Stop Details Closed.
  • New events: login, logout, search, map stop taps, map explored, bottom sheet, location permission result, edit favorites saved/cancelled, card check/delete/reorder, night mode, app opened from NFC.
  • Fixes F1–F6: App Started once per process, Device ID kept on logout, property renames (lineLabel, cardType, durationSeconds), Card Check Completed outcomes.
  • Firebase receives booleans as 1/0 and lists as comma-separated strings. Null properties are no longer sent.
  • Arrival polling loops rethrow cancellation, so leaving the screen isn't tracked as a failure.

Decisions where the plan left room for interpretation are listed in doc-2, "Implementation notes".

Testing

  • ./gradlew test: 144 tests pass. New tests cover screen view sources and triggers, Line Stops on route switch, Arrivals Displayed per view, Stop Details Closed, session classification and lastScreen, Edit Favorites diff, Card Check Completed and the renamed properties.
  • ./gradlew validateDebugScreenshotTest: 85 pass.
  • Not yet checked on a device or in the Amplitude dev project (AC feat: migrate PathDto from points to polyline format #5).
  • The lastScreen values (for_you, stop_detail, ...) still need to be confirmed against the Amplitude tracking plan.

Sloy added 2 commits October 8, 2026 15:01
Implement the tracking plan in backlog doc-2 (SEVAND-12): 24 new events,
13 changed events and 8 Amplitude/Firebase user properties.

- Track screen views from SevNavigator transitions in a process-level
  ScreenViewTracker, with a trigger (launch, navigation, back) and the
  Stop Details source. App Started fires once per process
- Skip Line Stops Viewed on route switches and track Route Direction
  Switched instead
- Add SessionTracker to send Session Summary on background, with
  sessionType, lastScreen and the usageProfile/isCommuter user properties
- Add UserPropertiesTracker and Tracker.setUserProperty (Amplitude
  identify, Firebase user properties)
- Track Arrivals Displayed once per screen view and Arrivals Failed on
  every failed request, plus Stop Details Closed
- Add login, search, map, bottom sheet, location permission, edit
  favorites, cards, night mode and NFC events
- Keep the Amplitude Device ID on logout, rename the line, type and
  duration properties, and track Card Check Completed outcomes
- Send booleans and lists correctly to Firebase and skip null properties
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

✅ Screenshot tests passed

All screenshots match their references. Workflow run

@Sloy
Sloy merged commit 3566441 into master Oct 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant