posthog icon indicating copy to clipboard operation
posthog copied to clipboard

Add individual user filter

Open timgl opened this issue 6 years ago • 12 comments

Is your feature request related to a problem?

I want to be able to filter views on an individual user.

Describe the solution you'd like

In the PropertyFilter I want to have a third option (next to Property and Cohort) that allows you to search a list of users.

Describe alternatives you've considered

I could look up the distinct ID or email address for example

Additional context

-

Thank you for your feature request – we love each and every one!

timgl avatar Jul 28 '20 14:07 timgl

Hi, I would like to work on this issue. Could you please assign to me? Thank you

chrysillala avatar Aug 22 '20 04:08 chrysillala

@chrysillala be our guest. Email [email protected] when this gets merged and just ask if you need any help!!

jamesefhawkins avatar Aug 22 '20 06:08 jamesefhawkins

@jamesefhawkins thanks! May I know in which page is this feature located? Could you please provide more details? Thank you

chrysillala avatar Aug 22 '20 09:08 chrysillala

Hey @chrysillala! So if you go to 'Insights' in PostHog, you should see this:

Screenshot 2020-08-22 at 09 27 42

What Tim is suggesting is that when 'Add Filter' is clicked, we can have a new option for filtering by users next to Cohort: Screenshot 2020-08-22 at 09 28 02

And you probably want to look at our PropertyFilters subdirectory.

yakkomajuri avatar Aug 22 '20 12:08 yakkomajuri

Let me know if you need anything else!

yakkomajuri avatar Aug 22 '20 12:08 yakkomajuri

Hi, I would like to work on this issue, please assign it to me..

jatin33 avatar Jul 03 '21 17:07 jatin33

Hi @jatin33! Thanks for the interest in contributing, this would be a quite useful feature. However, we're currently working on the general filtering experience, mainly on #4844, so it might actually be worth to wait until we get that in before working on this. You could also try to work off from that PR, but might run into a couple of merge conflicts down the line.

paolodamico avatar Jul 05 '21 07:07 paolodamico

Hey @paolodamico is this issue still up for grabs?

alceil avatar Sep 07 '23 12:09 alceil

@paolodamico @yakkomajuri Is this issue still relevant?

anirudh24seven avatar Sep 18 '24 15:09 anirudh24seven

Is this issue still relevant? If yes I would like to work on this issue as a beginner

MidhunU avatar Sep 02 '26 12:09 MidhunU

Automated analysis (OpenCode agent, unattended):

Issue #1289: Add individual user filter — Analysis (no fix applied)

Issue

From July 2020: "I want to be able to filter views on an individual user. In the PropertyFilter I want to have a third option (next to Property and Cohort) that allows you to search a list of users." Alternatives considered by the reporter: looking up the distinct ID or email address.

Finding: not implemented literally, and no longer a clear, scoped, low-risk fix

  • Current PropertyFilterType.Person maps to person properties (TaxonomicFilterGroupType.PersonProperties), not to individual persons:
    • frontend/src/lib/components/PropertyFilters/utils.ts — PROPERTY_FILTER_TYPE_TO_TAXONOMIC_FILTER_GROUP_TYPE: [PropertyFilterType.Person] -> PersonProperties, [PropertyFilterType.Cohort] -> Cohorts. There is no PropertyFilterType that maps to individual users.
  • A TaxonomicFilterGroupType.Persons = 'persons' enum value exists (frontend/src/lib/components/TaxonomicFilter/types.ts:339) and is backed by a person search endpoint, but it is not wired into TaxonomicPropertyFilter / property-filter group lists — it is used by other surfaces (e.g. breakdowns and other pickers), so property filters today can express "person property = X" (including distinct_id/email workarounds) but not "event belongs to person(s) selected from a searchable user list".
  • The literal 2020 request (a third "User" tab next to Property/Cohort) no longer matches the architecture: filters are now a TaxonomicFilter group picker plus ~25 PropertyFilterTypes, a HogQL expression type, cohort static/dynamic handling, person-on-events / personhog routing, and ClickHouse query runners. Adding "filter by N specific persons" would require coordinated decisions across:
    • Frontend: new/existing filter type, picker UX (multi-select persons, display names vs distinct IDs, pagination), serialization format.
    • Backend/query layer: how a person-identity predicate is compiled in HogQL/ClickHouse (person ID vs distinct_id join, person-on-events join, performance on large person lists), plus OpenAPI/generated types and MCP tool schemas.
    • Semantics: what "user" means now (Person vs Actor vs distinct_id vs identified/anonymous), privacy/deletion implications, and overlap with existing workarounds (person-property distinct_id/email filters, single-person cohorts).

Why unattended fix was not attempted

  • Ambiguous without product/design input: single- vs multi-select, identity key (person UUID vs distinct_id), which surfaces (Insights only? all property filters? dashboards, feature flags, cohorts?), expected behavior on merged/anonymous persons, and scale limits.
  • Too large/risky for an unverified change: touches shared filter infrastructure used by every insight type; a wrong serialization or query predicate silently changes query results. No relevant test could be run to verify end-to-end (would need frontend + backend + ClickHouse coverage).
  • Partial workarounds already exist (filter Person property distinct_id/email, or build a static cohort of the users and filter Cohort), so the marginal value vs. regression risk does not justify an autonomous change to shared query semantics.

Suggested approach (for a scoped follow-up with human input)

  1. Confirm scope with product: person-UUID multi-select predicate on the generic property-filter row vs. a narrower surface (e.g. Insights filter only).
  2. Frontend: expose TaxonomicFilterGroupType.Persons in the property-filter picker behind a new or extended PropertyFilterType, reusing the existing persons search; decide display/serialization (e.g. key: 'id', type: <new>, value: [<person uuids>]).
  3. Backend: compile the new predicate in the HogQL printer / query runners (respect person-on-events joins and personhog routing), regenerate OpenAPI + frontend generated types (hogli build:openapi), and add pytest + Jest coverage for the new predicate.
  4. Consider closing as superseded if person-property/cohort workarounds plus HogQL custom filters are deemed sufficient, since the 2020 tab-based UI it describes no longer exists.

Verification

No tests were run; no tracked files were modified (intentionally, per the ambiguous/high-risk case).

No PR was opened for this issue -- it was flagged as needing human judgment.

pamod-madubashana avatar Sep 17 '26 18:09 pamod-madubashana

Hi, I'd like to work on this. Before I start, could a maintainer confirm this is still wanted and point me to the right area (I expect the Python/query side for insights filtering by individual user/person properties)? Happy to scope a first PR once confirmed.

dasarijashwanth avatar Nov 27 '26 06:11 dasarijashwanth

PostHog self-driving picked up this issue. Status: Research is done.

Somebody may already be working on it, so ask before you start a fix.

Report (team access only): https://us.posthog.com/project/2/inbox/reports/01a21bdc-a5f0-7c0f-a94d-dc986d03ca6f?link_source=github_comment

posthog[bot] avatar Nov 27 '26 07:11 posthog[bot]