Feature Request: Use Survey Response as distinct_id for Hosted Surveys
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Feature request
Is your feature request related to a problem?
Currently, hosted surveys require the distinct_id to be passed as a URL query parameter before the survey loads. This means users must already be identified before they access the survey.
For use cases where we want to collect identifying information (like an email address) within the survey itself and use that to identify the respondent, there's no way to do this. The survey response is captured, but it remains anonymous unless the distinct_id was pre-populated in the URL.
Describe the solution you'd like
I'd like the ability to designate a specific survey question (like an email or user ID field) as the distinct_id for that response. When a user submits the survey, PostHog would use the value from that designated question to identify the user, similar to how posthog.identify() works in the SDK
This would allow hosted surveys to:
- Collect responses from anonymous users and identify them based on their answers
- Eliminate the need to pre-populate the distinct_id in the URL for every recipient
- Enable better tracking of survey respondents who weren't previously identified in PostHog
This would be particularly useful for surveys sent via email or shared publicly where we don't have the user's distinct_id upfront, but want to identify them based on information they provide in the survey.
Describe alternatives you've considered
Additional context
From: https://posthoghelp.zendesk.com/agent/tickets/52956 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/55575)
Debug info
Kind: support
Target area: surveys
Report event: http://go/ticketByUUID/d6a09d1a-7124-48cd-b385-1019da0d3ff7
Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/019cd84c-094a-7fbd-9699-60b6223f1fe5?t=1935
Exceptions: https://us.posthog.com/project/2/error_tracking?filterGroup=%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22key%22%3A%22%24session_id%22%2C%22value%22%3A%5B%22019cd84c-094a-7fbd-9699-60b6223f1fe5%22%5D%2C%22operator%22%3A%22exact%22%2C%22type%22%3A%22event%22%7D%5D%7D%5D%7D
Location: https://us.posthog.com/project/93841/ai?chat=0f5232a5-660a-4207-be6f-7b889b93f35a
Persons-on-events mode for project: person_id_override_properties_on_events
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing hosted survey loading, URL distinct_id handling, response capture, and submission behavior. Define how a designated question's value becomes the respondent's distinct_id for anonymous submissions, then verify the behavior against the linked support scenario and the existing posthog.identify semantics.
Written by the indexing model from the issue text.
Assessment
- Domain
- full-stack
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100