Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Experiment with language on billing pages in app #20567

Merged
merged 66 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
f96e4d8
toggle upgrade language depending on flag value
Feb 27, 2024
99653cc
forgot some local changes
Feb 27, 2024
8f4728c
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Feb 29, 2024
24472cf
update credit card case language
Feb 29, 2024
b126319
Update UI snapshots for `chromium` (1)
github-actions[bot] Feb 29, 2024
eab15c7
add event to record subscription status
Mar 1, 2024
756e0eb
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 1, 2024
060cab2
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 1, 2024
a36121c
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 1, 2024
c598759
add tests
Mar 1, 2024
bd3c9d4
remove length check
Mar 1, 2024
f156bd1
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 2, 2024
2020dd7
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 4, 2024
3b6537f
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 4, 2024
bdd10b4
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 4, 2024
809f967
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 4, 2024
86ea4b1
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 4, 2024
cae427d
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 4, 2024
e7be167
make common button component
Mar 4, 2024
7b398db
some more small changes
Mar 5, 2024
f7b0efa
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 5, 2024
0aa359c
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 5, 2024
f6c6dec
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 5, 2024
eebfea9
remove extraneous files
Mar 5, 2024
811bd28
remove optional chaining
Mar 5, 2024
3a60b37
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 5, 2024
37c8aba
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 5, 2024
c1053d7
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 5, 2024
eee2dbf
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 6, 2024
b05947d
remove test...rename event
Mar 6, 2024
e5f1928
Merge branch 'master' into by/billing-page-language
xrdt Mar 6, 2024
770e636
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 6, 2024
6872e41
didn't save before commiting
Mar 6, 2024
e750e0c
undo changes to billing cypress test
Mar 6, 2024
c94aa31
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 6, 2024
66db709
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 6, 2024
e3d8e41
finally get cypress to work!
Mar 7, 2024
578068f
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 7, 2024
f9de718
small fix to test
Mar 7, 2024
e89e47c
Merge remote-tracking branch 'origin' into by/billing-page-language
Mar 7, 2024
1bee5a0
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 7, 2024
15c0b1c
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 7, 2024
0c06558
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 13, 2024
74a0b70
remove from paygate mini
Mar 13, 2024
22fa7de
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 13, 2024
2859414
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 13, 2024
195b386
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 13, 2024
9e3d648
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 14, 2024
3dbfcbc
remove paygate test
Mar 14, 2024
4b63d15
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 14, 2024
8195a88
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 14, 2024
d9075e4
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 14, 2024
80d1bf7
remove extraneous files
Mar 14, 2024
1dd2cfd
remove files!
Mar 14, 2024
c78fbf5
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 14, 2024
2f726c2
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 14, 2024
4f9625d
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 14, 2024
b230f95
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 14, 2024
96e2d8d
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 14, 2024
58dff56
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 14, 2024
4adb470
Merge branch 'master' into by/billing-page-language
raquelmsmith Mar 14, 2024
fa83cfc
update tests
Mar 15, 2024
e4874b3
Merge remote-tracking branch 'origin/master' into by/billing-page-lan…
Mar 18, 2024
e82d259
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 18, 2024
88e10ac
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 18, 2024
518f7fd
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export const FEATURE_FLAGS = {
REPLAY_SIMILAR_RECORDINGS: 'session-replay-similar-recordings', // owner: #team-replay
SAVED_NOT_PINNED: 'saved-not-pinned', // owner: #team-replay
EXPORTS_SIDEPANEL: 'exports-sidepanel', // owner: #team-product-analytics
BILLING_UPGRADE_LANGUAGE: 'billing-upgrade-language', // owner: @biancayang
} as const
export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS]

Expand Down
22 changes: 20 additions & 2 deletions frontend/src/scenes/UpgradeModal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { LemonButton, LemonModal } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { capitalizeFirstLetter } from 'lib/utils'
import posthog from 'posthog-js'

import { billingLogic } from './billing/billingLogic'
import { sceneLogic } from './sceneLogic'
import { urls } from './urls'

Expand All @@ -11,6 +14,8 @@ export function UpgradeModal(): JSX.Element {
const { hideUpgradeModal } = useActions(sceneLogic)

const [featureName, featureCaption] = upgradeModalFeatureNameAndCaption ?? []
const { featureFlags } = useValues(featureFlagLogic)
const { billing } = useValues(billingLogic)

return (
<LemonModal
Expand All @@ -28,7 +33,13 @@ export function UpgradeModal(): JSX.Element {
posthog.capture('upgrade modal pricing interaction')
}}
>
Upgrade now
{featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' &&
!billing?.customer_id
? 'Add credit card'
: 'Upgrade'}{' '}
now
</LemonButton>
</>
}
Expand All @@ -39,7 +50,14 @@ export function UpgradeModal(): JSX.Element {
<b>{featureName && capitalizeFirstLetter(featureName)}</b> is an advanced PostHog feature.
</p>
{featureCaption && <p>{featureCaption}</p>}
<p className="mb-0">Upgrade and get access to this, as well as to other powerful enhancements.</p>
<p className="mb-0">
{featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' && !billing?.customer_id
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this check for whether they have an associated stripe id and therefore have added a credit card before is going to make feature flag analysis complicated. I think we should change this (and all other instances, of course) to say "add credit card" if they don't have a customer_id and "link existing credit card" if they do.

Copy link
Member

@raquelmsmith raquelmsmith Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think it should be:

  • If they do not have active sub:
    • "Subscribe" / "Upgrade" / "Add credit card"
  • If they do have active sub:
    • "Subscribe" / "Upgrade" / "Add (to plan? to my subscription?)"

Because of the different cohorts here we should make sure we can read results reliably.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to say "add paid plan" on the credit card flag w/ subscription condition.

? 'Add credit card'
: 'Upgrade'}{' '}
to get access to this and other powerful enhancements.
</p>
</LemonModal>
)
}
10 changes: 9 additions & 1 deletion frontend/src/scenes/billing/Billing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import { router } from 'kea-router'
import { SurprisedHog } from 'lib/components/hedgehogs'
import { PageHeader } from 'lib/components/PageHeader'
import { supportLogic } from 'lib/components/Support/supportLogic'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
import { IconCheckCircleOutline } from 'lib/lemon-ui/icons'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel'
import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { useEffect } from 'react'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { SceneExport } from 'scenes/sceneTypes'
Expand Down Expand Up @@ -49,6 +51,7 @@ export function Billing(): JSX.Element {
const { reportBillingV2Shown } = useActions(billingLogic)
const { preflight, isCloudOrDev } = useValues(preflightLogic)
const { openSupportForm } = useActions(supportLogic)
const { featureFlags } = useValues(featureFlagLogic)

if (preflight && !isCloudOrDev) {
router.actions.push(urls.default())
Expand Down Expand Up @@ -317,7 +320,12 @@ export function Billing(): JSX.Element {
to={upgradeAllProductsLink}
disableClientSideRouting
>
Upgrade all
{featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe to all'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' &&
!billing?.customer_id
? 'Add credit card to all products'
: 'Upgrade to all'}{' '}
</LemonButton>
)}
</div>
Expand Down
19 changes: 17 additions & 2 deletions frontend/src/scenes/billing/BillingProduct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IconPlus } from '@posthog/icons'
import { LemonButton, LemonSelectOptions, LemonTable, LemonTag, Link } from '@posthog/lemon-ui'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
import {
IconArticle,
Expand Down Expand Up @@ -221,6 +222,7 @@ export const BillingProduct = ({ product }: { product: BillingProductV2Type }):
} = useActions(billingProductLogic({ product, productRef }))
const { reportBillingUpgradeClicked } = useActions(eventUsageLogic)

const { featureFlags } = useValues(featureFlagLogic)
const showUpgradeCTA = !product.subscribed && !product.contact_support && product.plans?.length
const upgradePlan = currentAndUpgradePlans?.upgradePlan
const currentPlan = currentAndUpgradePlans?.currentPlan
Expand Down Expand Up @@ -615,7 +617,15 @@ export const BillingProduct = ({ product }: { product: BillingProductV2Type }):
{additionalFeaturesOnUpgradedPlan?.length > 0 ? (
<>
<p className="ml-0 max-w-200">
{product.subscribed ? 'You now' : 'Upgrade to'} get sweet features such as:
{product.subscribed
? 'You now'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe to'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' &&
!billing?.customer_id
? 'Add credit card to'
: 'Upgrade to'}{' '}
get sweet features such as:
</p>
<div>
{additionalFeaturesOnUpgradedPlan?.map((feature, i) => {
Expand Down Expand Up @@ -697,7 +707,12 @@ export const BillingProduct = ({ product }: { product: BillingProductV2Type }):
className="grow"
center
>
Upgrade
{featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' &&
!billing?.customer_id
? 'Add credit card'
: 'Upgrade'}
</LemonButton>
</div>
</div>
Expand Down
23 changes: 21 additions & 2 deletions frontend/src/scenes/billing/PlanComparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { IconWarning, IconX } from '@posthog/icons'
import { LemonButton, LemonModal, LemonTag, Link } from '@posthog/lemon-ui'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { IconCheckmark } from 'lib/lemon-ui/icons'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import React from 'react'
import { getProductIcon } from 'scenes/products/Products'
Expand Down Expand Up @@ -113,6 +115,7 @@ export const PlanComparison = ({
const { billing, redirectPath } = useValues(billingLogic)
const { width, ref: planComparisonRef } = useResizeObserver()
const { reportBillingUpgradeClicked } = useActions(eventUsageLogic)
const { featureFlags } = useValues(featureFlagLogic)

const upgradeButtons = plans?.map((plan) => {
return (
Expand All @@ -131,7 +134,16 @@ export const PlanComparison = ({
}
}}
>
{plan.current_plan ? 'Current plan' : 'Subscribe'}
{plan.current_plan
? 'Current plan'
: plan.free_allocation && !plan.tiers
? 'Select' // Free plan
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' &&
!billing?.customer_id
? 'Add credit card'
: 'Upgrade'}
</LemonButton>
{!plan.current_plan && !plan.free_allocation && includeAddons && product.addons?.length > 0 && (
<p className="text-center ml-0 mt-2 mb-0">
Expand All @@ -140,7 +152,14 @@ export const PlanComparison = ({
className="text-muted text-xs"
disableClientSideRouting
>
or subscribe without addons
or{' '}
{featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'subscribe'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' &&
!billing?.customer_id
? 'add credit card'
: 'upgrade'}{' '}
without addons
</Link>
</p>
)}
Expand Down
19 changes: 17 additions & 2 deletions frontend/src/scenes/onboarding/OnboardingBillingStep.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { StarHog } from 'lib/components/hedgehogs'
import { FEATURE_FLAGS } from 'lib/constants'
import { IconCheckCircleOutline } from 'lib/lemon-ui/icons'
import { Spinner } from 'lib/lemon-ui/Spinner'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { useState } from 'react'
import { getUpgradeProductLink } from 'scenes/billing/billing-utils'
Expand All @@ -29,6 +31,7 @@ export const OnboardingBillingStep = ({
const { reportBillingUpgradeClicked } = useActions(eventUsageLogic)
const plan = currentAndUpgradePlans?.upgradePlan
const currentPlan = currentAndUpgradePlans?.currentPlan
const { featureFlags } = useValues(featureFlagLogic)

const [showPlanComp, setShowPlanComp] = useState(false)

Expand All @@ -50,7 +53,12 @@ export const OnboardingBillingStep = ({
reportBillingUpgradeClicked(product.type)
}}
>
Subscribe to Paid Plan
{featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe to paid plan'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'credit_card' &&
!billing?.customer_id
? 'Add credit card to get paid features'
: 'Upgrade to paid plan'}
</LemonButton>
)
}
Expand All @@ -63,7 +71,14 @@ export const OnboardingBillingStep = ({
<div className="flex gap-x-4">
<IconCheckCircleOutline className="text-success text-3xl mb-6" />
<div>
<h3 className="text-lg font-bold mb-1 text-left">Subscribe successful</h3>
<h3 className="text-lg font-bold mb-1 text-left">
{featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] === 'subscribe'
? 'Subscribe successful'
: featureFlags[FEATURE_FLAGS.BILLING_UPGRADE_LANGUAGE] ===
'credit_card' && !billing?.customer_id
? 'Successfully added credit card'
: 'Upgrade successful'}
</h3>
<p className="mx-0 mb-0">You're all ready to use {product.name}.</p>
</div>
</div>
Expand Down
Loading