trackImpression
Notifies the client app of user impressions for analytics tracking.
Overview
The SDK calls this method when an element is displayed to the user that should be tracked for analytics purposes. Your app should forward this information to your analytics service to track user engagement and behavior.
Syntax
abstract fun trackImpression(analytics: Map<String, String>)
Parameters
| Parameter | Type | Description |
|---|---|---|
analytics | Map<String, String> | Analytics data to track, containing key-value pairs with impression details |
Example
override fun trackImpression(analytics: Map<String, String>) {
// Forward to your analytics service
analyticsService.logEvent("maestro_impression", analytics)
// Or use Firebase Analytics
firebaseAnalytics.logEvent("maestro_impression") {
analytics.forEach { (key, value) ->
param(key, value)
}
}
// Or log for debugging
Log.d("Maestro", "Impression tracked: $analytics")
}
Notes
- Integrate with your analytics platform (Firebase, Mixpanel, etc.)
- The analytics map contains relevant metadata about the impression
- Track these events to measure engagement with Maestro features
- Consider batching analytics events for better performance
Related Methods
- trackAction() - Tracks user actions