Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(taxonomic-filter): stamp explicit surface on legacy telemetry (#62048)

Paul D'Ambra599845baa9cf
diff --git a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts
index 46a7cf390d60..a36d9bc36667 100644
--- a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts
@@ -14,6 +14,7 @@ import {
hasPinnedContext,
taxonomicFilterPinnedPropertiesLogic,
} from 'lib/components/TaxonomicFilter/taxonomicFilterPinnedPropertiesLogic'
+import { legacyTaxonomicSurface } from 'lib/components/TaxonomicFilter/taxonomicFilterSurface'
import {
ExcludedOperators,
InfiniteListLogicProps,
@@ -29,6 +30,7 @@ import {
TaxonomicFilterGroupType,
} from 'lib/components/TaxonomicFilter/types'
import { promoteMatchingProperties } from 'lib/components/TaxonomicFilter/utils/promoteProperties'
+import { FEATURE_FLAGS } from 'lib/constants'
import { createFuse } from 'lib/utils/fuseSearch'
import { mapGroupQueryResponse } from 'lib/utils/groups'
@@ -1091,6 +1093,9 @@ export const infiniteListLogic = kea<infiniteListLogicType>([
if (cache.lastEmptyResultDedupeKey !== dedupeKey) {
cache.lastEmptyResultDedupeKey = dedupeKey
posthog.capture('taxonomic filter empty result', {
+ surface: legacyTaxonomicSurface(
+ posthog.getFeatureFlag(FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN)
+ ),
groupType: props.listGroupType,
searchQuery: trimmedQuery,
})
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
index f8413be96995..106917c91c34 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
@@ -31,6 +31,7 @@ import {
stripRecentContext,
} from 'lib/components/TaxonomicFilter/recentTaxonomicFiltersLogic'
import { hasPinnedContext } from 'lib/components/TaxonomicFilter/taxonomicFilterPinnedPropertiesLogic'
+import { legacyTaxonomicSurface } from 'lib/components/TaxonomicFilter/taxonomicFilterSurface'
import {
DataWarehousePopoverField,
ExcludedProperties,
@@ -1766,6 +1767,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
// and inflates the abandonment metric (top sessions hit 100+ closes pre-gate).
if (values.hadInteraction) {
posthog.capture('taxonomic filter closed', {
+ surface: legacyTaxonomicSurface(values.featureFlags[FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN]),
dwellMs: Date.now() - (cache.openedAt ?? Date.now()),
hadSelection: !!cache.hadSelection,
groupType: values.activeTab,
@@ -1797,6 +1799,9 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
: undefined
posthog.capture('taxonomic filter item selected', {
+ surface: legacyTaxonomicSurface(
+ values.featureFlags[FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN]
+ ),
groupType: values.activeTab,
sourceGroupType,
wasFromPinnedList,
@@ -1950,6 +1955,9 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
const inputMode: 'pasted' | 'mixed' | 'typed' =
pastedChars >= totalLength && pastedChars > 0 ? 'pasted' : pastedChars > 0 ? 'mixed' : 'typed'
posthog.capture('taxonomic_filter_search_query', {
+ surface: legacyTaxonomicSurface(
+ values.featureFlags[FEATURE_FLAGS.TAXONOMIC_FILTER_CATEGORY_DROPDOWN]
+ ),
searchQuery,
groupType: activeTaxonomicGroup?.type,
inputMode,
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterSurface.test.ts b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterSurface.test.ts
new file mode 100644
index 000000000000..c45f5f79faf1
--- /dev/null
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterSurface.test.ts
@@ -0,0 +1,15 @@
+import { legacyTaxonomicSurface } from './taxonomicFilterSurface'
+
+describe('legacyTaxonomicSurface', () => {
+ it.each([
+ ['pill', 'legacy-pill'],
+ ['control', 'legacy-control'],
+ [undefined, 'legacy-control'],
+ [true, 'legacy-control'],
+ // `posthog.getFeatureFlag` returns `false` (not undefined) for a loaded flag with no variant.
+ [false, 'legacy-control'],
+ ['', 'legacy-control'],
+ ])('maps category-dropdown variant %p to %p', (variant, expected) => {
+ expect(legacyTaxonomicSurface(variant as string | boolean | undefined)).toBe(expected)
+ })
+})
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterSurface.ts b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterSurface.ts
new file mode 100644
index 000000000000..67e9a9d39db9
--- /dev/null
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterSurface.ts
@@ -0,0 +1,9 @@
+/** The legacy TaxonomicFilter surface, derived from the category-dropdown A/B
+ * variant, stamped on the `taxonomic filter *` telemetry events so the arms are
+ * distinguishable by an explicit property rather than a feature-flag join. The
+ * rebuild menu emits `rebuild-menu` for the same purpose. */
+export function legacyTaxonomicSurface(
+ categoryDropdownVariant: string | boolean | undefined
+): 'legacy-control' | 'legacy-pill' {
+ return categoryDropdownVariant === 'pill' ? 'legacy-pill' : 'legacy-control'
+}