reportSurveyQuestionViewed method
Fired when a (non-content) question becomes visible. itemIndex is the
1-based respondent traversal depth. Stamps the view time for
time_to_answer_ms. First-party Digia analytics only.
Implementation
void reportSurveyQuestionViewed(String nodeId, int itemIndex) {
final state = _surveyOrchestrator.state;
if (state == null) return;
final block = _blockForNode(state.config, nodeId);
if (block == null || block.type.isContent) return;
_questionViewedAt[_questionKey(state.token, nodeId)] =
DateTime.now().millisecondsSinceEpoch;
final typeWire = _blockTypeWire(block.type);
_events.toDigia(
SurveyQuestionViewed(
questionId: nodeId,
questionType: typeWire,
itemIndex: itemIndex,
itemTotal: _surveyItemTotal(state.config),
blockType: typeWire,
blockId: block.id,
isRequired: block.required,
questionTitle: _questionTitle(block),
),
state.payload,
);
}