Infrastructure low complexity Shared Component mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Lightweight event tracker that records which expense types are selected and how often mutual exclusion is triggered, providing anonymised usage data to inform future UX improvements and catch misconfigured compatibility rules in production.

Feature: Expense Type Selection with Mutual Exclusion

expense-type-analytics-tracker

Summaries

The Expense Type Analytics Tracker provides the organisation with continuous, anonymised insight into how peer mentors actually use the expense submission workflow. By recording which expense categories are selected most frequently and how often mutual-exclusion rules prevent conflicting selections, the business gains evidence-based data to justify UX investment, detect configuration errors before they cause reimbursement disputes, and prioritise future product improvements. This directly reduces the risk of policy violations slipping through misconfigured rules in production, protecting the organisation from financial and compliance exposure. The anonymised design ensures user trust is preserved while still delivering the operational intelligence needed to maintain a high-quality, well-governed expense process across the entire peer mentor network.

The Expense Type Analytics Tracker is a low-complexity, zero-dependency component that can be delivered independently and integrated into the main expense flow late in the development cycle without blocking other workstreams. Its asynchronous flush mechanism means QA must verify that analytics events do not interfere with the critical submission path, requiring a dedicated negative-path test pass to confirm UI responsiveness under analytics failure scenarios. The component's shared status means it must be reviewed alongside every feature team that logs expense type selections, so a brief integration sign-off should be scheduled before each feature reaches staging. Backend analytics endpoint availability is an external dependency that should be confirmed during sprint planning to avoid last-minute blockers at deployment.

The Expense Type Analytics Tracker is a shared, mobile-execution-context service with four clearly scoped interfaces: trackTypeSelected, trackExclusionTriggered, trackValidationError, and flush. It carries no component-level dependencies, making it straightforward to inject via a service locator or BLoC provider. Events should be buffered locally and dispatched asynchronously via the flush method to prevent any network latency from touching the UI thread. Implement the buffer with a fixed-size queue and a time-based flush trigger to handle offline scenarios gracefully.

The trackExclusionTriggered interface accepts a trigger type and the full set of disabled types, enabling downstream aggregation of type-pair co-occurrence frequencies. Ensure all user-identifiable data is stripped before dispatch; use an opaque session token rather than any user ID.

Responsibilities

  • Track expense type selection events
  • Record mutual exclusion trigger frequency per type pair
  • Log validation errors for monitoring
  • Send events to analytics backend without blocking UI

Interfaces

trackTypeSelected(ExpenseType type)
trackExclusionTriggered(ExpenseType trigger, Set<ExpenseType> disabled)
trackValidationError(String error)
flush() → Future<void>

API Contract

View full contract →
REST /api/v1/analytics/expense-type-events 6 endpoints
GET /api/v1/analytics/expense-type-events List recorded analytics events for expense type interactions
GET /api/v1/analytics/expense-type-events/:id Get a specific analytics event by ID
POST /api/v1/analytics/expense-type-events Track a new expense type analytics event
PUT /api/v1/analytics/expense-type-events/:id Update or annotate an analytics event (e.g. mark flushed)
DELETE /api/v1/analytics/expense-type-events/:id Delete an analytics event record
POST /api/v1/analytics/expense-type-events/flush Flush all pending (unflushed) events to the analytics pipeline