: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(dashboards): wire subscribe label experiment variants (#61694)
Matt Puad39c2d959015
diff --git a/frontend/src/lib/components/Scenes/SceneSubscribeButton.tsx b/frontend/src/lib/components/Scenes/SceneSubscribeButton.tsxindex a787697df958..c2f9b8163fbf 100644--- a/frontend/src/lib/components/Scenes/SceneSubscribeButton.tsx+++ b/frontend/src/lib/components/Scenes/SceneSubscribeButton.tsx@@ -1,8 +1,11 @@import { useActions, useValues } from 'kea'import { router } from 'kea-router'+import posthog from 'posthog-js'import { IconBell } from '@posthog/icons'+import { useFeatureFlagVariantKey } from '@posthog/react'+import { FEATURE_FLAGS } from 'lib/constants'import { IconWithCount } from 'lib/lemon-ui/icons/icons'import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'import { userLogic } from 'scenes/userLogic'@@ -13,6 +16,13 @@ import { subscriptionsLogic } from '../Subscriptions/subscriptionsLogic'import { SubscriptionBaseProps, urlForSubscriptions } from '../Subscriptions/utils'import { SceneDataAttrKeyProps } from './utils'+const SUBSCRIBE_LABEL_BY_VARIANT: Record<string, string> = {+ control: 'Subscribe',+ 'recurring-updates': 'Get recurring updates',+ 'scheduled-notifications': 'Schedule notifications',+ 'scheduled-reports': 'Get scheduled reports',+}+interface SceneSubscribeButtonProps extends SubscriptionBaseProps, SceneDataAttrKeyProps {insight?: Partial<QueryBasedInsightModel>dashboardId?: number@@ -42,11 +52,21 @@ export function SceneSubscribeButton({const { push } = useActions(router)const { hasAvailableFeature } = useValues(userLogic)const hasSubscriptionsFeature = hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS)+ const labelVariant = useFeatureFlagVariantKey(FEATURE_FLAGS.SCENE_SUBSCRIBE_LABEL_EXPERIMENT)+ const subscribeLabel =+ typeof labelVariant === 'string' ? (SUBSCRIBE_LABEL_BY_VARIANT[labelVariant] ?? 'Subscribe') : 'Subscribe'return (<ButtonPrimitivemenuItem- onClick={() => push(urlForSubscriptions({ insightShortId: insight?.short_id, dashboardId }))}+ onClick={() => {+ posthog.capture('scene subscribe menu item clicked', {+ resource_type: dataAttrKey,+ label_variant: typeof labelVariant === 'string' ? labelVariant : 'control',+ label_text: subscribeLabel,+ })+ push(urlForSubscriptions({ insightShortId: insight?.short_id, dashboardId }))+ }}data-attr={`${dataAttrKey}-subscribe-dropdown-menu-item`}disabledReasons={disabledReasons}>@@ -55,7 +75,7 @@ export function SceneSubscribeButton({) : (<IconBell />)}- Subscribe+ {subscribeLabel}</ButtonPrimitive>)}diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 7289c2746504..f2e450ea109a 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -463,6 +463,7 @@ export const FEATURE_FLAGS = {REVENUE_ANALYTICS: 'revenue-analytics', // owner: @rafaeelaudibert #team-customer-analyticsREVENUE_FIELDS_IN_POWER_USERS_TABLE: 'revenue-fields-in-power-users-table', // owner: @arthurdedeus #team-customer-analyticsSCENE_MENU_BAR: 'scene-menu-bar', // owner: @adamleithp #team-platform-ux, gates the per-scene MenuBar above SceneTitleSection+ SCENE_SUBSCRIBE_LABEL_EXPERIMENT: 'scene-subscribe-label-experiment', // owner: @mattp #team-analytics-platform multivariate=control,recurring-updates,scheduled-notifications,scheduled-reportsSCHEDULE_FEATURE_FLAG_VARIANTS_UPDATE: 'schedule-feature-flag-variants-update', // owner: @gustavo #team-feature-flagsSCHEMA_ENFORCEMENT_REJECT: 'schema-enforcement-reject', // owner: @aspicer, gates the ability to set schema enforcement mode to "reject"SCHEMA_MANAGEMENT: 'schema-management', // owner: @aspicer