# 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());

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `AnalyticsEvent.Builder`
  Mutable builder for `AnalyticsEvent`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static AnalyticsEvent.Builder`
  `create(String name)`
  Starts building an event with the given name.
  `String`
  `getCategory()`
  The optional event category.
  `String`
  `getName()`
  The event name.
  `Map<String,Object>`
  `getParameters()`
  The event parameters as an unmodifiable, insertion-ordered map.
  `long`
  `getTimestamp()`
  The client timestamp in milliseconds since the epoch.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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