JavaScriptAPI reference
Surveys
Surveys in the JavaScript SDK.
// access
nexus.surveys| Symbol | Kind | Summary |
|---|---|---|
ActiveOptions | interface | |
NexusSurvey | interface | |
NexusSurveys | class | In-product surveys — fetch eligible surveys and submit answers. |
ActiveOptions
interfaceproperties
propertyproperties?: Record<string, unknown>deviceType
propertydeviceType?: stringNexusSurvey
interfaceid
propertyid: stringname
propertyname: stringtype
propertytype: stringquestions
propertyquestions: unknown[]NexusSurveys
classIn-product surveys — fetch eligible surveys and submit answers. Headless (bring your own UI); works in any framework and server-side.
NexusSurveys
constructornew NexusSurveys(http: NexusHttp, id: NexusIdentity)Parameters
Prop
Type
Returns NexusSurveys
active
propertyreadonly active: NexusSurvey[]fetch()
methodasync fetch(options: ActiveOptions = {}): Promise<NexusSurvey[]>Surveys the current user is eligible for (targeting/sampling/capping applied).
Parameters
Prop
Type
Returns Promise<NexusSurvey[]>
byId()
methodbyId(id: string): NexusSurvey | undefinedParameters
Prop
Type
Returns NexusSurvey | undefined
respond()
methodasync respond(surveyId: string, answers: Record<string, unknown>, options: { responseId?: string; completed?: boolean; dismissed?: boolean; iterationKey?: string } = {}): Promise<void>Submit a response (partial, complete, or dismissed). Answers keyed by question id.
Parameters
Prop
Type
complete()
methodcomplete(surveyId: string, answers: Record<string, unknown>, options: {} = {}): Promise<void>Parameters
Prop
Type
dismiss()
methoddismiss(surveyId: string, options: {} = {}): Promise<void>Parameters
Prop
Type
