: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(customer-analytics): always show the account external ID (#108396)
Christophe Eynius Tranbergb994aced2d83
diff --git a/docs/internal/customer-analytics/account-sidebar.md b/docs/internal/customer-analytics/account-sidebar.mdindex e949830d50fc..a6109eab3b9f 100644--- a/docs/internal/customer-analytics/account-sidebar.md+++ b/docs/internal/customer-analytics/account-sidebar.md@@ -21,6 +21,7 @@ the main account content on wide account scenes.At the top of the sidebar, the left action opens a modal where you add the account to your event stream. If your stream isn't set up or is turned off, the modal links to the event stream settings. The back arrow on the settings page returns to the account. The right action edits the account.The account editor includes the name, website domain, billing ID, Slack channel ID, Salesforce ID, email domains, and known emails.It also includes the Stripe ID when the account already has one. The external ID remains read-only.+The external ID shows under the account name on every account page, with a copy button.Saving refreshes the account title and breadcrumb. A failed save keeps the editor open for retry.Pinned rows load current values for the selected account. Missing custom values displaydiff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 8eedceede93d..d0169258513d 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -8699,13 +8699,13 @@ snapshots:scenes-app-businessknowledge-knowledgesourcenamecell--user-text--light:hash: v1.k794b7964.fba04716b8f344e21fa3bb2ec69e627bd9836ff2161986538ac2b562973b0edc.Xl-YJ8Poqz1nofU4nIyAfnM4GbZZ1YYtbM37mIzZ4w4scenes-app-customer-analytics-account-detail--default--dark:- hash: v1.k794b7964.e406f25e10ea518a95bc5facd84b2eb328fb2510f7c84775a4e194defd7e68ee.10U-4oFjHBL3kpfrMkIXXRByXOcG082RMJqiuKuJnYM+ hash: v1.k794b7964.4a2c8fd1f6e62fadf3a11ec937086d0ab3e97c820541fe568789683d1517124d.TDZuljsH5Uy2rQ4pSkDrrazjA-SlyfGn52R4n9Ix4acscenes-app-customer-analytics-account-detail--default--light:- hash: v1.k794b7964.6e361eda840f3562080ab5a82e1b77d046151674ced3c2040d93ae381a3ba9c4.2eeP7b-IFlqXCNnod08vFTQ0oc9hNBxzcFfAAOz5wXk+ hash: v1.k794b7964.3dc16f08d0f41b7d7cf6b0e84392580fb009090e3bb7fc8ad9ff8c6a4b8b5c0e.hTnJ40qtoFvmt2g1j9aw7zm4mSIulD0osQgS2SjLKI4scenes-app-customer-analytics-account-detail--external-id--dark:- hash: v1.k794b7964.7a97ff01865aa33e2e515dbcfa3271c4d09b30e178c2068cfd6c50b354dc0c88.M4v9oXKbuYzcCJpEjJxSBlFvxNVJ_ML54IzW5y0drwA+ hash: v1.k794b7964.26a93f54f5fe293e17ee0f7315163a5b14c71e1e78e1bb8adc78f09ca04412f3.4gU8PFyIaVQrS8zOPX6Al_eLweeNi9XIAQ9hfr2pzagscenes-app-customer-analytics-account-detail--external-id--light:- hash: v1.k794b7964.0dd4405e4b4afc137065998960479aead50b51dd699d78fcd5ee69a7f0c341ef.6ZpL-2UskmHTXtHbB2Fym3H1GBqkpNILhX5aN5_VdKY+ hash: v1.k794b7964.ba37b8bdfb72378768cbb9461ca2572f535c959b4c506b23329c5b3d310c77c6.KGICYox6wm5BBVgvW2c5GXZfbOf9S5QScOhY9rSEFWIscenes-app-customer-analytics-account-detail--narrow--dark:hash: v1.k794b7964.acb3423c3a688e82a8d3304f52abc9ec9fe1bb85b498b2a5014c2a2e95b9d877.O3Dc_DGbMRxU8xAvLVsLhmaDF30FZT7vFNKa5dkYlq0scenes-app-customer-analytics-account-detail--narrow--light:diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/AccountExternalId.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/AccountExternalId.tsxnew file mode 100644index 000000000000..3dc5767abd87--- /dev/null+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/AccountExternalId.tsx@@ -0,0 +1,12 @@+import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'++export function AccountExternalId({ externalId }: { externalId: string }): JSX.Element {+ return (+ <div className="flex items-center gap-1 min-w-0" data-attr="account-external-id">+ <span className="text-secondary shrink-0">External ID:</span>+ <CopyToClipboardInline explicitValue={externalId} description="external ID" iconSize="xsmall">+ {externalId}+ </CopyToClipboardInline>+ </div>+ )+}diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsxindex c0c6b7b0146f..818d84704d12 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.stories.tsx@@ -10,7 +10,8 @@ import type { CustomPropertyValueWriteApi, AccountRelationshipWriteApi } from '.import { createAccountViewContent } from './accountViewDocument'const ACCOUNT_ID = '11111111-2222-4333-8444-555555555555'-const EXTERNAL_ACCOUNT_ID = 'spaces %2F slash / ? # + Unicode 漢字'+const EXTERNAL_ACCOUNT_ID = '0190f3a2-6b7c-7d8e-9f01-23456789abcd'+const URL_UNSAFE_EXTERNAL_ACCOUNT_ID = 'spaces %2F slash / ? # + Unicode 漢字'const ACCOUNT_RETRIEVE_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/'const ACCOUNT_BY_EXTERNAL_ID_ENDPOINT = 'api/projects/:team_id/accounts/by_external_id/'const ACCOUNT_NOTEBOOKS_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/notebooks/'@@ -116,8 +117,8 @@ const meta: Meta = {get: {[ACCOUNT_RETRIEVE_ENDPOINT]: account,[ACCOUNT_BY_EXTERNAL_ID_ENDPOINT]: ({ request }) =>- new URL(request.url).searchParams.get('external_id') === EXTERNAL_ACCOUNT_ID- ? account+ new URL(request.url).searchParams.get('external_id') === URL_UNSAFE_EXTERNAL_ACCOUNT_ID+ ? { ...account, external_id: URL_UNSAFE_EXTERNAL_ACCOUNT_ID }: [400, null],[ACCOUNT_NOTEBOOKS_ENDPOINT]: notebooks,[ACCOUNT_ICON_ENDPOINT]: () =>@@ -197,7 +198,7 @@ export const Default: Story = {export const ExternalId: Story = {render: () => <App />,parameters: {- pageUrl: urls.customerAnalyticsAccountByExternalId(EXTERNAL_ACCOUNT_ID, 'usage'),+ pageUrl: urls.customerAnalyticsAccountByExternalId(URL_UNSAFE_EXTERNAL_ACCOUNT_ID, 'usage'),testOptions: {waitForSelector: ['[data-attr="customer-analytics-account-scene"]', '.ProfileBubbles'],viewport: { width: 1280, height: 900 },diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.tsxindex 12afa3788b64..b3c8c06bfdd0 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsAccountScene/CustomerAnalyticsAccountScene.tsx@@ -21,6 +21,7 @@ import { customerAnalyticsFeaturePreviewGate } from '../../featurePreviewGate'import type { AccountApi } from '../../generated/api.schemas'import { AccountDetailActions } from './AccountDetailActions'import { AccountDetailNavigation } from './AccountDetailNavigation'+import { AccountExternalId } from './AccountExternalId'import { AccountPresence } from './AccountPresence'import { AccountSidebar } from './AccountSidebar'import { AccountViewEditorModal } from './AccountViewEditorModal'@@ -138,6 +139,7 @@ function CustomerAnalyticsAccountSceneContent(): JSX.Element {</>}/>+ {account.external_id ? <AccountExternalId externalId={account.external_id} /> : null}<SceneDivider /><div className="@container/account-detail flex flex-1 min-h-0 overflow-y-auto -mt-4 -mr-4 [scrollbar-gutter:stable] @min-[60rem]:-ml-4 @min-[60rem]:[scrollbar-gutter:auto]"><div className="flex min-h-full w-full flex-col gap-4 @min-[60rem]/account-detail:h-full @min-[60rem]/account-detail:min-h-0 @min-[60rem]/account-detail:flex-row">