Skip to content

Implement survey popup delay (surveyPopupDelaySeconds) #499

@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 implement the survey popup delay (surveyPopupDelaySeconds). The field is parsed but never used.

Current State

  • The surveyPopupDelaySeconds field exists on PostHogSurveyAppearance model (PostHog/Models/Surveys/PostHogSurveyAppearance.swift:35) as TimeInterval?
  • The showNextSurvey() method in PostHogSurveyIntegration.swift immediately renders the survey via DispatchQueue.main.async with no delay
  • The field is correctly parsed from JSON (verified by test at PostHogSurveysTest.swift:55)

Expected Behavior

When survey.appearance.surveyPopupDelaySeconds is set to a value > 0:

  1. The survey should not be rendered immediately
  2. Instead, it should be delayed by the specified number of seconds
  3. Surveys should be sorted by their delay value (shorter delays first)

Reference Implementation

See posthog-js browser: packages/browser/src/extensions/surveys.tsx_handlePopover() method which uses setTimeout for the delay.

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