EventMetadata

data class EventMetadata

What the library knows about how an event was produced, beyond its name and properties (#287, #243, #242). It is carried in the envelope (Envelope.metadata) and serialized into the same context.instrumentation block, never into properties.

Produced by the library, never constructed by callers (ADR 0001 §2a), so it can gain fields as additions. A plain track/screen call carries none; see RESERVED_METADATA_KEY for how an emit site attaches it. No constructor parameter has a default: on the JVM, an all-defaults constructor would get a public no-argument overload that Java callers could use.

Properties

Link copied to clipboard

For an impression, how long the element had to stay visible before it was reported.

Link copied to clipboard

For an impression, the fraction of the element (0 to 1) that had to be visible.

Link copied to clipboard
val kind: String?

The kind of interaction that produced the event, one of EventKinds, or null when unknown.

Link copied to clipboard

The visit of a screen this event belongs to (#242): one id per Screen Viewed the library emits, carried by that screen view and by the events that happen during the visit it starts. Null when the event cannot be tied to one visit. It comes from the configured EventIdGenerator, so it is not necessarily a UUIDv7. An id long enough to push the encoded value past RESERVED_METADATA_KEY's bound loses the event's whole metadata, not just the id.

Functions

Link copied to clipboard
fun toJson(): JsonObject

The fields this metadata adds to the context.instrumentation block. A field that is null is omitted, and impression is omitted when both of its thresholds are.