Skip to main content

Command Palette

Search for a command to run...

How I added group-property filtering to PostHog surveys

Small UI + logic changes that let teams segment survey responses by organization, industry, or other group attributes.

Published
3 min read
How I added group-property filtering to PostHog surveys
N
Neha Prasad Software Engineer · Open Source Contributor · AI Agent Builder I build production-grade AI agents and contribute to the frameworks that power them. With 150+ pull requests merged across the AI ecosystem - including fixing Anthropic's core agent streaming freeze in Mastra, multi-turn tooling in LlamaIndex, and guardrail data-loss bugs in LiteLLM — I don’t just use AI tools. I shape them. Right now, I'm building DigiNav AI: India's first autonomous regulatory compliance agent that handles incorporation, GST, audits, and more - so founders can build the future instead of fighting paperwork. Built the first working version in a single day. Now turning it into a full product, in public. I ship fast, think in defensible moats, and believe technology should disappear behind a simple, human experience. If you need an AI agent built, a compliance health scan for your startup, or an engineer who treats open source as a calling card - let's talk.

TL;DR

I contributed a feature to PostHog that allows survey responses to be filtered by group properties (e.g., company_name, industry). I updated the filter UI, wired filters into the survey query logic, added unit tests, and iterated with maintainers until the PR was merged making survey analytics more useful for teams that analyze data by organization.


Background

PostHog is an open-source product analytics platform used by thousands of engineering and product teams. Its survey tool helps teams collect user feedback, but before this change, survey filters were limited to user/event properties — you couldn’t slice results by organization or other group-level attributes.


The problem (what I found)

Product teams wanted to compare survey responses across organizations, teams, or industries. Without group-property filters, they had to build external workarounds or export data — a slow, error-prone process that broke the flow of insights inside PostHog.


My solution (what I did)

  1. Frontend: Extended the existing property filter component to include group taxonomies (so group properties appear alongside person/event properties in the selector).

  2. Query logic: Integrated those selected group filters into survey queries so the backend returns filtered survey responses correctly.

  3. Testing: Added unit tests to cover single and combined group-filter scenarios, and validated behavior for edge cases (no group props, multiple group types).

  4. Collaboration: Addressed maintainers’ feedback, refined the UI wording/positioning, and iterated until the feature matched PostHog’s UX and reliability standards.


Implementation notes (concise, for readers who want details)

  • Extended the PropertyFilters UI to recognize group taxonomies.

  • Updated survey query generation to accept group filters and include them in the server request payload.

  • Added surveyLogic unit tests to ensure filters worked individually and in combination.

  • Kept the change backward-compatible: if no group filters are selected, the behavior is unchanged.


The review process & collaboration

I opened the PR, discussed the original feature request, and responded to review comments from maintainers. We iterated on naming, test coverage, and UI placement. Maintainers were supportive and gave helpful suggestions — after addressing those, the PR was approved and merged.


Result & impact

  • The PR was merged and shipped to PostHog users.

  • Product teams can now segment survey responses by organization, industry, and other group attributes directly in the UI.

  • This reduces friction for teams that need cross-organization analytics and aligns surveys with other segmentation tools in PostHog.


What I learned

  • Working in a large TypeScript + React codebase taught me how to introduce a small feature without breaking backward compatibility.

  • Collaboration matters: clear PR descriptions, tests, and quick responses to reviews accelerate acceptance.

  • Small UX improvements can unlock much richer product value for end users.


https://github.com/PostHog/posthog/pull/34946