Versive.init(config?)
Creates a client with global configuration. Call once and reuse.
Origin the study loads from. Auto-detected in script-tag mode; you normally don’t set this.
Default colors for every study this client opens or embeds, merged with per-call colors.
versive.open(studyId, options?)
Opens a study in a modal overlay. Closes any previously open modal session. Returns a StudySession.
Key/value pairs attached to the response as metadata. Appended to the study URL as query parameters — don’t pass sensitive data. Keys
embed, mode, textColor, primaryColor and backgroundColor are reserved and ignored with a console warning.Colors for this session. Each key overrides the one from
init.versive.embed(studyId, container, options?)
Embeds a study inline. Returns a StudySession. Throws if the container isn’t found. Inline embeds ignore display — the iframe fills the container’s width and auto-sizes its height.
options accepts preview, context, colors, and on (as above).
versive.close() / versive.destroy()
close() closes the active modal session. destroy() closes it and removes all listeners.
Display options
Modal-only, passed viadisplay:
Colors
colors takes { text, primary, background }, each a 6-digit hex value like '#18181B'. Each key replaces the study’s own color for this embed only; a key you leave out keeps the study’s color. The modal and its loading screen use background too. A value that is not #RRGGBB is ignored with a console warning.
The colors travel as reserved query parameters on the study URL (
textColor, primaryColor, backgroundColor), and the study honors them only inside an embed. They style the study and are not stored with the response. Changing colors in the middle of an interview is not supported: pass the palette when you open or embed the study.
StudySession
Returned by open() and embed().
Events
Error codes
Loading behavior
The SDK shows a spinner while the study loads (inline embeds reserve a 600px placeholder until the first height report). If the study hasn’t loaded after 15 seconds, anerror with code TIMEOUT fires and the session closes — most commonly because the host domain isn’t on the allowed embed domains list.