Reference
Surveys
Overview
Your agent can build a SurveyJS survey for a StoreFront page. A survey has two parts: a JSON file that defines the questions, and a survey element on the page that points at that file. The agent writes and validates the file, places it in the storefront's files, and adds the element with its completion behavior.
A broken survey fails silently: the visitor sees an empty space and nothing reports why. That is why the agent validates the file before placing it and checks the survey in a preview afterwards.
Example requests
- "Add a three-question fit survey to the /fit-finder page, and send customers who answer that they live outside the United States to the /international/ page."
- "Validate the existing survey file against the SurveyJS version the storefront uses."
- "Translate the survey's questions into Spanish."
Commands
| Command | What it does |
|---|---|
sf surveys validate | Check a survey file offline against the SurveyJS version the storefront loads; no sign-in needed |
sf files put | Place the survey JSON file in the storefront's files |
sf files get, sf files versions, sf files revert | Read the placed file, and restore an earlier version |
element docs surveyjs, schema show surveyjs | Read the survey element's documentation and settings |
sf preview open | Check that the survey appears and behaves as expected |
What it cannot do
- Use features from a newer SurveyJS release. The storefront runs a pinned SurveyJS version, and properties from a later release are ignored.
- Upload a survey with
sf files upload. That command is for media; survey files go throughsf files put.
What needs approval
None. Placing a survey file needs --live, like every sf files put, and publish permission when the file is outside every theme or in the active theme. See Files and assets.
Related documentation
- Customer Surveys: building a survey in the admin and reading responses
- Files and assets: file writes and history
- Languages and translation: survey text lives in the survey file's own locale fields
Was this page helpful?