Skip to content

feat: Add analytics-agnostic events to UI components#112

Merged
roncodes merged 2 commits intodev-v0.3.19from
feat/universe-analytics-events
Feb 11, 2026
Merged

feat: Add analytics-agnostic events to UI components#112
roncodes merged 2 commits intodev-v0.3.19from
feat/universe-analytics-events

Conversation

@roncodes
Copy link
Member

@roncodes roncodes commented Feb 9, 2026

Overview

Adds analytics-agnostic event tracking to key ember-ui components through the universe service. Events follow dot notation naming convention (ui.{component}.{action}) and can be consumed by any analytics system.

Components Updated

1. Button Component

  • Opt-in tracking via @eventName and @eventArgs arguments
  • Event triggered before @onClick callback
  • Not triggered if button is disabled

Usage:

<Button
  @text="Save Order"
  @eventName="ui.button.clicked"
  @eventArgs={{array "save_order" @order.id}}
  @onClick={{this.saveOrder}}
/>

2. Modal Manager Service

  • Automatic tracking for all modals
  • ui.modal.opened - When modal is shown
  • ui.modal.closed - When modal is closed (with action: onConfirm/onDecline)

3. Dropdown Button Component

  • Opt-in tracking via @eventName argument
  • Event triggered when dropdown opens

4. Filters Picker Component

  • Automatic tracking for filter interactions
  • ui.filter.applied - When filters are applied (with activeFilters payload)
  • ui.filter.cleared - When filters are cleared

Event Naming Convention

All events follow: ui.{component}.{action}

Examples:

  • ui.button.clicked
  • ui.modal.opened
  • ui.modal.closed
  • ui.filter.applied
  • ui.filter.cleared

Architecture Benefits

Analytics-Agnostic - Works with any analytics system (PostHog, GA, Mixpanel)
OSS-Friendly - No proprietary code in ember-ui
Extensible - Easy to add events to new components
Flexible - Consumers choose which events to track
Non-Breaking - All tracking is opt-in or automatic

Documentation

See ANALYTICS_EVENTS.md for:

  • Complete event catalog
  • Usage examples
  • How to consume events in analytics systems
  • Best practices
  • Future component candidates

Consuming Events

Events are emitted through universe service and can be subscribed to using universe.on():

// In internals or other engines
this.universe.on('ui.button.clicked', (buttonName, ...args) => {
  this.posthog.trackEvent('button_clicked', {
    button_name: buttonName,
    additional_args: args
  });
});

this.universe.on('ui.modal.opened', (componentName, options) => {
  this.posthog.trackEvent('modal_opened', {
    modal_name: componentName,
    modal_title: options.title
  });
});

Testing

  • All components check for universe service availability
  • Events are non-blocking and don't break functionality if universe is unavailable
  • Existing applications continue to work without changes

Related PRs

  • fleetbase/ember-core: Universe events for data operations (CRUD, session)
  • fleetbase/internals: PostHog analytics listener for cloud version

Fleetbase AI and others added 2 commits February 8, 2026 21:52
Implements universe-based event tracking for key UI components following
dot notation naming convention (ui.{component}.{action}).

Components updated:
- Button: Opt-in event tracking via @eventName and @eventargs
- Modal Manager: Automatic ui.modal.opened and ui.modal.closed events
- Dropdown Button: Opt-in event tracking when dropdown opens
- Filters Picker: Automatic ui.filter.applied and ui.filter.cleared events

Event naming follows pattern: ui.{component}.{action}
Examples: ui.button.clicked, ui.modal.opened, ui.filter.applied

All events are emitted through universe service's Evented interface.
Events are analytics-agnostic and can be consumed by any analytics
system (PostHog, Google Analytics, Mixpanel, etc.).

Benefits:
- OSS-friendly: No proprietary analytics code in ember-ui
- Extensible: Easy to add events to new components
- Flexible: Consumers choose which events to track
- Non-breaking: All tracking is opt-in or automatic

See ANALYTICS_EVENTS.md for complete documentation and usage examples.
…se.trigger()

- Updated all components to use @service events
- Changed universe.trigger() calls to events.trackEvent()
- Updated modals-manager service to use events service
- Rewrote documentation to explain dual event system

Components updated:
- button.js
- dropdown-button.js
- filters-picker.js

Services updated:
- modals-manager.js

Benefits:
- Dual event system: events.on() and universe.on()
- Consistent with ember-core events service architecture
- Automatic enrichment with user/org/timestamp metadata
- Cleaner abstraction over raw universe.trigger() calls
@roncodes roncodes changed the base branch from main to dev-v0.3.19 February 11, 2026 09:53
@roncodes roncodes merged commit 3d8d4ed into dev-v0.3.19 Feb 11, 2026
6 of 7 checks passed
@roncodes roncodes deleted the feat/universe-analytics-events branch February 11, 2026 09:54
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.

2 participants