Class AnalyticsEvent

java.lang.Object
com.codename1.analytics.AnalyticsEvent

public final class AnalyticsEvent extends Object

An immutable analytics event: a named action with an optional category and an ordered set of parameters. Build one via create(String):

Analytics.event(AnalyticsEvent.create("purchase")
        .category("commerce")
        .param("sku", "abc-123")
        .param("value", 9.99)
        .build());
  • Method Details

    • create

      public static AnalyticsEvent.Builder create(String name)

      Starts building an event with the given name.

      Parameters
      • name: the event name, must not be null
      Returns

      a new builder

    • getName

      public String getName()

      The event name.

      Returns

      the name

    • getCategory

      public String getCategory()

      The optional event category.

      Returns

      the category or null

    • getParameters

      public Map<String,Object> getParameters()

      The event parameters as an unmodifiable, insertion-ordered map.

      Returns

      the parameters

    • getTimestamp

      public long getTimestamp()

      The client timestamp in milliseconds since the epoch.

      Returns

      the timestamp