Skip to content

Surveys: Support shuffle questions and shuffle options #492

@adboio

Description

@adboio

🚨 IMPORTANT

This issue is likely user-facing in the main PostHog app, see surveyVersionRequirements.ts. If you delete or close this issue, be sure to update the version requirements list here.

Summary

The posthog-ios SDK does not support two shuffle features for surveys:

1. Shuffle Questions (shuffleQuestions)

The shuffleQuestions field is parsed into the internal PostHogSurveyAppearance model (line 34), but is NOT exposed in the public PostHogDisplaySurveyAppearance model. Neither the built-in UI nor delegate developers can access this setting.

2. Shuffle Options (shuffleOptions)

The shuffleOptions boolean IS exposed on PostHogDisplayChoiceQuestion, but the built-in SwiftUI rendering ignores it. In QuestionTypes.swift, both SingleChoiceQuestionView and MultipleChoiceQuestionView pass question.choices directly to MultipleChoiceOptions(options: question.choices) without checking shuffleOptions or shuffling the choices.

Expected Behavior

  • When survey.appearance.shuffleQuestions is true, questions should be presented in a randomized order (unless enable_partial_responses is true)
  • When question.shuffleOptions is true on a choice question, choices should be randomized (keeping the open-ended choice at end if present)

Reference Implementation

See posthog-js browser: packages/browser/src/extensions/surveys/surveys-extension-utils.tsx

  • getDisplayOrderQuestions() for question shuffling
  • getDisplayOrderChoices() for option shuffling

Tracking

This is tracked in the survey SDK feature parity issue: PostHog/posthog#45658

This issue was generated by Claude using the /survey-sdk-audit skill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions