PostHog / PostHog/posthog-js

Implement survey wait period (seenSurveyWaitPeriodInDays) for React Native

Open
#3,192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature/mobile feature/surveys react-native
Dominant language
TypeScript
Stars
609
Forks
343
Avg merge
1d 19h
Merged PRs (30d)
302

Description

🚨 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-react-native SDK does not implement the survey wait period (seenSurveyWaitPeriodInDays) filtering logic. The code is commented out in packages/react-native/src/surveys/getActiveMatchingSurveys.ts (lines 47-52).

Current State

  • The seenSurveyWaitPeriodInDays field is available on the Survey type (from @posthog/core)
  • The filtering logic in getActiveMatchingSurveys.ts has the wait period check commented out
  • No lastSeenSurveyDate storage is implemented

Expected Behavior

When survey.conditions.seenSurveyWaitPeriodInDays is set, the SDK should:

  1. Store the date when any survey was last shown to the user
  2. During getActiveMatchingSurveys(), skip surveys if the wait period has not yet elapsed since the last seen survey date

Reference Implementation

See posthog-js browser: packages/browser/src/extensions/surveys/surveys-extension-utils.tsxhasWaitPeriodPassed() function and LAST_SEEN_SURVEY_DATE_KEY storage.
See also: packages/browser/src/extensions/utils/matcher-utils.tshasPeriodPassed() utility.

Tracking

This is tracked in the survey SDK feature parity issue: https://github.com/PostHog/posthog/issues/45658

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read packages/react-native/src/surveys/getActiveMatchingSurveys.ts, especially the commented wait-period logic, then compare it with hasWaitPeriodPassed() and LAST_SEEN_SURVEY_DATE_KEY in packages/browser/src/extensions/surveys/surveys-extension-utils.tsx and hasPeriodPassed() in packages/browser/src/extensions/utils/matcher-utils.ts. Done means React Native persists the date any survey was shown and getActiveMatchingSurveys() skips surveys until the configured wait period has elapsed.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.