public final class AnalyticsEvent

  1. Object
  2. AnalyticsEvent

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("tutorial_complete")
        .category("onboarding")
        .param("step", "checkout")
        .param("seconds", 42)
        .build());

Name your own events. The purchase family is emitted for you when a receipt completes, so sending one by hand counts the transaction twice.

Nested types

class AnalyticsEvent.BuilderMutable builder for AnalyticsEvent.

Methods

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

Inherited methods

Method details

create

public static AnalyticsEvent.Builder create(String name)
Starts building an event with the given name.

Parameters

name String
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