Track General Event

Track General Event

This function logs an event with a specified name and optional parameters. It is used to track user actions or other significant occurrences within an application.

Method Signature:

fun trackEvent(eventName: String, parameters: Bundle? = null)

Parameters:

  • eventName (String): The name of the event to be tracked. This parameter should be a non-null string representing the event's identifier used in the mapping file.

  • parameters (Bundle, optional): A Bundle containing key-value pairs of additional data to be logged with the event. This parameter is optional and can be null.

Example Usage:

// Without parameters
trackEvent("user_login")

// With parameters
val params = Bundle().apply {
    putString("method", "email")
    putString("user_status", "active")
}
trackEvent("user_login", params)

Last updated