track

abstract fun <T : Any> track(args: T, type: String = args::class.simpleName.orEmpty(), elapsedMillis: Long? = null)

Adds a custom event to the series of collected events.

See also

SystemClock.elapsedRealtime

Parameters

args

A custom data transfer object that the host app can define. It will be serialized by the ExperienceSDK using a JSON serializer and sent to the Experience Dashboard for further processing. Currently we use Google GSON for the serialization of custom arguments.

type

The type of the event. This is a string that appears as the type field of the event JSON sent to the backend. By default, it is set to the non-qualified (simple) class name of the args parameter but you can override it to an arbitrary string that is not equal to any of the internal event types.

elapsedMillis

This parameter can be used to track events that actually happened before the method call. If you do not specify it, the ExperienceSDK will use the current time as the timestamp. To shift the timestamp, set this parameter to the amount of elapsed milliseconds since the last device boot at the actual time when the tracked event happened.


abstract fun track(event: SendableEvent<*>)

Adds a custom event to the series of collected events.

Parameters

event

A custom SendableEvent object that the host app can define. The args field of the event will be serialized by the ExperienceSDK using a JSON serializer and sent to the Experience Dashboard for further processing. Currently we use Google GSON for the serialization of custom arguments.