AnalyticsLog

data class AnalyticsLog(val tag: String, val screenClass: String, val timestamp: Long, val type: AnalyticsLogType, val params: Map<String, String> = emptyMap())

Represents a single analytics event log entry.

This data class captures all essential information about an analytics event, including what happened (tag), where it happened (screenClass), when it happened (timestamp), and what type of event it was (type).

The class automatically handles timestamp formatting for display purposes through the formattedTimestamp property.

See also

Samples

val screenLog = AnalyticsLog(
    tag = "HomeScreen",
    screenClass = "com.example.ui.HomeScreen",
    timestamp = Clock.System.now().toEpochMilliseconds(),
    type = AnalyticsLogCategory.Screen.View
)

Constructors

Link copied to clipboard
constructor(tag: String, screenClass: String, timestamp: Long, type: AnalyticsLogType, params: Map<String, String> = emptyMap())

Properties

Link copied to clipboard

Optional event parameters. Do not record secrets or personal data. The logger takes a defensive copy when recording the event; later changes to the supplied map do not modify recorded history.

Link copied to clipboard

The fully qualified class name or identifier of the screen/component where the event occurred (e.g., "com.example.ui.HomeScreen").

Link copied to clipboard
val tag: String

The name or identifier of the analytics event (e.g., "user_login", "HomeScreen").

Link copied to clipboard

Unix timestamp in milliseconds representing when the event occurred.

Link copied to clipboard

The category of this analytics event.