Skip to main content
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​

CommandWhat it does
sf surveys validateCheck a survey file offline against the SurveyJS version the storefront loads; no sign-in needed
sf files putPlace the survey JSON file in the storefront's files
sf files get, sf files versions, sf files revertRead the placed file, and restore an earlier version
element docs surveyjs, schema show surveyjsRead the survey element's documentation and settings
sf preview openCheck 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 through sf 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.

Was this page helpful?