Analytics
Learn how to keep track of screen sessions, ever events and more.
Use BlazeComposable
for automatic tracking of screen sessions
Wrap your screen level composable with the BlazeComposable
. Blaze will automatically track the duration spent between the host lifecycle’s ON_RESUME and ON_PAUSE events (activity or fragment).
Track custom events
In your @Composable function, use rememberAnalytics()
to get a reference to an Analytics
object. Use the logEvent()
function to pass the name of the event you want to track, along with any extra information for the event.
Here is an example of how to track a ‘button click’ event, passing an extra ‘count’ as a parameter:
val analytics = rememberAnalytics()
Button(onClick = {
analytics.logEvent("button click", mapOf("count" to 5))
}) {
Text("Buy 5")
}
Did this answer your question?
😞
😐
🤩