AnalyticsEvent class final
The behavioral-analytics event envelope every surface emits.
This is the client-sent shape (the SDK → ingest wire). The
server-stamped fields (tier/source/appId/…, applied at ingest)
are deliberately NOT on this type: a client must not be able to assert them,
and fromJson never reads them. Identity/context fields are nullable to
model both client and server/app-wide events; the per-source requirements
are enforced at decode (the source-conditional rules below).
- Annotations
-
- @immutable
Constructors
-
AnalyticsEvent({required String eventId, required String name, required DateTime occurredAt, int schemaVersion = 1, String? surface = AnalyticsSurface.paywall, String? surfaceId, String? surfaceVersion, String? placementId, String? anonymousId, String? sessionId, String? surfaceSessionId, String? userId, AnalyticsAppContext? appContext, String? productId, String? offerId, Map<
String, Object?> properties = const <String, Object?>{}}) - Creates an event envelope.
-
AnalyticsEvent.fromJson(Map<
String, Object?> json, {required String source}) -
Decodes an envelope from
json.factory
Properties
- anonymousId → String?
-
Stable-per-install pseudonymous actor id (required for
source=client).final - appContext → AnalyticsAppContext?
-
Client app context (required for
source=client).final - eventId → String
-
Client-minted UUID v4 — the idempotency key.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- name → String
-
Canonical
snake_caseevent name.final - occurredAt → DateTime
-
Client wall-clock fire time, UTC. Untrusted (stored as
client_occurred_at; the server derives the clamped event time).final - offerId → String?
-
Promoted conversion dim.
final
- placementId → String?
-
Campaign / trigger name.
final
- productId → String?
-
Promoted conversion dim.
final
-
properties
→ Map<
String, Object?> -
Residual per-event payload.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schemaVersion → int
-
Contract version (
=1). Readers preserve-unknown for additive change.final - sessionId → String?
-
App-session id (required for
source=client).final - surface → String?
-
The emitting surface (unknown-preserving wire string).
null= app-wide.final - surfaceId → String?
-
Surface-instance id (= the paywall/flow id).
final
- surfaceSessionId → String?
-
Per-surface-presentation session id (mount→dismiss).
nullfor app-wide.final - surfaceVersion → String?
-
Published surface version (a promoted cohort dim).
final
- userId → String?
-
Opt-in app-supplied user id.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
Encodes to the SDK→ingest wire map. Non-null fields only;
tier/sourceare never emitted (not envelope fields). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override