Skip to documentation
AdQuestDocs

Quest session

The object startQuest returns. It tracks the timer, the question and the completion of one quest.

On this page

Members

MemberTypeMeaning
questIdnumberThe quest this session belongs to.
displayDurationnumberSeconds the quest must be shown or watched.
deliveryTokenstring | undefinedToken from the start, sent back when you complete.

Timing

Returns the current state of the session.

Signature
getState(): QuestSessionState

Returns: A QuestSessionState.

Subscribes to timer progress. Unsubscribe when the view unmounts.

Signature
onProgress(callback: (progress: QuestSessionProgress) => void): () => void
ParameterTypeDescription
callback required(progress) => voidCalled with { elapsed, total, percent, isComplete }.

Returns: A function that removes the listener.

Feeds real video playback into the session. Use it with mediaDriven: true.

Signature
syncMediaProgress(elapsed: number, total: number): void
ParameterTypeDescription
elapsed requirednumberSeconds played.
total requirednumberTotal seconds.

Returns: Nothing.

Marks the timer as finished.

Signature
completeDuration(): void

Returns: Nothing.

Resolves when the required watch time has passed.

Signature
waitForDuration(): Promise<void>

Returns: A Promise that resolves when the timer is done.

Questions and completion

Records a real click on the quest’s media.

Signature
registerClick(): Promise<void>

Returns: A Promise that resolves when the click is recorded.

Loads the question for a video, banner or survey quest.

Signature
getQuestion(): Promise<QuestQuestion>

Returns: A Promise of QuestQuestion.

Loads every question of a survey.

Signature
getQuestions(): Promise<QuestQuestion[]>

Returns: A Promise of QuestQuestion[].

Submits the participant’s answer. Never choose the answer for them.

Signature
complete(answer?: string | number | SurveyAnswerInput[]): Promise<QuestCompleteResult>
ParameterTypeDescription
answerstring | number | SurveyAnswerInput[]The chosen option ID, or the answers of a multi-question survey.

Returns: A Promise of { status, questId, completedAt?, reason?, rejectionCode?, settlementStatus, tokensAwarded?, tokenReward? }.

Submits evidence for a quest that is checked by review.

Signature
submitReview(evidence: string): Promise<QuestCompleteResult>
ParameterTypeDescription
evidence requiredstringThe evidence the quest asks for.

Returns: A Promise of QuestCompleteResult.

Growth quests

The session also exposes ingestEvent, getGrowthStatus, getStreakStatus, getCustomStatus and attributeReferral for the quest it was started for. They take the same arguments as the client methods, without the quest ID.

Something unclear, missing or wrong here? Tell us