Skip to main content

trackAction

Notifies the client app of user actions for analytics tracking.

Overview

The SDK calls this method when a user performs an action that should be tracked for analytics purposes. Your app should forward this information to your analytics service to track user interactions and behavior.

Syntax

abstract fun trackAction(analytics: Map<String, String>)

Parameters

ParameterTypeDescription
analyticsMap<String, String>Analytics data to track, containing key-value pairs with action details

Example

override fun trackAction(analytics: Map<String, String>) {
// Forward to your analytics service
analyticsService.logEvent("maestro_action", analytics)

// Or use Firebase Analytics
firebaseAnalytics.logEvent("maestro_action") {
analytics.forEach { (key, value) ->
param(key, value)
}
}

// Or use Mixpanel
mixpanel.track("maestro_action", JSONObject(analytics))

// Log for debugging
Log.d("Maestro", "Action tracked: $analytics")
}

Notes

  • Integrate with your analytics platform (Firebase, Mixpanel, etc.)
  • The analytics map contains relevant metadata about the action
  • Track these events to measure user engagement and feature usage
  • Consider batching analytics events for better performance
  • Actions represent user interactions (clicks, taps, selections)