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.

chore(dashboards): remove subscribe placement experiment (#70898)

Matt Pua9a9868b571e9
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 8251b6666106..c9c2c5c55302 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -277,7 +277,6 @@ export const FEATURE_FLAGS = {
DASHBOARD_INLINE_TILE_INSERTION: 'dashboard-inline-tile-insertion', // owner: @MattPua #team-analytics-platform
DASHBOARD_LAYOUT_DISCARD_PROMPT: 'dashboard-layout-discard-prompt', // owner: @cory.s #team-analytics-platform
DASHBOARD_QUICK_FILTERS_EXPERIMENT: 'dashboard-quick-filters-experiment', // owner: @vdekrijger #team-product-analytics multivariate=control,test
- DASHBOARD_SUBSCRIBE_PLACEMENT: 'dashboard-subscribe-placement', // owner: @MattPua #team-analytics-platform multivariate=control,button,menu
DASHBOARD_TEMPLATE_CHOOSER_EXPERIMENT: 'dashboard-template-chooser-experiment', // owner: @mattp #team-analytics-platform multivariate=control,simple,new
DASHBOARD_WIDGETS: 'dashboard-widgets', // owner: @mattp #team-analytics-platform
DASHBOARDS_LIST_VIEW: 'dashboards-list-view', // owner: @vdekrijger #team-product-analytics multivariate=control,tree
diff --git a/frontend/src/scenes/dashboard/DashboardHeaderActions.tsx b/frontend/src/scenes/dashboard/DashboardHeaderActions.tsx
index 7980dd9f6d6e..713eff1f6196 100644
--- a/frontend/src/scenes/dashboard/DashboardHeaderActions.tsx
+++ b/frontend/src/scenes/dashboard/DashboardHeaderActions.tsx
@@ -19,7 +19,7 @@ import { AccessControlLevel, AccessControlResourceType, DashboardMode } from '~/
import { addInsightToDashboardLogic } from './addInsightToDashboardModalLogic'
import { DashboardLoadAction, dashboardLogic } from './dashboardLogic'
-import { DashboardSubscribeExperiment } from './DashboardSubscribeExperiment'
+import { DashboardSubscribeButton } from './DashboardSubscribeButton'
export function getAddTileMenuItems({
dashboardId,
@@ -215,10 +215,9 @@ export function EditModeActions(): JSX.Element {
return (
<>
- <DashboardSubscribeExperiment placement="button" />
+ <DashboardSubscribeButton />
{layoutEditMode && <DashboardEditSaveCancelButtons />}
<DashboardAddTileButton />
- <DashboardSubscribeExperiment placement="menu" />
</>
)
}
@@ -250,7 +249,7 @@ export function ViewModeActions(): JSX.Element {
return (
<>
- <DashboardSubscribeExperiment placement="button" />
+ <DashboardSubscribeButton />
<LemonButton
type="secondary"
data-attr="dashboard-share-button"
@@ -285,7 +284,6 @@ export function ViewModeActions(): JSX.Element {
</Shortcut>
)}
<DashboardAddTileButton />
- <DashboardSubscribeExperiment placement="menu" />
</>
)
}
diff --git a/frontend/src/scenes/dashboard/DashboardSubscribeExperiment.scss b/frontend/src/scenes/dashboard/DashboardSubscribeButton.scss
similarity index 80%
rename from frontend/src/scenes/dashboard/DashboardSubscribeExperiment.scss
rename to frontend/src/scenes/dashboard/DashboardSubscribeButton.scss
index a8d901ccb7a2..fe13f0ad4aec 100644
--- a/frontend/src/scenes/dashboard/DashboardSubscribeExperiment.scss
+++ b/frontend/src/scenes/dashboard/DashboardSubscribeButton.scss
@@ -4,11 +4,11 @@
@media (prefers-reduced-motion: no-preference) {
.LemonButton:hover .DashboardSubscribeBell {
- animation: DashboardSubscribeExperiment__ring 0.7s ease-in-out;
+ animation: DashboardSubscribeButton__ring 0.7s ease-in-out;
}
}
-@keyframes DashboardSubscribeExperiment__ring {
+@keyframes DashboardSubscribeButton__ring {
0%,
100% {
transform: rotate(0);
diff --git a/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx b/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx
new file mode 100644
index 000000000000..deab3d9f0d68
--- /dev/null
+++ b/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx
@@ -0,0 +1,66 @@
+import './DashboardSubscribeButton.scss'
+
+import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
+import posthog from 'posthog-js'
+
+import { IconBell } from '@posthog/icons'
+
+import { IconWithCount } from 'lib/lemon-ui/icons/icons'
+import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { userLogic } from 'scenes/userLogic'
+
+import { AvailableFeature } from '~/types'
+
+import { subscriptionsLogic } from 'products/subscriptions/frontend/components/Subscriptions/subscriptionsLogic'
+import { urlForSubscriptions } from 'products/subscriptions/frontend/components/Subscriptions/utils'
+
+import { dashboardLogic } from './dashboardLogic'
+
+function SubscribeCountIcon({ dashboardId }: { dashboardId: number }): JSX.Element {
+ const { subscriptions } = useValues(subscriptionsLogic({ dashboardId }))
+
+ return (
+ <IconWithCount count={subscriptions?.length} showZero={false}>
+ <IconBell className="DashboardSubscribeBell" fontSize="16" />
+ </IconWithCount>
+ )
+}
+
+function SubscribeIcon({ dashboardId }: { dashboardId: number }): JSX.Element {
+ const { hasAvailableFeature } = useValues(userLogic)
+
+ if (!hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS) || !subscriptionsLogic.isMounted({ dashboardId })) {
+ return <IconBell className="DashboardSubscribeBell" fontSize="16" />
+ }
+
+ return <SubscribeCountIcon dashboardId={dashboardId} />
+}
+
+export function DashboardSubscribeButton(): JSX.Element | null {
+ const { dashboard, canEditDashboard } = useValues(dashboardLogic)
+ const { push } = useActions(router)
+
+ if (!dashboard || !canEditDashboard) {
+ return null
+ }
+
+ const dashboardId = dashboard.id
+
+ return (
+ <LemonButton
+ type="tertiary"
+ size="small"
+ icon={<SubscribeIcon dashboardId={dashboardId} />}
+ data-attr="dashboard-subscribe-prominent-button"
+ onClick={() => {
+ posthog.capture('dashboard subscribe clicked', {
+ dashboard_id: dashboardId,
+ })
+ push(urlForSubscriptions({ dashboardId }))
+ }}
+ >
+ Subscribe
+ </LemonButton>
+ )
+}
diff --git a/frontend/src/scenes/dashboard/DashboardSubscribeExperiment.tsx b/frontend/src/scenes/dashboard/DashboardSubscribeExperiment.tsx
deleted file mode 100644
index 9e2014099be2..000000000000
--- a/frontend/src/scenes/dashboard/DashboardSubscribeExperiment.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-import './DashboardSubscribeExperiment.scss'
-
-import { useActions, useValues } from 'kea'
-import { router } from 'kea-router'
-import posthog from 'posthog-js'
-
-import { IconBell, IconEllipsis } from '@posthog/icons'
-import { useFeatureFlagVariantKey } from '@posthog/react'
-
-import { FEATURE_FLAGS } from 'lib/constants'
-import { IconWithCount } from 'lib/lemon-ui/icons/icons'
-import { LemonButton } from 'lib/lemon-ui/LemonButton'
-import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
-import { userLogic } from 'scenes/userLogic'
-
-import { AvailableFeature } from '~/types'
-
-import { subscriptionsLogic } from 'products/subscriptions/frontend/components/Subscriptions/subscriptionsLogic'
-import { urlForSubscriptions } from 'products/subscriptions/frontend/components/Subscriptions/utils'
-
-import { dashboardLogic } from './dashboardLogic'
-
-type SubscribePlacement = 'button' | 'menu'
-
-function SubscribeCountIcon({ dashboardId }: { dashboardId: number }): JSX.Element {
- const { subscriptions } = useValues(subscriptionsLogic({ dashboardId }))
-
- return (
- <IconWithCount count={subscriptions?.length} showZero={false}>
- <IconBell className="DashboardSubscribeBell" fontSize="16" />
- </IconWithCount>
- )
-}
-
-function SubscribeIcon({ dashboardId }: { dashboardId: number }): JSX.Element {
- const { hasAvailableFeature } = useValues(userLogic)
-
- // Only read the count when the subscriptions logic is already mounted (e.g. side panel opened),
- // so an experiment arm never triggers an extra fetch just to render this badge.
- if (!hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS) || !subscriptionsLogic.isMounted({ dashboardId })) {
- return <IconBell className="DashboardSubscribeBell" fontSize="16" />
- }
-
- return <SubscribeCountIcon dashboardId={dashboardId} />
-}
-
-// Both placements mount in the header; each renders only when it matches the assigned variant.
-export function DashboardSubscribeExperiment({ placement }: { placement: SubscribePlacement }): JSX.Element | null {
- const { dashboard, canEditDashboard } = useValues(dashboardLogic)
- const { push } = useActions(router)
- const variant = useFeatureFlagVariantKey(FEATURE_FLAGS.DASHBOARD_SUBSCRIBE_PLACEMENT)
-
- if (!dashboard || !canEditDashboard || variant !== placement) {
- return null
- }
-
- const dashboardId = dashboard.id
- const openSubscriptions = (): void => {
- posthog.capture('dashboard subscribe clicked', {
- dashboard_id: dashboardId,
- variant,
- surface: placement,
- })
- push(urlForSubscriptions({ dashboardId }))
- }
-
- if (placement === 'menu') {
- return (
- <LemonMenu
- items={[
- {
- label: 'Subscribe',
- icon: <SubscribeIcon dashboardId={dashboardId} />,
- onClick: openSubscriptions,
- 'data-attr': 'dashboard-subscribe-menu-item',
- },
- ]}
- >
- <LemonButton
- type="tertiary"
- size="small"
- icon={<IconEllipsis fontSize="16" />}
- data-attr="dashboard-subscribe-menu"
- aria-label="More actions"
- />
- </LemonMenu>
- )
- }
-
- return (
- <LemonButton
- type="tertiary"
- size="small"
- icon={<SubscribeIcon dashboardId={dashboardId} />}
- data-attr="dashboard-subscribe-prominent-button"
- onClick={openSubscriptions}
- >
- Subscribe
- </LemonButton>
- )
-}