logEvent

open fun logEvent(@NonNull eventName: String)(source)

Logs a basic analytics event without any additional parameters.

This method is a convenience wrapper for logEvent with a null parameter bundle. Use this for simple events that don't require additional context.

Example:

// Log a simple event
Analytics.logEvent(Analytics.E_SERVICE_TOGGLED);

Parameters

eventName

The name of the event to log. Should be one of the predefined event constants (e.g., E_ONBOARD_STEP_DONE) or a custom event name.

See also

Throws

if eventName is null or empty


open fun logEvent(@NonNull eventName: String, @Nullable params: Bundle)(source)

Logs an analytics event with the specified parameters.

This method sends the event to all configured analytics providers. Parameters are automatically converted to the appropriate format for each provider.

Example:

// Log an event with parameters
Bundle params = new Bundle();
params.putString(Analytics.P_STAGE, "welcome");
params.putLong(Analytics.P_DURATION, 5000);
Analytics.logEvent(Analytics.E_ONBOARD_STEP_DONE, params);

Note: Different analytics providers may have different limitations on the number of parameters and their types. Firebase Analytics, for example, has specific requirements for parameter names and values.

Parameters

eventName

The name of the event to log. Should be one of the predefined event constants or a custom event name.

params

A Bundle containing the event parameters, or null if no parameters are needed. The bundle can contain the following value types:

  • String
  • int/long (stored as long)
  • double/float (stored as double)

See also

Throws

if eventName is null or empty