Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surveys api/surveys API should be a POST and have a distinct id param #28165

Closed
marandaneto opened this issue Jan 31, 2025 · 1 comment
Closed
Labels
enhancement New feature or request feature/surveys

Comments

@marandaneto
Copy link
Member

marandaneto commented Jan 31, 2025

context https://posthog.slack.com/archives/C07QD3LT8U9/p1738359117136199

The surveys API returns all active surveys for an apiKey, including already answered surveys since the API does not know who is requesting it (there's no distinct_id query parameter or something).
The JS SDK has to filter out already answered surveys.

The current API is a GET https://us.i.posthog.com/api/surveys/?token=apiKey&ip=1&_=12345678&ver=1.211.2

  • change endpoint to POST (keep the GET for backcompatibility)
  • send distinct ID over the wire
  • just return the surveys that match and stop filtering on client-side
@marandaneto marandaneto added enhancement New feature or request feature/surveys labels Jan 31, 2025
@marandaneto
Copy link
Member Author

Closing this in favor of PostHog/posthog-js#1652
There'll be many more benefits with surveys being a static file + caching, which means some code dupe on the client side, but it's worth it.

@marandaneto marandaneto closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature/surveys
Projects
None yet
Development

No branches or pull requests

1 participant