api/internal/gamification/chance_events
library
Extensions
-
EngageEventEmitterChanceEvents
on EngageEventEmitter
-
Sends chance events to Digia analytics only — never the CEP.
A live test never reports chance events: the emitter's live-test sink
drops Digia signals, and this skips them before that, so no live-test
payload ever reaches even the real sink. Port of iOS
forwardChanceEvents.
-
PlayDecisionChanceEvents
on PlayDecision
-
The events a grant answer carried, whatever the decision it led to.
Functions
-
chanceDeniedEvent({required String campaignId, required String denyReason, String? chanceId, String? eventId, String? occurredAt})
→ ChanceAnalyticsEvent
-
The
ChanceDenied chance event the SDK derives from a denied grant
answer. Never throws.
-
chanceEventsOf(Object? raw, {String? campaignKey})
→ List<ChanceAnalyticsEvent>
-
The
events the gamification server returns in an answer's data.response
(the grantChance answer, or the body of a proxied http play answer).
Port of iOS ChanceEvents.swift.
-
chanceEventsOfAnswer(Object? body, {String? campaignKey})
→ List<ChanceAnalyticsEvent>
-
The events in a proxied
http answer body
({isSuccess, data: {response: {events}}}).
-
chanceGrantedEvent({required String campaignId, required String chanceId, String type = 'trigger', String? eventId, String? occurredAt})
→ ChanceAnalyticsEvent
-
The
ChanceGranted chance event the SDK derives from a grant answer.
type is trigger for the trigger-time grant and extraPlay for a
later grant for the same chance; anything else reads as trigger.
Never throws.
-
gamePlayedEventOfAnswer(Map<String, dynamic>? response, {required String campaignId, required String entry, required int playNumber, String? chanceId, String? eventId, String? occurredAt})
→ ChanceAnalyticsEvent?
-
The
GamePlayed chance event the SDK derives from an answered play's
facts, when the answer carried no server events of its own. Properties:
chance_id, outcome_key, kind, reward_id, grant_id,
value_minor, currency, fallback, play_number and entry.
Null when the body has no play facts at all. Never throws.
-
gamificationAssignedEvent({required String campaignId, String chanceId = '', required bool holdout, String? eventId, String? occurredAt})
→ ChanceAnalyticsEvent
-
The
GamificationAssigned chance event the SDK derives from a grant
answer: the server assigned a chance to this user. holdout is true when
the grant came back without show, or was denied for holdout — the
chance is saved (or nothing is) but the game must not open. The chanceId
rides along when the answer carried one. Never throws.
-
isLiveTestGamePayload(CEPTriggerPayload payload)
→ bool
-
Whether
payload belongs to a live test. Chance events never report for
one — factored so the game funnel shares the rule with the emitter.
-
normalizeGameKind(Object? raw)
→ String
-
Normalizes a play
kind from answer facts. Known kinds pass through; a
missing or unknown one reads UNKNOWN. Never throws.
-
playResponseOf(Map<String, dynamic>? body)
→ Map<String, dynamic>?
-
The
data.response object of an answered skin http body
({isSuccess, data: {response}}), or null when the body has none.
Never throws.