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(product-analytics): improve home overview and dashboard setup (#109235)

Daniel Parker8328ac2b5f51
diff --git a/.semgrep/rules/security/idor-team-scoped-models.yaml b/.semgrep/rules/security/idor-team-scoped-models.yaml
index 8deca3e24070..62fe2cae41de 100644
--- a/.semgrep/rules/security/idor-team-scoped-models.yaml
+++ b/.semgrep/rules/security/idor-team-scoped-models.yaml
@@ -140,6 +140,7 @@ rules:
|Dashboard
|DashboardTemplate
|DashboardWidget
+ |TeamHomeTabDashboardConfig
|DataColorTheme
|DataModelingJob
|DataQualityCheck
@@ -589,6 +590,7 @@ rules:
|Dashboard
|DashboardTemplate
|DashboardWidget
+ |TeamHomeTabDashboardConfig
|DataColorTheme
|DataModelingJob
|DataQualityCheck
diff --git a/docs/published/handbook/engineering/conventions/frontend-coding.md b/docs/published/handbook/engineering/conventions/frontend-coding.md
index e1ba2cd89d86..164108902d09 100644
--- a/docs/published/handbook/engineering/conventions/frontend-coding.md
+++ b/docs/published/handbook/engineering/conventions/frontend-coding.md
@@ -40,6 +40,7 @@ Hence the explicit separation between the data and view layers.
- Reach for an existing design-system component (Lemon/quill) before hand-rolling markup — reuse is how new UI stays on-brand. When you genuinely need a custom component, build it from the system's tokens and primitives and match the surrounding scene's density; avoid the generic AI-generated look (purple gradients, glassmorphism, gradient text, icon-tile card grids, decorative motion).
- Before building new UI, read a few comparable scenes or components and model yours on the ones that follow these conventions. The codebase contains legacy that predates them — an existing violation is not license to repeat it. Conventions outrank precedent, and compliant precedent outranks invention.
- Extract a shared component once the same shape appears in several places and the call sites read as content, not markup. Keep new generics next to the feature that uses them, and promote to `lib/` only when a second feature needs them. Don't build wrappers with a single consumer, and don't add boolean variant props so one caller can switch half the component off — that's two components.
+ - Analytics overview cards in the LemonUI web app share `lib/components/AnalyticsMetricCard/AnalyticsMetricCard`. It wraps the chart library metric content with a consistent surface and loading, error, and empty states. Supply `data` and `theme` for a sparkline, `showChange` for comparisons, and `onClick` for a native button with a visible interaction cue. `selected` highlights a card that controls the displayed chart. Quill surfaces can compose `Metric` with `Card` instead.
- Interactive elements are real `<button>`/`<a>` elements (`LemonButton` renders one) — never `onClick` on a `<div>`.
- With `focusBasedKeyboardNavigation` enabled, `LemonMenu` moves focus between its trigger and menu items with the arrow keys, including after the menu reopens. Custom triggers must forward `onFocus` and `onKeyDown` to preserve keyboard navigation and focus return.
- Loading, empty, and error are three different screens. Never show an empty state from data that hasn't resolved yet — branch on the loading state first.
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 721544c45107..9295eba6e134 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -372,6 +372,38 @@ snapshots:
hash: v1.k794b7964.1e8632ade162cec51703e189e039e706ae9ce531b7354507a82b53d8252ca0a3.2XCqcFI0IcjfmnH685RCadJB6OEzjeekYpU-L0ByH3w
components-agentpromptbutton--size-variants--light:
hash: v1.k794b7964.267dcab19745d5003ee38ad365932a4c19670bd991f32bc2657c7a75c40730c2.XWIX3mam7QtwaD9Yj-62kcDr8A_u-3mNOXWDu7cXRcE
+ components-analytics-metric-card--clickable--dark:
+ hash: v1.k794b7964.846f217ef1fcc05e85dc95b34b84a817cce507985b5fbc8086bee3480c670276.E6S99BifS6aVQOtumx_K2RMR10GhW3D6qfKRPsP49A8
+ components-analytics-metric-card--clickable--light:
+ hash: v1.k794b7964.a571e38def8318afe693dfb7f3f25f6d0512f931d3e63378b0a73bdff9ea0a39.EbdBu0jQeyChJWSH6c7isOREut44HY9SlRRLtS4bjeI
+ components-analytics-metric-card--empty--dark:
+ hash: v1.k794b7964.3ba32078bea436db2300a976475caa3e0eb4efcef46b761766a785b0e3990b90.HnU-H_2FdCpQPgZH_Dc8ICTDVbn-XLDb1EUkImMuaKk
+ components-analytics-metric-card--empty--light:
+ hash: v1.k794b7964.bd3b828a262386ad6e27b77118d797713d505a399e06b4cd1ca17a36c7062950.679weTsm3E3apTQVSx-wP-09fBznBGIs6l2wWK_tYbI
+ components-analytics-metric-card--error--dark:
+ hash: v1.k794b7964.42a9c373dff2748cd3d83f854914a19424cd4fc45093bebf62f549fe609fba8c.3suvJwRNPCpwniHTGja3HtBNxEPKT5scxDjeE7Lj9ow
+ components-analytics-metric-card--error--light:
+ hash: v1.k794b7964.9f3473437f68a2032385d5485f10a5c649eccf5116bd3d6a3d8abd1b962059c1.RQfBpStU8HwfVK1qYJQWenuAkJHOr-G0Moza-HckjPo
+ components-analytics-metric-card--loading--dark:
+ hash: v1.k794b7964.37036bf980d2a2a28e8992ffced938b619ad896de4385fbf89a6c8426f5f09c6.AKj7xUYq-A7pnk8cKoWSclgLmeqhsGA1_47k-9xQ0Qo
+ components-analytics-metric-card--loading--light:
+ hash: v1.k794b7964.069bd3b30660036806a7e8f8c728fcf58917c840ae2814bd80df8cd3084b94db.msGiRj6OtNr9j_bw2XvdxS4GnpYJ76wfRPUi1266qhY
+ components-analytics-metric-card--selected--dark:
+ hash: v1.k794b7964.7a3e295fe3ca99743769730db43c4d2869f7de6ece4c7bdc3e5d6a3fbab4f929.XxFKbT84R_Op8zLwpioY49fH23gXoI0-UvTCGA0BvbE
+ components-analytics-metric-card--selected--light:
+ hash: v1.k794b7964.7d20d4e423376168d13f9345985c07f26f9ab856e0f80d9ba1c10e705c8c77f6.L2-LgZ5IQn0qKykqwY3zNaNcZcqeNi-goK1Mnh5u16E
+ components-analytics-metric-card--static--dark:
+ hash: v1.k794b7964.b4f876501a8e05f669cd95f2b892eb7fea9f825067bc8f26bb22450fcb6474e3.DoQoHaZyK2VE_Cjwc7XIn_c-W58hIqabExaPHfqypAc
+ components-analytics-metric-card--static--light:
+ hash: v1.k794b7964.419d84626ba816074237ea7473c809fc667eabea42be1e794ae6ad1b929c83ad.1NJJNHZBCvX9aLPgDyXL4cMVcxP32F_fwLpryL7PH0U
+ components-analytics-metric-card--with-trend-line--dark:
+ hash: v1.k794b7964.868051e2a76ec3bd5b2f6fd855bfa6177a8c032d8316ebadaf8928a8b7266720.m1wS2vknG1qg3aNxI8M8gLH_oKJvziOEqyTja9HhTMY
+ components-analytics-metric-card--with-trend-line--light:
+ hash: v1.k794b7964.445a8c326d8da069b1a6b16199ed2c311da2f0efd1160577b8024b401f6136b3.TSrr6_33ZhgHYFoeIG50OKkQAj3bbn2bSLxafFOHZFk
+ components-analytics-metric-card--without-comparison--dark:
+ hash: v1.k794b7964.99d0b6b53b732fb84ea85da9d760b5880ece7cfb8093bd1f7253cdefd0c6a6ac.LdkjBAY9C3sQgCiBOdx_mVzUyh9IV8uNoUvxhafX1Ec
+ components-analytics-metric-card--without-comparison--light:
+ hash: v1.k794b7964.3578470b698091930638869f2699a840c0bd42d897625af8d81ba00297b50083.iuQtvqVekqJZlV9cy1E6Rv4rr4oAJ3fUcwuh1gszpL4
components-bulkupdatetagsbutton--add-mode--dark:
hash: v1.k794b7964.ba66e3fd796ded95414954112b8e8ad07474b5be373cb4e98ecf3e56d8f61aab.jgsY9nY4c4c5rgf0ML5534zPOMlCIbIubJMaH2hRaig
components-bulkupdatetagsbutton--add-mode--light:
@@ -11618,6 +11650,26 @@ snapshots:
hash: v1.k794b7964.9b9cc1445c7ce703d3b0dbb3d4a92be579932829994f414f1de80f8016ea1154.jb54m6G-4sIokLRkpEnOPhJu-hxlxtfJcQ7ri7sI3WY
scenes-app-insights-posthog-ai-suggestion--default--light:
hash: v1.k794b7964.63299b5e251d2a6beb724655ad8791f82f58ae681bb2c931ba6339dd8fe92a56.vHLJvasOolcLGCjkSmIZqRFJ0CQmc5nTTpBBT40kSc0
+ scenes-app-insights-product-analytics-insight-home-guide--funnels--dark:
+ hash: v1.k794b7964.fab2385c6c126fa66ec61ef7c23d2b088db64ca1964af0d3001ab11c22f1a3fe.Uu9ELMZLccJy_vcfoGQ09OzPwdjupgWe93Lkd6atCdo
+ scenes-app-insights-product-analytics-insight-home-guide--funnels--light:
+ hash: v1.k794b7964.6ebdae6ca71378e784d0c912b0ebf94418b4f2c4b4551d96ff5cc8f1619d4e8c.TOU2zrDNZREZV-q6iAhcZdxB9mPRrVOX11ByG2_1DKI
+ scenes-app-insights-product-analytics-insight-home-guide--narrow--dark:
+ hash: v1.k794b7964.861ec513cd14587d57f4702f3dfa3e70033ccbc24a2f02286b177c60f5120732.hgzMjcfGdrAWfLV8MiizENlJKyO2f30AiaMwJGnb1Ek
+ scenes-app-insights-product-analytics-insight-home-guide--narrow--light:
+ hash: v1.k794b7964.4af77a7759ccf0b864d408caa277db23ab259a2f6f1f6a618c60dd26052af488.xsbEzXeBts7QeJHq_w2DKCmYyAJ5r8L7s6GkmjH-gG4
+ scenes-app-insights-product-analytics-insight-home-guide--paths--dark:
+ hash: v1.k794b7964.2a6ea74d467ad812a0ae7541cae65e32af270244fa73367180cec0a400cc1362.BM-2qG9ErLi5BLXlVAQL_1lDIGhRlvrvBSUdaOQwWVY
+ scenes-app-insights-product-analytics-insight-home-guide--paths--light:
+ hash: v1.k794b7964.1dceeec1c0103c7e99a762f60586e3c151655f02b0d5f9fcc4f3ed1fb65cac26.j0xdhA9dUKSzPdAE3fdx_beiWTJJW_-7JlkM4pNBQAY
+ scenes-app-insights-product-analytics-insight-home-guide--phone--dark:
+ hash: v1.k794b7964.e16ddbf5bc13ff9b25204d66f970b88a846a38b4e6c11e69ff0bdf02fdf58c23.m5Q2sir_2Z7mC3ouDcj_KExVUb39F5Dca_cErcmF0pg
+ scenes-app-insights-product-analytics-insight-home-guide--phone--light:
+ hash: v1.k794b7964.b3b1359e543fbc6e7c182403e5555f57bc56b16c0366b457e6e33b7d3c55c495.YLaJOV4SAAoOq93oGPR8TxXiFFPqbpZDhuK2ThAebeE
+ scenes-app-insights-product-analytics-insight-home-guide--stickiness--dark:
+ hash: v1.k794b7964.1815d6b15a80dacb88e8d98a66a2e1035455a403740a030f00f6cb63f6f1a177.6eKsStdtnoXNaKMqBXWRflMufeia2LIyskiDQAb1ehY
+ scenes-app-insights-product-analytics-insight-home-guide--stickiness--light:
+ hash: v1.k794b7964.a0210d5b109541457b72b6bd02509db0827d03a85e1fc986d46ace118de975de.3cCSNF6omEhMKUEBSLVzi3YLvnVrSwZ7UA3w2MkL7Qc
scenes-app-insights-side-panel-actions--saved-data-visualization--dark:
hash: v1.k794b7964.57c582d5224e7a3008ca82becdcb0b7108d54df64a341aa2f66927f193534a02.aLr9rbd8XdUYtM06IQBvu_3ylrHYi6RoR4FYZ1f8Dng
scenes-app-insights-side-panel-actions--saved-data-visualization--light:
@@ -12742,6 +12794,42 @@ snapshots:
hash: v1.k794b7964.391102534d669872e56c9486d30d2f564a9e585650c4d2f766fd79cf710dfc0e.FzCVV4b9mvwjCrQqe3Rs52Tj5aYHbVNe2IqRInXRDzQ
scenes-app-posthog-ai-tools--thread-with-sql-query-overflow--light:
hash: v1.k794b7964.998984fe26c3f9ce26629da81e63f19891aa45441c08b9ae5dccf1d497c9bddd.DdAh6vm68mAVp3cDCyYG54XXY4qjsjbYA_Zd7aY-AHY
+ scenes-app-product-analytics-home-chart-card--primary--dark:
+ hash: v1.k794b7964.be0c35a72da8f9b6054aaf9a1c66796ffed65064a651d941f4ef1bb9ed54d630.VPt-I_iYCWpupwUzHAWBzEuogRWEX5aOP5VcVMTpSMQ
+ scenes-app-product-analytics-home-chart-card--primary--light:
+ hash: v1.k794b7964.3029d681745bb041a125cd38a82c90d88e8c1c4f1c94e983f1a2afe002b399c7.P2tcznoufujQ1-OR3EiKU0wghPvd46O5Xx0NK-v0k3Y
+ scenes-app-product-analytics-home-dashboard-starter--ai-unavailable--dark:
+ hash: v1.k794b7964.5bf7151d2a7e6ef56d5a76e338e75b59633fa7eb89147dbdd184d05786b20fed.8PVRxPC366nvKYdY0J2GsSAsYuMFCBJ07Oyofv4O_jA
+ scenes-app-product-analytics-home-dashboard-starter--ai-unavailable--light:
+ hash: v1.k794b7964.5f9f0a650d937fb0cffc296e40e8a41684924607128959f5f1900d7bc4b01311.5qPlWuFBvIco06jGpJL1swWQq59BCnILpz9AZNkkv0w
+ scenes-app-product-analytics-home-dashboard-starter--creating-with-ai--dark:
+ hash: v1.k794b7964.629ddf06258af494702a2160340959f0620bc81299448204eb93235a9109bafc.29iBASvfNT2PzBNlR3qTpPsdZi7etOSdwDCnH0wshjk
+ scenes-app-product-analytics-home-dashboard-starter--creating-with-ai--light:
+ hash: v1.k794b7964.fd8ab5342ac51f4729f9a385de5dd5ab2956ffcd6b29eb1690a72a462bf90f4e.7bgTiJJU_H3zQo07hjK3q7qJ5-bNaY_GiHefUVE9JeM
+ scenes-app-product-analytics-home-dashboard-starter--default--dark:
+ hash: v1.k794b7964.774bf9c6790573a26157a45e4d8906da9b11c99802aabcee5ad6af747a344013.9J29IAXV-wsmcrNLKmNcBE6XpXriHSavjhlkQcQMfgw
+ scenes-app-product-analytics-home-dashboard-starter--default--light:
+ hash: v1.k794b7964.34810e36faf714c7bf5c221d7617aca16ce168c1ee3c3f227849a53c4e4ff026.M6O6oXEJbVYa_V8uAbBAKiI3absozEiU7BieF29xDhQ
+ scenes-app-product-analytics-home-dashboard-starter--narrow--dark:
+ hash: v1.k794b7964.e706f55976c5b7194cb0c31f33144de525c0a49b658a1a18a86f6731fc5d4a7c.7WRp1QfY2fhPOPDq-gxBWB8LhLzrfk8IwJA7oS0jQiM
+ scenes-app-product-analytics-home-dashboard-starter--narrow--light:
+ hash: v1.k794b7964.276d0ef80178dc508a340cb81bf8f52296b6703670c087bb40eac140a32e2502.CaSSqGEDyId0v_dBLKPSZ8fdeD7T2EHYOl6aATO1HwQ
+ scenes-app-product-analytics-home-dashboard-starter--with-custom-dashboard--dark:
+ hash: v1.k794b7964.7af35801aa8aa0db5a26914c106505559cc49bbf95fa8098cc84c74f8a52741d.IWvbgu_dQv4iVAPePRgd1d1A0t7BLfFoTHoe8Y_G0es
+ scenes-app-product-analytics-home-dashboard-starter--with-custom-dashboard--light:
+ hash: v1.k794b7964.3955f90c8826d28cbc8ea87ae21c2736e2ff3b67999586e1901969a2a11a7acb.YjXt5UQ0a2xK9iFx0IGxA9lIQFU4q66REMcDhWsHAXs
+ scenes-app-product-analytics-home-overview--empty--dark:
+ hash: v1.k794b7964.803d51407dca494e41d04f4cb5fb324abd193b22d9cad2b60b92087ec1bf76b5.nESq7Ay6ngu1UriAYHASMUKdnt6lU8FQZwgXkFcizKw
+ scenes-app-product-analytics-home-overview--empty--light:
+ hash: v1.k794b7964.bbc8f2807fbdbb994335bd45527ec76fae3715471ee2e97663b08bcc9fd6f622.UW0QtE1YywbSW_gQEL4Gq1k7rRkBXYQQtsxiE3GNf4I
+ scenes-app-product-analytics-home-overview--narrow--dark:
+ hash: v1.k794b7964.4d04359aa53bcfabf00967078e5a215c003ac657b5b5d853e64fa7e71e3c443f.5t3Ji1LF5ca5Km2dL1gxG4gAhEmwM8k59iqhASKoipQ
+ scenes-app-product-analytics-home-overview--narrow--light:
+ hash: v1.k794b7964.2ffdf59f48b6704e20a63596b31df139704c3ca8bef552ef7c7f3c941494af28.MpoDEJI5dzQzf_LaifI7HT5ghuDaVzcQs2KkCA6MXPo
+ scenes-app-product-analytics-home-overview--populated--dark:
+ hash: v1.k794b7964.39499c1c1f799a89812adf548550d1d61ffd734e4560f815e8a9562d69dee7d7.EapA6_txEwY3tEbK-5ZW-K2AA2duLnBnXPawDNEQWwU
+ scenes-app-product-analytics-home-overview--populated--light:
+ hash: v1.k794b7964.3e2df9e9f57331af7b5bf2eed2f83dba1bc29b71beb6262997f39f156b4edf7d.G8HO3JMMxHq3Ii4V_Nn9tzKPXcYfEObOLeiQ7cwCTFA
scenes-app-project-homepage--no-primary-dashboard--dark:
hash: v1.k794b7964.70707572ec3098ed0c916ac56ec8618ccd95b7b270cffb5a5425d447622912d5.Izwpm_cSdfGfQ1bysk9MbTHFu8B9R1YDo0NDluAAgnA
scenes-app-project-homepage--no-primary-dashboard--light:
@@ -13099,13 +13187,21 @@ snapshots:
scenes-app-saved-insights--error-state--light:
hash: v1.k794b7964.6236e2139e033c4547aa3667b37627916d0d3b2d99cb346e98f2e18ccdd8ad14.huJk5GngTJ7oP9eYDf5S9kUO6OafLC9tKCYuxN-rbfE
scenes-app-saved-insights--home--dark:
- hash: v1.k794b7964.2b163d6fc0eca31aaf36b963ff3c94f5ba264c2615d8a935768f6a2e0305910f.lOpK-cChQflypgIhD2qwUMj_KAb14Qwt_1PN1FL0hfQ
+ hash: v1.k794b7964.4f6cb09aac8b830ed0aa50bfa1b140bde7615871026a5ca1d4f3211e2aa40f3a.XTeHYdm_qcSPcX50vAgwIJnQcor1Rs6mhTsjyhdoLAE
scenes-app-saved-insights--home--light:
- hash: v1.k794b7964.f31e883cdd266cb1579d508ad81b86c5dab5604939b35e652be3ae906d7a8a8b.lTRMsjOK_O9weRfTRn4EsKvfY3upGoUrzQqE_Kf9e4g
+ hash: v1.k794b7964.a95724c4cf917467e053fcd850bcc9dc63f7e603e8c2607863a3e1031bfb448b.VkwBMS5QvfMZtQkklJsVaCxsMCH2FtXhBz-ts7EUEWI
+ scenes-app-saved-insights--home-narrow--dark:
+ hash: v1.k794b7964.1ecb489740ff292c1609afeaee4c92a9b85eb2fa69a6d4319bf261c200ae1b43.lfjeIlUR65cvXSHJZKcaVHNJyPAHlkUMGq5onJOtLTo
+ scenes-app-saved-insights--home-narrow--light:
+ hash: v1.k794b7964.cd6dcf1039471f5017fadadd210d87997a3ee6d1daaf28409de92f88efb7cde5.yLtzV2OVUQtJJG-0gqF238QFCwLHRgxgloCBo0HdBHc
+ scenes-app-saved-insights--home-phone--dark:
+ hash: v1.k794b7964.9317f4e7470bca6402a4baf9b59d7538de03a56afa8f7b09adcab0d350f1ed8b.VQKSURoFdAhZ31HYipB6yFX3Q3DqVzqHXyzVXnImQqA
+ scenes-app-saved-insights--home-phone--light:
+ hash: v1.k794b7964.a1a5cb33b508b105084b5f630cd861a36599093b9f2455af5c4f844167e74e47.tyv_ay9jqi__Y598pn77AJgC22NmnxIUQNS6aJozAgk
scenes-app-saved-insights--home-with-boolean-flag--dark:
- hash: v1.k794b7964.2b163d6fc0eca31aaf36b963ff3c94f5ba264c2615d8a935768f6a2e0305910f.wjW8BKxaKLHlSOZX8j6gvRR67SuOCqaK71TGZIi31TM
+ hash: v1.k794b7964.4f6cb09aac8b830ed0aa50bfa1b140bde7615871026a5ca1d4f3211e2aa40f3a.DGlI8zbpdZ8wOsFzUJK2IR5u8cJP9CeyKlGQagVqBRQ
scenes-app-saved-insights--home-with-boolean-flag--light:
- hash: v1.k794b7964.f31e883cdd266cb1579d508ad81b86c5dab5604939b35e652be3ae906d7a8a8b.1tIVSjGpXH8GdcXmQl4c-KMp-KFJ77ADnIaON9My4U8
+ hash: v1.k794b7964.a95724c4cf917467e053fcd850bcc9dc63f7e603e8c2607863a3e1031bfb448b.jlj0ZBOaomnmubjHsNSO9vMRJxk3JTH43pM6zu_YIdI
scenes-app-saved-insights--list-view--dark:
hash: v1.k794b7964.f20f4295f774b1892a3a9f52f2f4ebbeff75798bbc343b9874e1f6a95d410a4b.U6DhbwV1uNDFfQpUKmQ4F3kpvez3A0iemwOpgsZHo-g
scenes-app-saved-insights--list-view--light:
@@ -13903,13 +13999,13 @@ snapshots:
scenes-app-web-analytics--web-analytics-dashboard-loading--light:
hash: v1.k794b7964.348c15c7348431008d2a1613528ca4568e43e58789788d04e9791e52e414240e.IqKTupL4PWq-BKsMSvreA_xZOFxYgpUu7NR88XeQYoQ
scenes-app-web-analytics--web-analytics-dashboard-narrow--dark:
- hash: v1.k794b7964.250de949b30a7ac7a212be36168381e2cd4f45ed8d5451d636165cf505b101de.a1Z6u5uAtt7PKQgmzXDw3bjOHM06I0rZwBvMDFF2Uqc
+ hash: v1.k794b7964.a453e294b06044d2c1ccc56c1aa2f64812eeec41cc123cbb447f5e3d374f74a3.tyN50cGCbe5FOv1k5HK6SGRtFoSv7v9nZKOIs71Zerc
scenes-app-web-analytics--web-analytics-dashboard-narrow--light:
- hash: v1.k794b7964.9d31020061155395b85003dae42b77a09a84839c2b65e7a1bb6f7e764067e190.zLKSfk0tFj7IATJU0hiNbNGx2_DE5uVPPZZLQLQXqrM
+ hash: v1.k794b7964.1f9f6b563573e04b903f5e14f6bc448badb658061ca85a578ac66352eb469803.SnvTYvRaZi58u7PDmdvIhsHNoC1v_Kn33HVRdng-ZJ8
scenes-app-web-analytics--web-analytics-dashboard-tile-header-v-2-medium--dark:
- hash: v1.k794b7964.ba43e537c83b8046afd7ff4bb61a05c6143a8ae30cb4d0fc5aa10cd0c2bb26b4.k2L76-XagrvTM-zJz1amiVEtXr1D5pdml6v57bP6JRI
+ hash: v1.k794b7964.2402ca73ef88afed0bfa69e7cfe5c2b0b86c869e6940f50f055a3d635b6a53b0.sHxla4Ixs25wKel55_0NADs8O8RUkn9uEOrPiRAHEFQ
scenes-app-web-analytics--web-analytics-dashboard-tile-header-v-2-medium--light:
- hash: v1.k794b7964.e8e3380fad8a375ea6df3522c6375011e9a8c211fb9432432d98a8074219d7c2.Qi7lh9Pa8AmXx_cLU7NKTz83gtFkR2fdqoV3F4PW57c
+ hash: v1.k794b7964.a4f5cd55921ed8d0ba8429b7b7729bee6b2a2ae494b0879523246a3bcda6ba81.4swkdnS0OJC1dTfr_vB7G35uSjCFNNSVS-OamujuZww
scenes-app-web-analytics--web-analytics-dashboard-tile-header-v-2-wide--dark:
hash: v1.k794b7964.dcf4383ad413029603aa0769919ff748fb3b6185dd4f13ed16a5d13b61cac901.cOctP1XQJRmbRU1CN7WSa-3S7k9zddfUczaxhQTVs08
scenes-app-web-analytics--web-analytics-dashboard-tile-header-v-2-wide--light:
diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.ts
index 0980bda1965e..00eac712c2cc 100644
--- a/frontend/src/generated/core/api.schemas.ts
+++ b/frontend/src/generated/core/api.schemas.ts
@@ -672,25 +672,11 @@ export interface PaginatedProjectBackwardCompatBasicListApi {
results: ProjectBackwardCompatBasicApi[]
}
-export type ProjectBackwardCompatApiGroupTypesItem = { [key: string]: unknown }
-
-export type ProjectBackwardCompatApiDefaultModifiers = { [key: string]: unknown }
-
-export type ProjectBackwardCompatApiProductIntentsItem = {
- product_type?: string
- created_at?: string
- /** @nullable */
- onboarding_completed_at?: string | null
- updated_at?: string
-}
-
/**
* Settings for Conversations. Must be a JSON object or null.
* @nullable
*/
-export type ProjectBackwardCompatApiConversationsSettings = { [key: string]: unknown } | null
-
-export type ProjectBackwardCompatApiManagedViewsets = { [key: string]: boolean }
+export type ProjectCreateRequestApiConversationsSettings = { [key: string]: unknown } | null
/**
* * `30d` - 30 Days
@@ -732,154 +718,6 @@ export const BusinessModelEnumApi = {
Other: 'other',
} as const
-/**
- * * `ingest_first_event` - ingest_first_event
- * * `set_up_reverse_proxy` - set_up_reverse_proxy
- * * `create_first_insight` - create_first_insight
- * * `create_first_dashboard` - create_first_dashboard
- * * `track_custom_events` - track_custom_events
- * * `define_actions` - define_actions
- * * `set_up_cohorts` - set_up_cohorts
- * * `explore_trends_insight` - explore_trends_insight
- * * `create_funnel` - create_funnel
- * * `explore_retention_insight` - explore_retention_insight
- * * `explore_paths_insight` - explore_paths_insight
- * * `explore_stickiness_insight` - explore_stickiness_insight
- * * `explore_lifecycle_insight` - explore_lifecycle_insight
- * * `add_authorized_domain` - add_authorized_domain
- * * `set_up_web_vitals` - set_up_web_vitals
- * * `review_web_analytics_dashboard` - review_web_analytics_dashboard
- * * `filter_web_analytics` - filter_web_analytics
- * * `set_up_web_analytics_conversion_goals` - set_up_web_analytics_conversion_goals
- * * `visit_web_vitals_dashboard` - visit_web_vitals_dashboard
- * * `setup_session_recordings` - setup_session_recordings
- * * `watch_session_recording` - watch_session_recording
- * * `configure_recording_settings` - configure_recording_settings
- * * `create_recording_playlist` - create_recording_playlist
- * * `enable_console_logs` - enable_console_logs
- * * `create_feature_flag` - create_feature_flag
- * * `implement_flag_in_code` - implement_flag_in_code
- * * `update_feature_flag_release_conditions` - update_feature_flag_release_conditions
- * * `create_multivariate_flag` - create_multivariate_flag
- * * `set_up_flag_payloads` - set_up_flag_payloads
- * * `set_up_flag_evaluation_runtimes` - set_up_flag_evaluation_runtimes
- * * `create_experiment` - create_experiment
- * * `implement_experiment_variants` - implement_experiment_variants
- * * `launch_experiment` - launch_experiment
- * * `review_experiment_results` - review_experiment_results
- * * `create_survey` - create_survey
- * * `launch_survey` - launch_survey
- * * `collect_survey_responses` - collect_survey_responses
- * * `connect_source` - connect_source
- * * `run_first_query` - run_first_query
- * * `join_external_data` - join_external_data
- * * `create_saved_view` - create_saved_view
- * * `enable_error_tracking` - enable_error_tracking
- * * `upload_source_maps` - upload_source_maps
- * * `view_first_error` - view_first_error
- * * `resolve_first_error` - resolve_first_error
- * * `ingest_first_llm_event` - ingest_first_llm_event
- * * `view_first_trace` - view_first_trace
- * * `track_costs` - track_costs
- * * `set_up_llm_evaluation` - set_up_llm_evaluation
- * * `run_ai_playground` - run_ai_playground
- * * `enable_log_capture` - enable_log_capture
- * * `view_first_logs` - view_first_logs
- * * `create_first_workflow` - create_first_workflow
- * * `set_up_first_workflow_channel` - set_up_first_workflow_channel
- * * `configure_workflow_trigger` - configure_workflow_trigger
- * * `add_workflow_action` - add_workflow_action
- * * `launch_workflow` - launch_workflow
- * * `create_first_endpoint` - create_first_endpoint
- * * `configure_endpoint` - configure_endpoint
- * * `test_endpoint` - test_endpoint
- * * `create_early_access_feature` - create_early_access_feature
- * * `update_feature_stage` - update_feature_stage
- * * `use_posthog_ai` - use_posthog_ai
- * * `use_posthog_code` - use_posthog_code
- * * `use_posthog_mcp` - use_posthog_mcp
- * * `use_posthog_in_slack` - use_posthog_in_slack
- */
-export type AvailableSetupTaskIdsEnumApi =
- (typeof AvailableSetupTaskIdsEnumApi)[keyof typeof AvailableSetupTaskIdsEnumApi]
-
-export const AvailableSetupTaskIdsEnumApi = {
- IngestFirstEvent: 'ingest_first_event',
- SetUpReverseProxy: 'set_up_reverse_proxy',
- CreateFirstInsight: 'create_first_insight',
- CreateFirstDashboard: 'create_first_dashboard',
- TrackCustomEvents: 'track_custom_events',
- DefineActions: 'define_actions',
- SetUpCohorts: 'set_up_cohorts',
- ExploreTrendsInsight: 'explore_trends_insight',
- CreateFunnel: 'create_funnel',
- ExploreRetentionInsight: 'explore_retention_insight',
- ExplorePathsInsight: 'explore_paths_insight',
- ExploreStickinessInsight: 'explore_stickiness_insight',
- ExploreLifecycleInsight: 'explore_lifecycle_insight',
- AddAuthorizedDomain: 'add_authorized_domain',
- SetUpWebVitals: 'set_up_web_vitals',
- ReviewWebAnalyticsDashboard: 'review_web_analytics_dashboard',
- FilterWebAnalytics: 'filter_web_analytics',
- SetUpWebAnalyticsConversionGoals: 'set_up_web_analytics_conversion_goals',
- VisitWebVitalsDashboard: 'visit_web_vitals_dashboard',
- SetupSessionRecordings: 'setup_session_recordings',
- WatchSessionRecording: 'watch_session_recording',
- ConfigureRecordingSettings: 'configure_recording_settings',
- CreateRecordingPlaylist: 'create_recording_playlist',
- EnableConsoleLogs: 'enable_console_logs',
- CreateFeatureFlag: 'create_feature_flag',
- ImplementFlagInCode: 'implement_flag_in_code',
- UpdateFeatureFlagReleaseConditions: 'update_feature_flag_release_conditions',
- CreateMultivariateFlag: 'create_multivariate_flag',
- SetUpFlagPayloads: 'set_up_flag_payloads',
- SetUpFlagEvaluationRuntimes: 'set_up_flag_evaluation_runtimes',
- CreateExperiment: 'create_experiment',
- ImplementExperimentVariants: 'implement_experiment_variants',
- LaunchExperiment: 'launch_experiment',
- ReviewExperimentResults: 'review_experiment_results',
- CreateSurvey: 'create_survey',
- LaunchSurvey: 'launch_survey',
- CollectSurveyResponses: 'collect_survey_responses',
- ConnectSource: 'connect_source',
- RunFirstQuery: 'run_first_query',
- JoinExternalData: 'join_external_data',
- CreateSavedView: 'create_saved_view',
- EnableErrorTracking: 'enable_error_tracking',
- UploadSourceMaps: 'upload_source_maps',
- ViewFirstError: 'view_first_error',
- ResolveFirstError: 'resolve_first_error',
- IngestFirstLlmEvent: 'ingest_first_llm_event',
- ViewFirstTrace: 'view_first_trace',
- TrackCosts: 'track_costs',
- SetUpLlmEvaluation: 'set_up_llm_evaluation',
- RunAiPlayground: 'run_ai_playground',
- EnableLogCapture: 'enable_log_capture',
- ViewFirstLogs: 'view_first_logs',
- CreateFirstWorkflow: 'create_first_workflow',
- SetUpFirstWorkflowChannel: 'set_up_first_workflow_channel',
- ConfigureWorkflowTrigger: 'configure_workflow_trigger',
- AddWorkflowAction: 'add_workflow_action',
- LaunchWorkflow: 'launch_workflow',
- CreateFirstEndpoint: 'create_first_endpoint',
- ConfigureEndpoint: 'configure_endpoint',
- TestEndpoint: 'test_endpoint',
- CreateEarlyAccessFeature: 'create_early_access_feature',
- UpdateFeatureStage: 'update_feature_stage',
- UsePosthogAi: 'use_posthog_ai',
- UsePosthogCode: 'use_posthog_code',
- UsePosthogMcp: 'use_posthog_mcp',
- UsePosthogInSlack: 'use_posthog_in_slack',
-} as const
-
-export type FlagEvaluationsModeEnumApi = (typeof FlagEvaluationsModeEnumApi)[keyof typeof FlagEvaluationsModeEnumApi]
-
-export const FlagEvaluationsModeEnumApi = {
- Number0: 0,
- Number1: 1,
- Number2: 2,
-} as const
-
/**
* * `AED` - AED
* * `AFN` - AFN
@@ -1924,9 +1762,7 @@ export const CookielessServerHashModeEnumApi = {
* This shape is a superset of TeamSerializer's, so a request rewritten from /api/environments/
* onto /api/projects/ never loses a field.
*/
-export interface ProjectBackwardCompatApi {
- readonly id: number
- readonly organization: string
+export interface ProjectCreateRequestApi {
/**
* Project name. Must be unique within the organization (case-insensitive). If omitted on creation, a unique default name is generated.
* @minLength 1
@@ -1944,22 +1780,11 @@ export interface ProjectBackwardCompatApi {
* @items.maxLength 255
*/
tags?: string[]
- readonly created_at: string
- readonly effective_membership_level: OrganizationMembershipLevelEnumApi
- readonly has_group_types: boolean
- readonly group_types: readonly ProjectBackwardCompatApiGroupTypesItem[]
- /** @nullable */
- readonly live_events_token: string | null
- /** @nullable */
- readonly updated_at: string | null
- readonly uuid: string
- readonly api_token: string
/** @items.maxLength 200 */
app_urls?: (string | null)[]
/** When true, PostHog drops the IP address from every ingested event. */
anonymize_ips?: boolean
completed_snippet_onboarding?: boolean
- readonly ingested_event: boolean
/** Filter groups that identify internal/test traffic to be excluded from insights. */
test_account_filters?: unknown
/**
@@ -2664,12 +2489,10 @@ export interface ProjectBackwardCompatApi {
* @items.maxLength 200
*/
recording_domains?: (string | null)[] | null
- readonly person_on_events_querying_enabled: boolean
/** @nullable */
inject_web_apps?: boolean | null
extra_settings?: unknown
modifiers?: unknown
- readonly default_modifiers: ProjectBackwardCompatApiDefaultModifiers
has_completed_onboarding_for?: unknown
/**
* Enables displaying surveys via posthog-js on allowed origins.
@@ -2681,22 +2504,12 @@ export interface ProjectBackwardCompatApi {
* @nullable
*/
heatmaps_opt_in?: boolean | null
- readonly product_intents: readonly ProjectBackwardCompatApiProductIntentsItem[]
/**
* Default value for the `persist` option on newly created feature flags.
* @nullable
*/
flags_persistence_default?: boolean | null
/** @nullable */
- readonly secret_api_token: string | null
- /** @nullable */
- readonly secret_api_token_backup: string | null
- /**
- * Value this project's heatmap screenshots send as a cookie scoped to your domain, so bot protection can allow them. Only project admins can read it; null for everyone else and when none has been generated.
- * @nullable
- */
- readonly heatmaps_screenshot_secret: string | null
- /** @nullable */
receive_org_level_activity_logs?: boolean | null
/** Whether this project serves B2B or B2C customers. Used to optimize default UI layouts.
*
@@ -2713,31 +2526,10 @@ export interface ProjectBackwardCompatApi {
* Settings for Conversations. Must be a JSON object or null.
* @nullable
*/
- conversations_settings?: ProjectBackwardCompatApiConversationsSettings
+ conversations_settings?: ProjectCreateRequestApiConversationsSettings
logs_settings?: unknown
/** @nullable */
proactive_tasks_enabled?: boolean | null
- readonly available_setup_task_ids: readonly AvailableSetupTaskIdsEnumApi[]
- /**
- * Set to True when project deletion has been initiated. Blocks UI access to this project until the async task completes.
- * @nullable
- */
- readonly is_pending_deletion: boolean | null
- /**
- * When the scheduled project deletion will run.
- * @nullable
- */
- readonly deletion_scheduled_at: string | null
- /** ID of the project this environment belongs to. */
- readonly project_id: number
- /**
- * The effective access level the user has for this object
- * @nullable
- */
- readonly user_access_level: string | null
- readonly managed_viewsets: ProjectBackwardCompatApiManagedViewsets
- /** Which table this project's feature flag usage data is read from. PostHog sets it for the whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table. */
- readonly flag_evaluations_mode: FlagEvaluationsModeEnumApi
revenue_analytics_config?: TeamRevenueAnalyticsConfigApi
marketing_analytics_config?: TeamMarketingAnalyticsConfigApi
customer_analytics_config?: TeamCustomerAnalyticsConfigApi
@@ -2777,11 +2569,11 @@ export interface ProjectBackwardCompatApi {
web_analytics_pre_aggregated_tables_enabled?: boolean | null
}
-export type PatchedProjectBackwardCompatApiGroupTypesItem = { [key: string]: unknown }
+export type ProjectBackwardCompatApiGroupTypesItem = { [key: string]: unknown }
-export type PatchedProjectBackwardCompatApiDefaultModifiers = { [key: string]: unknown }
+export type ProjectBackwardCompatApiDefaultModifiers = { [key: string]: unknown }
-export type PatchedProjectBackwardCompatApiProductIntentsItem = {
+export type ProjectBackwardCompatApiProductIntentsItem = {
product_type?: string
created_at?: string
/** @nullable */
@@ -2793,46 +2585,1078 @@ export type PatchedProjectBackwardCompatApiProductIntentsItem = {
* Settings for Conversations. Must be a JSON object or null.
* @nullable
*/
-export type PatchedProjectBackwardCompatApiConversationsSettings = { [key: string]: unknown } | null
+export type ProjectBackwardCompatApiConversationsSettings = { [key: string]: unknown } | null
-export type PatchedProjectBackwardCompatApiManagedViewsets = { [key: string]: boolean }
+export type ProjectBackwardCompatApiManagedViewsets = { [key: string]: boolean }
/**
- * A project and its settings, including the settings that live on its passthrough Team.
- *
- * This shape is a superset of TeamSerializer's, so a request rewritten from /api/environments/
- * onto /api/projects/ never loses a field.
- */
-export interface PatchedProjectBackwardCompatApi {
- readonly id?: number
- readonly organization?: string
- /**
- * Project name. Must be unique within the organization (case-insensitive). If omitted on creation, a unique default name is generated.
- * @minLength 1
- * @maxLength 200
- */
- name?: string
- /**
- * Short description of what the project is about. This is helpful to give our AI agents context about your project.
- * @maxLength 1000
- * @nullable
- */
- product_description?: string | null
- /**
- * Labels applied to this project. Names are trimmed and lowercased, and sending this field replaces the project's existing tags.
- * @items.maxLength 255
- */
- tags?: string[]
- readonly created_at?: string
- readonly effective_membership_level?: OrganizationMembershipLevelEnumApi
- readonly has_group_types?: boolean
- readonly group_types?: readonly PatchedProjectBackwardCompatApiGroupTypesItem[]
- /** @nullable */
- readonly live_events_token?: string | null
- /** @nullable */
- readonly updated_at?: string | null
- readonly uuid?: string
- readonly api_token?: string
+ * * `ingest_first_event` - ingest_first_event
+ * * `set_up_reverse_proxy` - set_up_reverse_proxy
+ * * `create_first_insight` - create_first_insight
+ * * `create_first_dashboard` - create_first_dashboard
+ * * `track_custom_events` - track_custom_events
+ * * `define_actions` - define_actions
+ * * `set_up_cohorts` - set_up_cohorts
+ * * `explore_trends_insight` - explore_trends_insight
+ * * `create_funnel` - create_funnel
+ * * `explore_retention_insight` - explore_retention_insight
+ * * `explore_paths_insight` - explore_paths_insight
+ * * `explore_stickiness_insight` - explore_stickiness_insight
+ * * `explore_lifecycle_insight` - explore_lifecycle_insight
+ * * `add_authorized_domain` - add_authorized_domain
+ * * `set_up_web_vitals` - set_up_web_vitals
+ * * `review_web_analytics_dashboard` - review_web_analytics_dashboard
+ * * `filter_web_analytics` - filter_web_analytics
+ * * `set_up_web_analytics_conversion_goals` - set_up_web_analytics_conversion_goals
+ * * `visit_web_vitals_dashboard` - visit_web_vitals_dashboard
+ * * `setup_session_recordings` - setup_session_recordings
+ * * `watch_session_recording` - watch_session_recording
+ * * `configure_recording_settings` - configure_recording_settings
+ * * `create_recording_playlist` - create_recording_playlist
+ * * `enable_console_logs` - enable_console_logs
+ * * `create_feature_flag` - create_feature_flag
+ * * `implement_flag_in_code` - implement_flag_in_code
+ * * `update_feature_flag_release_conditions` - update_feature_flag_release_conditions
+ * * `create_multivariate_flag` - create_multivariate_flag
+ * * `set_up_flag_payloads` - set_up_flag_payloads
+ * * `set_up_flag_evaluation_runtimes` - set_up_flag_evaluation_runtimes
+ * * `create_experiment` - create_experiment
+ * * `implement_experiment_variants` - implement_experiment_variants
+ * * `launch_experiment` - launch_experiment
+ * * `review_experiment_results` - review_experiment_results
+ * * `create_survey` - create_survey
+ * * `launch_survey` - launch_survey
+ * * `collect_survey_responses` - collect_survey_responses
+ * * `connect_source` - connect_source
+ * * `run_first_query` - run_first_query
+ * * `join_external_data` - join_external_data
+ * * `create_saved_view` - create_saved_view
+ * * `enable_error_tracking` - enable_error_tracking
+ * * `upload_source_maps` - upload_source_maps
+ * * `view_first_error` - view_first_error
+ * * `resolve_first_error` - resolve_first_error
+ * * `ingest_first_llm_event` - ingest_first_llm_event
+ * * `view_first_trace` - view_first_trace
+ * * `track_costs` - track_costs
+ * * `set_up_llm_evaluation` - set_up_llm_evaluation
+ * * `run_ai_playground` - run_ai_playground
+ * * `enable_log_capture` - enable_log_capture
+ * * `view_first_logs` - view_first_logs
+ * * `create_first_workflow` - create_first_workflow
+ * * `set_up_first_workflow_channel` - set_up_first_workflow_channel
+ * * `configure_workflow_trigger` - configure_workflow_trigger
+ * * `add_workflow_action` - add_workflow_action
+ * * `launch_workflow` - launch_workflow
+ * * `create_first_endpoint` - create_first_endpoint
+ * * `configure_endpoint` - configure_endpoint
+ * * `test_endpoint` - test_endpoint
+ * * `create_early_access_feature` - create_early_access_feature
+ * * `update_feature_stage` - update_feature_stage
+ * * `use_posthog_ai` - use_posthog_ai
+ * * `use_posthog_code` - use_posthog_code
+ * * `use_posthog_mcp` - use_posthog_mcp
+ * * `use_posthog_in_slack` - use_posthog_in_slack
+ */
+export type AvailableSetupTaskIdsEnumApi =
+ (typeof AvailableSetupTaskIdsEnumApi)[keyof typeof AvailableSetupTaskIdsEnumApi]
+
+export const AvailableSetupTaskIdsEnumApi = {
+ IngestFirstEvent: 'ingest_first_event',
+ SetUpReverseProxy: 'set_up_reverse_proxy',
+ CreateFirstInsight: 'create_first_insight',
+ CreateFirstDashboard: 'create_first_dashboard',
+ TrackCustomEvents: 'track_custom_events',
+ DefineActions: 'define_actions',
+ SetUpCohorts: 'set_up_cohorts',
+ ExploreTrendsInsight: 'explore_trends_insight',
+ CreateFunnel: 'create_funnel',
+ ExploreRetentionInsight: 'explore_retention_insight',
+ ExplorePathsInsight: 'explore_paths_insight',
+ ExploreStickinessInsight: 'explore_stickiness_insight',
+ ExploreLifecycleInsight: 'explore_lifecycle_insight',
+ AddAuthorizedDomain: 'add_authorized_domain',
+ SetUpWebVitals: 'set_up_web_vitals',
+ ReviewWebAnalyticsDashboard: 'review_web_analytics_dashboard',
+ FilterWebAnalytics: 'filter_web_analytics',
+ SetUpWebAnalyticsConversionGoals: 'set_up_web_analytics_conversion_goals',
+ VisitWebVitalsDashboard: 'visit_web_vitals_dashboard',
+ SetupSessionRecordings: 'setup_session_recordings',
+ WatchSessionRecording: 'watch_session_recording',
+ ConfigureRecordingSettings: 'configure_recording_settings',
+ CreateRecordingPlaylist: 'create_recording_playlist',
+ EnableConsoleLogs: 'enable_console_logs',
+ CreateFeatureFlag: 'create_feature_flag',
+ ImplementFlagInCode: 'implement_flag_in_code',
+ UpdateFeatureFlagReleaseConditions: 'update_feature_flag_release_conditions',
+ CreateMultivariateFlag: 'create_multivariate_flag',
+ SetUpFlagPayloads: 'set_up_flag_payloads',
+ SetUpFlagEvaluationRuntimes: 'set_up_flag_evaluation_runtimes',
+ CreateExperiment: 'create_experiment',
+ ImplementExperimentVariants: 'implement_experiment_variants',
+ LaunchExperiment: 'launch_experiment',
+ ReviewExperimentResults: 'review_experiment_results',
+ CreateSurvey: 'create_survey',
+ LaunchSurvey: 'launch_survey',
+ CollectSurveyResponses: 'collect_survey_responses',
+ ConnectSource: 'connect_source',
+ RunFirstQuery: 'run_first_query',
+ JoinExternalData: 'join_external_data',
+ CreateSavedView: 'create_saved_view',
+ EnableErrorTracking: 'enable_error_tracking',
+ UploadSourceMaps: 'upload_source_maps',
+ ViewFirstError: 'view_first_error',
+ ResolveFirstError: 'resolve_first_error',
+ IngestFirstLlmEvent: 'ingest_first_llm_event',
+ ViewFirstTrace: 'view_first_trace',
+ TrackCosts: 'track_costs',
+ SetUpLlmEvaluation: 'set_up_llm_evaluation',
+ RunAiPlayground: 'run_ai_playground',
+ EnableLogCapture: 'enable_log_capture',
+ ViewFirstLogs: 'view_first_logs',
+ CreateFirstWorkflow: 'create_first_workflow',
+ SetUpFirstWorkflowChannel: 'set_up_first_workflow_channel',
+ ConfigureWorkflowTrigger: 'configure_workflow_trigger',
+ AddWorkflowAction: 'add_workflow_action',
+ LaunchWorkflow: 'launch_workflow',
+ CreateFirstEndpoint: 'create_first_endpoint',
+ ConfigureEndpoint: 'configure_endpoint',
+ TestEndpoint: 'test_endpoint',
+ CreateEarlyAccessFeature: 'create_early_access_feature',
+ UpdateFeatureStage: 'update_feature_stage',
+ UsePosthogAi: 'use_posthog_ai',
+ UsePosthogCode: 'use_posthog_code',
+ UsePosthogMcp: 'use_posthog_mcp',
+ UsePosthogInSlack: 'use_posthog_in_slack',
+} as const
+
+export type FlagEvaluationsModeEnumApi = (typeof FlagEvaluationsModeEnumApi)[keyof typeof FlagEvaluationsModeEnumApi]
+
+export const FlagEvaluationsModeEnumApi = {
+ Number0: 0,
+ Number1: 1,
+ Number2: 2,
+} as const
+
+/**
+ * A project and its settings, including the settings that live on its passthrough Team.
+ *
+ * This shape is a superset of TeamSerializer's, so a request rewritten from /api/environments/
+ * onto /api/projects/ never loses a field.
+ */
+export interface ProjectBackwardCompatApi {
+ readonly id: number
+ readonly organization: string
+ /**
+ * Project name. Must be unique within the organization (case-insensitive). If omitted on creation, a unique default name is generated.
+ * @minLength 1
+ * @maxLength 200
+ */
+ name?: string
+ /**
+ * Short description of what the project is about. This is helpful to give our AI agents context about your project.
+ * @maxLength 1000
+ * @nullable
+ */
+ product_description?: string | null
+ /**
+ * Labels applied to this project. Names are trimmed and lowercased, and sending this field replaces the project's existing tags.
+ * @items.maxLength 255
+ */
+ tags?: string[]
+ readonly created_at: string
+ readonly effective_membership_level: OrganizationMembershipLevelEnumApi
+ readonly has_group_types: boolean
+ readonly group_types: readonly ProjectBackwardCompatApiGroupTypesItem[]
+ /** @nullable */
+ readonly live_events_token: string | null
+ /** @nullable */
+ readonly updated_at: string | null
+ readonly uuid: string
+ readonly api_token: string
+ /** @items.maxLength 200 */
+ app_urls?: (string | null)[]
+ /** When true, PostHog drops the IP address from every ingested event. */
+ anonymize_ips?: boolean
+ completed_snippet_onboarding?: boolean
+ readonly ingested_event: boolean
+ /** Filter groups that identify internal/test traffic to be excluded from insights. */
+ test_account_filters?: unknown
+ /**
+ * When true, new insights default to excluding internal/test users.
+ * @nullable
+ */
+ test_account_filters_default_checked?: boolean | null
+ /** Regex rewrite rules that collapse dynamic path segments (e.g. user IDs) before displaying URLs in paths. */
+ path_cleaning_filters?: unknown
+ is_demo?: boolean
+ /** IANA timezone used for date-based filters and reporting (e.g. `America/Los_Angeles`).
+ *
+ * * `Africa/Abidjan` - Africa/Abidjan
+ * * `Africa/Accra` - Africa/Accra
+ * * `Africa/Addis_Ababa` - Africa/Addis_Ababa
+ * * `Africa/Algiers` - Africa/Algiers
+ * * `Africa/Asmara` - Africa/Asmara
+ * * `Africa/Asmera` - Africa/Asmera
+ * * `Africa/Bamako` - Africa/Bamako
+ * * `Africa/Bangui` - Africa/Bangui
+ * * `Africa/Banjul` - Africa/Banjul
+ * * `Africa/Bissau` - Africa/Bissau
+ * * `Africa/Blantyre` - Africa/Blantyre
+ * * `Africa/Brazzaville` - Africa/Brazzaville
+ * * `Africa/Bujumbura` - Africa/Bujumbura
+ * * `Africa/Cairo` - Africa/Cairo
+ * * `Africa/Casablanca` - Africa/Casablanca
+ * * `Africa/Ceuta` - Africa/Ceuta
+ * * `Africa/Conakry` - Africa/Conakry
+ * * `Africa/Dakar` - Africa/Dakar
+ * * `Africa/Dar_es_Salaam` - Africa/Dar_es_Salaam
+ * * `Africa/Djibouti` - Africa/Djibouti
+ * * `Africa/Douala` - Africa/Douala
+ * * `Africa/El_Aaiun` - Africa/El_Aaiun
+ * * `Africa/Freetown` - Africa/Freetown
+ * * `Africa/Gaborone` - Africa/Gaborone
+ * * `Africa/Harare` - Africa/Harare
+ * * `Africa/Johannesburg` - Africa/Johannesburg
+ * * `Africa/Juba` - Africa/Juba
+ * * `Africa/Kampala` - Africa/Kampala
+ * * `Africa/Khartoum` - Africa/Khartoum
+ * * `Africa/Kigali` - Africa/Kigali
+ * * `Africa/Kinshasa` - Africa/Kinshasa
+ * * `Africa/Lagos` - Africa/Lagos
+ * * `Africa/Libreville` - Africa/Libreville
+ * * `Africa/Lome` - Africa/Lome
+ * * `Africa/Luanda` - Africa/Luanda
+ * * `Africa/Lubumbashi` - Africa/Lubumbashi
+ * * `Africa/Lusaka` - Africa/Lusaka
+ * * `Africa/Malabo` - Africa/Malabo
+ * * `Africa/Maputo` - Africa/Maputo
+ * * `Africa/Maseru` - Africa/Maseru
+ * * `Africa/Mbabane` - Africa/Mbabane
+ * * `Africa/Mogadishu` - Africa/Mogadishu
+ * * `Africa/Monrovia` - Africa/Monrovia
+ * * `Africa/Nairobi` - Africa/Nairobi
+ * * `Africa/Ndjamena` - Africa/Ndjamena
+ * * `Africa/Niamey` - Africa/Niamey
+ * * `Africa/Nouakchott` - Africa/Nouakchott
+ * * `Africa/Ouagadougou` - Africa/Ouagadougou
+ * * `Africa/Porto-Novo` - Africa/Porto-Novo
+ * * `Africa/Sao_Tome` - Africa/Sao_Tome
+ * * `Africa/Timbuktu` - Africa/Timbuktu
+ * * `Africa/Tripoli` - Africa/Tripoli
+ * * `Africa/Tunis` - Africa/Tunis
+ * * `Africa/Windhoek` - Africa/Windhoek
+ * * `America/Adak` - America/Adak
+ * * `America/Anchorage` - America/Anchorage
+ * * `America/Anguilla` - America/Anguilla
+ * * `America/Antigua` - America/Antigua
+ * * `America/Araguaina` - America/Araguaina
+ * * `America/Argentina/Buenos_Aires` - America/Argentina/Buenos_Aires
+ * * `America/Argentina/Catamarca` - America/Argentina/Catamarca
+ * * `America/Argentina/ComodRivadavia` - America/Argentina/ComodRivadavia
+ * * `America/Argentina/Cordoba` - America/Argentina/Cordoba
+ * * `America/Argentina/Jujuy` - America/Argentina/Jujuy
+ * * `America/Argentina/La_Rioja` - America/Argentina/La_Rioja
+ * * `America/Argentina/Mendoza` - America/Argentina/Mendoza
+ * * `America/Argentina/Rio_Gallegos` - America/Argentina/Rio_Gallegos
+ * * `America/Argentina/Salta` - America/Argentina/Salta
+ * * `America/Argentina/San_Juan` - America/Argentina/San_Juan
+ * * `America/Argentina/San_Luis` - America/Argentina/San_Luis
+ * * `America/Argentina/Tucuman` - America/Argentina/Tucuman
+ * * `America/Argentina/Ushuaia` - America/Argentina/Ushuaia
+ * * `America/Aruba` - America/Aruba
+ * * `America/Asuncion` - America/Asuncion
+ * * `America/Atikokan` - America/Atikokan
+ * * `America/Atka` - America/Atka
+ * * `America/Bahia` - America/Bahia
+ * * `America/Bahia_Banderas` - America/Bahia_Banderas
+ * * `America/Barbados` - America/Barbados
+ * * `America/Belem` - America/Belem
+ * * `America/Belize` - America/Belize
+ * * `America/Blanc-Sablon` - America/Blanc-Sablon
+ * * `America/Boa_Vista` - America/Boa_Vista
+ * * `America/Bogota` - America/Bogota
+ * * `America/Boise` - America/Boise
+ * * `America/Buenos_Aires` - America/Buenos_Aires
+ * * `America/Cambridge_Bay` - America/Cambridge_Bay
+ * * `America/Campo_Grande` - America/Campo_Grande
+ * * `America/Cancun` - America/Cancun
+ * * `America/Caracas` - America/Caracas
+ * * `America/Catamarca` - America/Catamarca
+ * * `America/Cayenne` - America/Cayenne
+ * * `America/Cayman` - America/Cayman
+ * * `America/Chicago` - America/Chicago
+ * * `America/Chihuahua` - America/Chihuahua
+ * * `America/Ciudad_Juarez` - America/Ciudad_Juarez
+ * * `America/Coral_Harbour` - America/Coral_Harbour
+ * * `America/Cordoba` - America/Cordoba
+ * * `America/Costa_Rica` - America/Costa_Rica
+ * * `America/Creston` - America/Creston
+ * * `America/Cuiaba` - America/Cuiaba
+ * * `America/Curacao` - America/Curacao
+ * * `America/Danmarkshavn` - America/Danmarkshavn
+ * * `America/Dawson` - America/Dawson
+ * * `America/Dawson_Creek` - America/Dawson_Creek
+ * * `America/Denver` - America/Denver
+ * * `America/Detroit` - America/Detroit
+ * * `America/Dominica` - America/Dominica
+ * * `America/Edmonton` - America/Edmonton
+ * * `America/Eirunepe` - America/Eirunepe
+ * * `America/El_Salvador` - America/El_Salvador
+ * * `America/Ensenada` - America/Ensenada
+ * * `America/Fort_Nelson` - America/Fort_Nelson
+ * * `America/Fort_Wayne` - America/Fort_Wayne
+ * * `America/Fortaleza` - America/Fortaleza
+ * * `America/Glace_Bay` - America/Glace_Bay
+ * * `America/Godthab` - America/Godthab
+ * * `America/Goose_Bay` - America/Goose_Bay
+ * * `America/Grand_Turk` - America/Grand_Turk
+ * * `America/Grenada` - America/Grenada
+ * * `America/Guadeloupe` - America/Guadeloupe
+ * * `America/Guatemala` - America/Guatemala
+ * * `America/Guayaquil` - America/Guayaquil
+ * * `America/Guyana` - America/Guyana
+ * * `America/Halifax` - America/Halifax
+ * * `America/Havana` - America/Havana
+ * * `America/Hermosillo` - America/Hermosillo
+ * * `America/Indiana/Indianapolis` - America/Indiana/Indianapolis
+ * * `America/Indiana/Knox` - America/Indiana/Knox
+ * * `America/Indiana/Marengo` - America/Indiana/Marengo
+ * * `America/Indiana/Petersburg` - America/Indiana/Petersburg
+ * * `America/Indiana/Tell_City` - America/Indiana/Tell_City
+ * * `America/Indiana/Vevay` - America/Indiana/Vevay
+ * * `America/Indiana/Vincennes` - America/Indiana/Vincennes
+ * * `America/Indiana/Winamac` - America/Indiana/Winamac
+ * * `America/Indianapolis` - America/Indianapolis
+ * * `America/Inuvik` - America/Inuvik
+ * * `America/Iqaluit` - America/Iqaluit
+ * * `America/Jamaica` - America/Jamaica
+ * * `America/Jujuy` - America/Jujuy
+ * * `America/Juneau` - America/Juneau
+ * * `America/Kentucky/Louisville` - America/Kentucky/Louisville
+ * * `America/Kentucky/Monticello` - America/Kentucky/Monticello
+ * * `America/Knox_IN` - America/Knox_IN
+ * * `America/Kralendijk` - America/Kralendijk
+ * * `America/La_Paz` - America/La_Paz
+ * * `America/Lima` - America/Lima
+ * * `America/Los_Angeles` - America/Los_Angeles
+ * * `America/Louisville` - America/Louisville
+ * * `America/Lower_Princes` - America/Lower_Princes
+ * * `America/Maceio` - America/Maceio
+ * * `America/Managua` - America/Managua
+ * * `America/Manaus` - America/Manaus
+ * * `America/Marigot` - America/Marigot
+ * * `America/Martinique` - America/Martinique
+ * * `America/Matamoros` - America/Matamoros
+ * * `America/Mazatlan` - America/Mazatlan
+ * * `America/Mendoza` - America/Mendoza
+ * * `America/Menominee` - America/Menominee
+ * * `America/Merida` - America/Merida
+ * * `America/Metlakatla` - America/Metlakatla
+ * * `America/Mexico_City` - America/Mexico_City
+ * * `America/Miquelon` - America/Miquelon
+ * * `America/Moncton` - America/Moncton
+ * * `America/Monterrey` - America/Monterrey
+ * * `America/Montevideo` - America/Montevideo
+ * * `America/Montreal` - America/Montreal
+ * * `America/Montserrat` - America/Montserrat
+ * * `America/Nassau` - America/Nassau
+ * * `America/New_York` - America/New_York
+ * * `America/Nipigon` - America/Nipigon
+ * * `America/Nome` - America/Nome
+ * * `America/Noronha` - America/Noronha
+ * * `America/North_Dakota/Beulah` - America/North_Dakota/Beulah
+ * * `America/North_Dakota/Center` - America/North_Dakota/Center
+ * * `America/North_Dakota/New_Salem` - America/North_Dakota/New_Salem
+ * * `America/Nuuk` - America/Nuuk
+ * * `America/Ojinaga` - America/Ojinaga
+ * * `America/Panama` - America/Panama
+ * * `America/Pangnirtung` - America/Pangnirtung
+ * * `America/Paramaribo` - America/Paramaribo
+ * * `America/Phoenix` - America/Phoenix
+ * * `America/Port-au-Prince` - America/Port-au-Prince
+ * * `America/Port_of_Spain` - America/Port_of_Spain
+ * * `America/Porto_Acre` - America/Porto_Acre
+ * * `America/Porto_Velho` - America/Porto_Velho
+ * * `America/Puerto_Rico` - America/Puerto_Rico
+ * * `America/Punta_Arenas` - America/Punta_Arenas
+ * * `America/Rainy_River` - America/Rainy_River
+ * * `America/Rankin_Inlet` - America/Rankin_Inlet
+ * * `America/Recife` - America/Recife
+ * * `America/Regina` - America/Regina
+ * * `America/Resolute` - America/Resolute
+ * * `America/Rio_Branco` - America/Rio_Branco
+ * * `America/Rosario` - America/Rosario
+ * * `America/Santa_Isabel` - America/Santa_Isabel
+ * * `America/Santarem` - America/Santarem
+ * * `America/Santiago` - America/Santiago
+ * * `America/Santo_Domingo` - America/Santo_Domingo
+ * * `America/Sao_Paulo` - America/Sao_Paulo
+ * * `America/Scoresbysund` - America/Scoresbysund
+ * * `America/Shiprock` - America/Shiprock
+ * * `America/Sitka` - America/Sitka
+ * * `America/St_Barthelemy` - America/St_Barthelemy
+ * * `America/St_Johns` - America/St_Johns
+ * * `America/St_Kitts` - America/St_Kitts
+ * * `America/St_Lucia` - America/St_Lucia
+ * * `America/St_Thomas` - America/St_Thomas
+ * * `America/St_Vincent` - America/St_Vincent
+ * * `America/Swift_Current` - America/Swift_Current
+ * * `America/Tegucigalpa` - America/Tegucigalpa
+ * * `America/Thule` - America/Thule
+ * * `America/Thunder_Bay` - America/Thunder_Bay
+ * * `America/Tijuana` - America/Tijuana
+ * * `America/Toronto` - America/Toronto
+ * * `America/Tortola` - America/Tortola
+ * * `America/Vancouver` - America/Vancouver
+ * * `America/Virgin` - America/Virgin
+ * * `America/Whitehorse` - America/Whitehorse
+ * * `America/Winnipeg` - America/Winnipeg
+ * * `America/Yakutat` - America/Yakutat
+ * * `America/Yellowknife` - America/Yellowknife
+ * * `Antarctica/Casey` - Antarctica/Casey
+ * * `Antarctica/Davis` - Antarctica/Davis
+ * * `Antarctica/DumontDUrville` - Antarctica/DumontDUrville
+ * * `Antarctica/Macquarie` - Antarctica/Macquarie
+ * * `Antarctica/Mawson` - Antarctica/Mawson
+ * * `Antarctica/McMurdo` - Antarctica/McMurdo
+ * * `Antarctica/Palmer` - Antarctica/Palmer
+ * * `Antarctica/Rothera` - Antarctica/Rothera
+ * * `Antarctica/South_Pole` - Antarctica/South_Pole
+ * * `Antarctica/Syowa` - Antarctica/Syowa
+ * * `Antarctica/Troll` - Antarctica/Troll
+ * * `Antarctica/Vostok` - Antarctica/Vostok
+ * * `Arctic/Longyearbyen` - Arctic/Longyearbyen
+ * * `Asia/Aden` - Asia/Aden
+ * * `Asia/Almaty` - Asia/Almaty
+ * * `Asia/Amman` - Asia/Amman
+ * * `Asia/Anadyr` - Asia/Anadyr
+ * * `Asia/Aqtau` - Asia/Aqtau
+ * * `Asia/Aqtobe` - Asia/Aqtobe
+ * * `Asia/Ashgabat` - Asia/Ashgabat
+ * * `Asia/Ashkhabad` - Asia/Ashkhabad
+ * * `Asia/Atyrau` - Asia/Atyrau
+ * * `Asia/Baghdad` - Asia/Baghdad
+ * * `Asia/Bahrain` - Asia/Bahrain
+ * * `Asia/Baku` - Asia/Baku
+ * * `Asia/Bangkok` - Asia/Bangkok
+ * * `Asia/Barnaul` - Asia/Barnaul
+ * * `Asia/Beirut` - Asia/Beirut
+ * * `Asia/Bishkek` - Asia/Bishkek
+ * * `Asia/Brunei` - Asia/Brunei
+ * * `Asia/Calcutta` - Asia/Calcutta
+ * * `Asia/Chita` - Asia/Chita
+ * * `Asia/Choibalsan` - Asia/Choibalsan
+ * * `Asia/Chongqing` - Asia/Chongqing
+ * * `Asia/Chungking` - Asia/Chungking
+ * * `Asia/Colombo` - Asia/Colombo
+ * * `Asia/Dacca` - Asia/Dacca
+ * * `Asia/Damascus` - Asia/Damascus
+ * * `Asia/Dhaka` - Asia/Dhaka
+ * * `Asia/Dili` - Asia/Dili
+ * * `Asia/Dubai` - Asia/Dubai
+ * * `Asia/Dushanbe` - Asia/Dushanbe
+ * * `Asia/Famagusta` - Asia/Famagusta
+ * * `Asia/Gaza` - Asia/Gaza
+ * * `Asia/Harbin` - Asia/Harbin
+ * * `Asia/Hebron` - Asia/Hebron
+ * * `Asia/Ho_Chi_Minh` - Asia/Ho_Chi_Minh
+ * * `Asia/Hong_Kong` - Asia/Hong_Kong
+ * * `Asia/Hovd` - Asia/Hovd
+ * * `Asia/Irkutsk` - Asia/Irkutsk
+ * * `Asia/Istanbul` - Asia/Istanbul
+ * * `Asia/Jakarta` - Asia/Jakarta
+ * * `Asia/Jayapura` - Asia/Jayapura
+ * * `Asia/Jerusalem` - Asia/Jerusalem
+ * * `Asia/Kabul` - Asia/Kabul
+ * * `Asia/Kamchatka` - Asia/Kamchatka
+ * * `Asia/Karachi` - Asia/Karachi
+ * * `Asia/Kashgar` - Asia/Kashgar
+ * * `Asia/Kathmandu` - Asia/Kathmandu
+ * * `Asia/Katmandu` - Asia/Katmandu
+ * * `Asia/Khandyga` - Asia/Khandyga
+ * * `Asia/Kolkata` - Asia/Kolkata
+ * * `Asia/Krasnoyarsk` - Asia/Krasnoyarsk
+ * * `Asia/Kuala_Lumpur` - Asia/Kuala_Lumpur
+ * * `Asia/Kuching` - Asia/Kuching
+ * * `Asia/Kuwait` - Asia/Kuwait
+ * * `Asia/Macao` - Asia/Macao
+ * * `Asia/Macau` - Asia/Macau
+ * * `Asia/Magadan` - Asia/Magadan
+ * * `Asia/Makassar` - Asia/Makassar
+ * * `Asia/Manila` - Asia/Manila
+ * * `Asia/Muscat` - Asia/Muscat
+ * * `Asia/Nicosia` - Asia/Nicosia
+ * * `Asia/Novokuznetsk` - Asia/Novokuznetsk
+ * * `Asia/Novosibirsk` - Asia/Novosibirsk
+ * * `Asia/Omsk` - Asia/Omsk
+ * * `Asia/Oral` - Asia/Oral
+ * * `Asia/Phnom_Penh` - Asia/Phnom_Penh
+ * * `Asia/Pontianak` - Asia/Pontianak
+ * * `Asia/Pyongyang` - Asia/Pyongyang
+ * * `Asia/Qatar` - Asia/Qatar
+ * * `Asia/Qostanay` - Asia/Qostanay
+ * * `Asia/Qyzylorda` - Asia/Qyzylorda
+ * * `Asia/Rangoon` - Asia/Rangoon
+ * * `Asia/Riyadh` - Asia/Riyadh
+ * * `Asia/Saigon` - Asia/Saigon
+ * * `Asia/Sakhalin` - Asia/Sakhalin
+ * * `Asia/Samarkand` - Asia/Samarkand
+ * * `Asia/Seoul` - Asia/Seoul
+ * * `Asia/Shanghai` - Asia/Shanghai
+ * * `Asia/Singapore` - Asia/Singapore
+ * * `Asia/Srednekolymsk` - Asia/Srednekolymsk
+ * * `Asia/Taipei` - Asia/Taipei
+ * * `Asia/Tashkent` - Asia/Tashkent
+ * * `Asia/Tbilisi` - Asia/Tbilisi
+ * * `Asia/Tehran` - Asia/Tehran
+ * * `Asia/Tel_Aviv` - Asia/Tel_Aviv
+ * * `Asia/Thimbu` - Asia/Thimbu
+ * * `Asia/Thimphu` - Asia/Thimphu
+ * * `Asia/Tokyo` - Asia/Tokyo
+ * * `Asia/Tomsk` - Asia/Tomsk
+ * * `Asia/Ujung_Pandang` - Asia/Ujung_Pandang
+ * * `Asia/Ulaanbaatar` - Asia/Ulaanbaatar
+ * * `Asia/Ulan_Bator` - Asia/Ulan_Bator
+ * * `Asia/Urumqi` - Asia/Urumqi
+ * * `Asia/Ust-Nera` - Asia/Ust-Nera
+ * * `Asia/Vientiane` - Asia/Vientiane
+ * * `Asia/Vladivostok` - Asia/Vladivostok
+ * * `Asia/Yakutsk` - Asia/Yakutsk
+ * * `Asia/Yangon` - Asia/Yangon
+ * * `Asia/Yekaterinburg` - Asia/Yekaterinburg
+ * * `Asia/Yerevan` - Asia/Yerevan
+ * * `Atlantic/Azores` - Atlantic/Azores
+ * * `Atlantic/Bermuda` - Atlantic/Bermuda
+ * * `Atlantic/Canary` - Atlantic/Canary
+ * * `Atlantic/Cape_Verde` - Atlantic/Cape_Verde
+ * * `Atlantic/Faeroe` - Atlantic/Faeroe
+ * * `Atlantic/Faroe` - Atlantic/Faroe
+ * * `Atlantic/Jan_Mayen` - Atlantic/Jan_Mayen
+ * * `Atlantic/Madeira` - Atlantic/Madeira
+ * * `Atlantic/Reykjavik` - Atlantic/Reykjavik
+ * * `Atlantic/South_Georgia` - Atlantic/South_Georgia
+ * * `Atlantic/St_Helena` - Atlantic/St_Helena
+ * * `Atlantic/Stanley` - Atlantic/Stanley
+ * * `Australia/ACT` - Australia/ACT
+ * * `Australia/Adelaide` - Australia/Adelaide
+ * * `Australia/Brisbane` - Australia/Brisbane
+ * * `Australia/Broken_Hill` - Australia/Broken_Hill
+ * * `Australia/Canberra` - Australia/Canberra
+ * * `Australia/Currie` - Australia/Currie
+ * * `Australia/Darwin` - Australia/Darwin
+ * * `Australia/Eucla` - Australia/Eucla
+ * * `Australia/Hobart` - Australia/Hobart
+ * * `Australia/LHI` - Australia/LHI
+ * * `Australia/Lindeman` - Australia/Lindeman
+ * * `Australia/Lord_Howe` - Australia/Lord_Howe
+ * * `Australia/Melbourne` - Australia/Melbourne
+ * * `Australia/NSW` - Australia/NSW
+ * * `Australia/North` - Australia/North
+ * * `Australia/Perth` - Australia/Perth
+ * * `Australia/Queensland` - Australia/Queensland
+ * * `Australia/South` - Australia/South
+ * * `Australia/Sydney` - Australia/Sydney
+ * * `Australia/Tasmania` - Australia/Tasmania
+ * * `Australia/Victoria` - Australia/Victoria
+ * * `Australia/West` - Australia/West
+ * * `Australia/Yancowinna` - Australia/Yancowinna
+ * * `Brazil/Acre` - Brazil/Acre
+ * * `Brazil/DeNoronha` - Brazil/DeNoronha
+ * * `Brazil/East` - Brazil/East
+ * * `Brazil/West` - Brazil/West
+ * * `CET` - CET
+ * * `CST6CDT` - CST6CDT
+ * * `Canada/Atlantic` - Canada/Atlantic
+ * * `Canada/Central` - Canada/Central
+ * * `Canada/Eastern` - Canada/Eastern
+ * * `Canada/Mountain` - Canada/Mountain
+ * * `Canada/Newfoundland` - Canada/Newfoundland
+ * * `Canada/Pacific` - Canada/Pacific
+ * * `Canada/Saskatchewan` - Canada/Saskatchewan
+ * * `Canada/Yukon` - Canada/Yukon
+ * * `Chile/Continental` - Chile/Continental
+ * * `Chile/EasterIsland` - Chile/EasterIsland
+ * * `Cuba` - Cuba
+ * * `EET` - EET
+ * * `EST` - EST
+ * * `EST5EDT` - EST5EDT
+ * * `Egypt` - Egypt
+ * * `Eire` - Eire
+ * * `Etc/GMT` - Etc/GMT
+ * * `Etc/GMT+0` - Etc/GMT+0
+ * * `Etc/GMT+1` - Etc/GMT+1
+ * * `Etc/GMT+10` - Etc/GMT+10
+ * * `Etc/GMT+11` - Etc/GMT+11
+ * * `Etc/GMT+12` - Etc/GMT+12
+ * * `Etc/GMT+2` - Etc/GMT+2
+ * * `Etc/GMT+3` - Etc/GMT+3
+ * * `Etc/GMT+4` - Etc/GMT+4
+ * * `Etc/GMT+5` - Etc/GMT+5
+ * * `Etc/GMT+6` - Etc/GMT+6
+ * * `Etc/GMT+7` - Etc/GMT+7
+ * * `Etc/GMT+8` - Etc/GMT+8
+ * * `Etc/GMT+9` - Etc/GMT+9
+ * * `Etc/GMT-0` - Etc/GMT-0
+ * * `Etc/GMT-1` - Etc/GMT-1
+ * * `Etc/GMT-10` - Etc/GMT-10
+ * * `Etc/GMT-11` - Etc/GMT-11
+ * * `Etc/GMT-12` - Etc/GMT-12
+ * * `Etc/GMT-13` - Etc/GMT-13
+ * * `Etc/GMT-14` - Etc/GMT-14
+ * * `Etc/GMT-2` - Etc/GMT-2
+ * * `Etc/GMT-3` - Etc/GMT-3
+ * * `Etc/GMT-4` - Etc/GMT-4
+ * * `Etc/GMT-5` - Etc/GMT-5
+ * * `Etc/GMT-6` - Etc/GMT-6
+ * * `Etc/GMT-7` - Etc/GMT-7
+ * * `Etc/GMT-8` - Etc/GMT-8
+ * * `Etc/GMT-9` - Etc/GMT-9
+ * * `Etc/GMT0` - Etc/GMT0
+ * * `Etc/Greenwich` - Etc/Greenwich
+ * * `Etc/UCT` - Etc/UCT
+ * * `Etc/UTC` - Etc/UTC
+ * * `Etc/Universal` - Etc/Universal
+ * * `Etc/Zulu` - Etc/Zulu
+ * * `Europe/Amsterdam` - Europe/Amsterdam
+ * * `Europe/Andorra` - Europe/Andorra
+ * * `Europe/Astrakhan` - Europe/Astrakhan
+ * * `Europe/Athens` - Europe/Athens
+ * * `Europe/Belfast` - Europe/Belfast
+ * * `Europe/Belgrade` - Europe/Belgrade
+ * * `Europe/Berlin` - Europe/Berlin
+ * * `Europe/Bratislava` - Europe/Bratislava
+ * * `Europe/Brussels` - Europe/Brussels
+ * * `Europe/Bucharest` - Europe/Bucharest
+ * * `Europe/Budapest` - Europe/Budapest
+ * * `Europe/Busingen` - Europe/Busingen
+ * * `Europe/Chisinau` - Europe/Chisinau
+ * * `Europe/Copenhagen` - Europe/Copenhagen
+ * * `Europe/Dublin` - Europe/Dublin
+ * * `Europe/Gibraltar` - Europe/Gibraltar
+ * * `Europe/Guernsey` - Europe/Guernsey
+ * * `Europe/Helsinki` - Europe/Helsinki
+ * * `Europe/Isle_of_Man` - Europe/Isle_of_Man
+ * * `Europe/Istanbul` - Europe/Istanbul
+ * * `Europe/Jersey` - Europe/Jersey
+ * * `Europe/Kaliningrad` - Europe/Kaliningrad
+ * * `Europe/Kiev` - Europe/Kiev
+ * * `Europe/Kirov` - Europe/Kirov
+ * * `Europe/Kyiv` - Europe/Kyiv
+ * * `Europe/Lisbon` - Europe/Lisbon
+ * * `Europe/Ljubljana` - Europe/Ljubljana
+ * * `Europe/London` - Europe/London
+ * * `Europe/Luxembourg` - Europe/Luxembourg
+ * * `Europe/Madrid` - Europe/Madrid
+ * * `Europe/Malta` - Europe/Malta
+ * * `Europe/Mariehamn` - Europe/Mariehamn
+ * * `Europe/Minsk` - Europe/Minsk
+ * * `Europe/Monaco` - Europe/Monaco
+ * * `Europe/Moscow` - Europe/Moscow
+ * * `Europe/Nicosia` - Europe/Nicosia
+ * * `Europe/Oslo` - Europe/Oslo
+ * * `Europe/Paris` - Europe/Paris
+ * * `Europe/Podgorica` - Europe/Podgorica
+ * * `Europe/Prague` - Europe/Prague
+ * * `Europe/Riga` - Europe/Riga
+ * * `Europe/Rome` - Europe/Rome
+ * * `Europe/Samara` - Europe/Samara
+ * * `Europe/San_Marino` - Europe/San_Marino
+ * * `Europe/Sarajevo` - Europe/Sarajevo
+ * * `Europe/Saratov` - Europe/Saratov
+ * * `Europe/Simferopol` - Europe/Simferopol
+ * * `Europe/Skopje` - Europe/Skopje
+ * * `Europe/Sofia` - Europe/Sofia
+ * * `Europe/Stockholm` - Europe/Stockholm
+ * * `Europe/Tallinn` - Europe/Tallinn
+ * * `Europe/Tirane` - Europe/Tirane
+ * * `Europe/Tiraspol` - Europe/Tiraspol
+ * * `Europe/Ulyanovsk` - Europe/Ulyanovsk
+ * * `Europe/Uzhgorod` - Europe/Uzhgorod
+ * * `Europe/Vaduz` - Europe/Vaduz
+ * * `Europe/Vatican` - Europe/Vatican
+ * * `Europe/Vienna` - Europe/Vienna
+ * * `Europe/Vilnius` - Europe/Vilnius
+ * * `Europe/Volgograd` - Europe/Volgograd
+ * * `Europe/Warsaw` - Europe/Warsaw
+ * * `Europe/Zagreb` - Europe/Zagreb
+ * * `Europe/Zaporozhye` - Europe/Zaporozhye
+ * * `Europe/Zurich` - Europe/Zurich
+ * * `GB` - GB
+ * * `GB-Eire` - GB-Eire
+ * * `GMT` - GMT
+ * * `GMT+0` - GMT+0
+ * * `GMT-0` - GMT-0
+ * * `GMT0` - GMT0
+ * * `Greenwich` - Greenwich
+ * * `HST` - HST
+ * * `Hongkong` - Hongkong
+ * * `Iceland` - Iceland
+ * * `Indian/Antananarivo` - Indian/Antananarivo
+ * * `Indian/Chagos` - Indian/Chagos
+ * * `Indian/Christmas` - Indian/Christmas
+ * * `Indian/Cocos` - Indian/Cocos
+ * * `Indian/Comoro` - Indian/Comoro
+ * * `Indian/Kerguelen` - Indian/Kerguelen
+ * * `Indian/Mahe` - Indian/Mahe
+ * * `Indian/Maldives` - Indian/Maldives
+ * * `Indian/Mauritius` - Indian/Mauritius
+ * * `Indian/Mayotte` - Indian/Mayotte
+ * * `Indian/Reunion` - Indian/Reunion
+ * * `Iran` - Iran
+ * * `Israel` - Israel
+ * * `Jamaica` - Jamaica
+ * * `Japan` - Japan
+ * * `Kwajalein` - Kwajalein
+ * * `Libya` - Libya
+ * * `MET` - MET
+ * * `MST` - MST
+ * * `MST7MDT` - MST7MDT
+ * * `Mexico/BajaNorte` - Mexico/BajaNorte
+ * * `Mexico/BajaSur` - Mexico/BajaSur
+ * * `Mexico/General` - Mexico/General
+ * * `NZ` - NZ
+ * * `NZ-CHAT` - NZ-CHAT
+ * * `Navajo` - Navajo
+ * * `PRC` - PRC
+ * * `PST8PDT` - PST8PDT
+ * * `Pacific/Apia` - Pacific/Apia
+ * * `Pacific/Auckland` - Pacific/Auckland
+ * * `Pacific/Bougainville` - Pacific/Bougainville
+ * * `Pacific/Chatham` - Pacific/Chatham
+ * * `Pacific/Chuuk` - Pacific/Chuuk
+ * * `Pacific/Easter` - Pacific/Easter
+ * * `Pacific/Efate` - Pacific/Efate
+ * * `Pacific/Enderbury` - Pacific/Enderbury
+ * * `Pacific/Fakaofo` - Pacific/Fakaofo
+ * * `Pacific/Fiji` - Pacific/Fiji
+ * * `Pacific/Funafuti` - Pacific/Funafuti
+ * * `Pacific/Galapagos` - Pacific/Galapagos
+ * * `Pacific/Gambier` - Pacific/Gambier
+ * * `Pacific/Guadalcanal` - Pacific/Guadalcanal
+ * * `Pacific/Guam` - Pacific/Guam
+ * * `Pacific/Honolulu` - Pacific/Honolulu
+ * * `Pacific/Johnston` - Pacific/Johnston
+ * * `Pacific/Kanton` - Pacific/Kanton
+ * * `Pacific/Kiritimati` - Pacific/Kiritimati
+ * * `Pacific/Kosrae` - Pacific/Kosrae
+ * * `Pacific/Kwajalein` - Pacific/Kwajalein
+ * * `Pacific/Majuro` - Pacific/Majuro
+ * * `Pacific/Marquesas` - Pacific/Marquesas
+ * * `Pacific/Midway` - Pacific/Midway
+ * * `Pacific/Nauru` - Pacific/Nauru
+ * * `Pacific/Niue` - Pacific/Niue
+ * * `Pacific/Norfolk` - Pacific/Norfolk
+ * * `Pacific/Noumea` - Pacific/Noumea
+ * * `Pacific/Pago_Pago` - Pacific/Pago_Pago
+ * * `Pacific/Palau` - Pacific/Palau
+ * * `Pacific/Pitcairn` - Pacific/Pitcairn
+ * * `Pacific/Pohnpei` - Pacific/Pohnpei
+ * * `Pacific/Ponape` - Pacific/Ponape
+ * * `Pacific/Port_Moresby` - Pacific/Port_Moresby
+ * * `Pacific/Rarotonga` - Pacific/Rarotonga
+ * * `Pacific/Saipan` - Pacific/Saipan
+ * * `Pacific/Samoa` - Pacific/Samoa
+ * * `Pacific/Tahiti` - Pacific/Tahiti
+ * * `Pacific/Tarawa` - Pacific/Tarawa
+ * * `Pacific/Tongatapu` - Pacific/Tongatapu
+ * * `Pacific/Truk` - Pacific/Truk
+ * * `Pacific/Wake` - Pacific/Wake
+ * * `Pacific/Wallis` - Pacific/Wallis
+ * * `Pacific/Yap` - Pacific/Yap
+ * * `Poland` - Poland
+ * * `Portugal` - Portugal
+ * * `ROC` - ROC
+ * * `ROK` - ROK
+ * * `Singapore` - Singapore
+ * * `Turkey` - Turkey
+ * * `UCT` - UCT
+ * * `US/Alaska` - US/Alaska
+ * * `US/Aleutian` - US/Aleutian
+ * * `US/Arizona` - US/Arizona
+ * * `US/Central` - US/Central
+ * * `US/East-Indiana` - US/East-Indiana
+ * * `US/Eastern` - US/Eastern
+ * * `US/Hawaii` - US/Hawaii
+ * * `US/Indiana-Starke` - US/Indiana-Starke
+ * * `US/Michigan` - US/Michigan
+ * * `US/Mountain` - US/Mountain
+ * * `US/Pacific` - US/Pacific
+ * * `US/Samoa` - US/Samoa
+ * * `UTC` - UTC
+ * * `Universal` - Universal
+ * * `W-SU` - W-SU
+ * * `WET` - WET
+ * * `Zulu` - Zulu */
+ timezone?: string
+ /** Element attributes that posthog-js should capture as action identifiers (e.g. `['data-attr']`). */
+ data_attributes?: unknown
+ /**
+ * Ordered list of person properties used to render a human-friendly display name in the UI.
+ * @nullable
+ * @items.maxLength 400
+ */
+ person_display_name_properties?: string[] | null
+ correlation_config?: unknown
+ /**
+ * Disables posthog-js autocapture (clicks, page views) when true.
+ * @nullable
+ */
+ autocapture_opt_out?: boolean | null
+ /**
+ * Enables automatic capture of JavaScript exceptions via the SDK.
+ * @nullable
+ */
+ autocapture_exceptions_opt_in?: boolean | null
+ /**
+ * Enables automatic capture of Core Web Vitals performance metrics.
+ * @nullable
+ */
+ autocapture_web_vitals_opt_in?: boolean | null
+ autocapture_web_vitals_allowed_metrics?: unknown
+ autocapture_exceptions_errors_to_ignore?: unknown
+ /**
+ * Enables capturing browser console logs alongside session replays.
+ * @nullable
+ */
+ capture_console_log_opt_in?: boolean | null
+ /**
+ * Enables capturing performance timing and network requests.
+ * @nullable
+ */
+ capture_performance_opt_in?: boolean | null
+ /** Enables session replay recording for this project. */
+ session_recording_opt_in?: boolean
+ /**
+ * Fraction of sessions to record, as a decimal string between `0.00` and `1.00` (e.g. `0.1` = 10%).
+ * @nullable
+ * @pattern ^-?\d{0,1}(?:\.\d{0,2})?$
+ */
+ session_recording_sample_rate?: string | null
+ /**
+ * Skip saving sessions shorter than this many milliseconds.
+ * @minimum 0
+ * @maximum 30000
+ * @nullable
+ */
+ session_recording_minimum_duration_milliseconds?: number | null
+ session_recording_linked_flag?: unknown
+ session_recording_network_payload_capture_config?: unknown
+ session_recording_masking_config?: unknown
+ /** @nullable */
+ session_recording_url_trigger_config?: unknown[] | null
+ /** @nullable */
+ session_recording_url_blocklist_config?: unknown[] | null
+ /** @nullable */
+ session_recording_event_trigger_config?: (string | null)[] | null
+ /**
+ * @maxLength 24
+ * @nullable
+ */
+ session_recording_trigger_match_type_config?: string | null
+ /** V2 trigger groups configuration for session recording. If present, takes precedence over legacy trigger fields. */
+ session_recording_trigger_groups?: unknown
+ /** How long to retain new session recordings. One of `30d`, `90d`, `1y`, or `5y` (availability depends on plan).
+ *
+ * * `30d` - 30 Days
+ * * `90d` - 90 Days
+ * * `1y` - 1 Year
+ * * `5y` - 5 Years */
+ session_recording_retention_period?: SessionRecordingRetentionPeriodEnumApi
+ session_replay_config?: unknown
+ survey_config?: unknown
+ access_control?: boolean
+ /** First day of the week for date range filters. 0 = Sunday, 1 = Monday.
+ *
+ * * `0` - Sunday
+ * * `1` - Monday */
+ week_start_day?: WeekStartDayEnumApi | null
+ /**
+ * ID of the dashboard shown as the project's default landing dashboard.
+ * @nullable
+ */
+ primary_dashboard?: number | null
+ /**
+ * ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view.
+ * @nullable
+ */
+ home_tab_dashboard?: number | null
+ /** @nullable */
+ live_events_columns?: string[] | null
+ /**
+ * Origins permitted to record session replays and heatmaps. Empty list allows all origins.
+ * @nullable
+ * @items.maxLength 200
+ */
+ recording_domains?: (string | null)[] | null
+ readonly person_on_events_querying_enabled: boolean
+ /** @nullable */
+ inject_web_apps?: boolean | null
+ extra_settings?: unknown
+ modifiers?: unknown
+ readonly default_modifiers: ProjectBackwardCompatApiDefaultModifiers
+ has_completed_onboarding_for?: unknown
+ /**
+ * Enables displaying surveys via posthog-js on allowed origins.
+ * @nullable
+ */
+ surveys_opt_in?: boolean | null
+ /**
+ * Enables heatmap recording on pages that host posthog-js.
+ * @nullable
+ */
+ heatmaps_opt_in?: boolean | null
+ readonly product_intents: readonly ProjectBackwardCompatApiProductIntentsItem[]
+ /**
+ * Default value for the `persist` option on newly created feature flags.
+ * @nullable
+ */
+ flags_persistence_default?: boolean | null
+ /** @nullable */
+ readonly secret_api_token: string | null
+ /** @nullable */
+ readonly secret_api_token_backup: string | null
+ /**
+ * Value this project's heatmap screenshots send as a cookie scoped to your domain, so bot protection can allow them. Only project admins can read it; null for everyone else and when none has been generated.
+ * @nullable
+ */
+ readonly heatmaps_screenshot_secret: string | null
+ /** @nullable */
+ receive_org_level_activity_logs?: boolean | null
+ /** Whether this project serves B2B or B2C customers. Used to optimize default UI layouts.
+ *
+ * * `b2b` - B2B
+ * * `b2c` - B2C
+ * * `other` - Other */
+ business_model?: BusinessModelEnumApi | BlankEnumApi | null
+ /**
+ * Enables the customer conversations / live chat product for this project.
+ * @nullable
+ */
+ conversations_enabled?: boolean | null
+ /**
+ * Settings for Conversations. Must be a JSON object or null.
+ * @nullable
+ */
+ conversations_settings?: ProjectBackwardCompatApiConversationsSettings
+ logs_settings?: unknown
+ /** @nullable */
+ proactive_tasks_enabled?: boolean | null
+ readonly available_setup_task_ids: readonly AvailableSetupTaskIdsEnumApi[]
+ /**
+ * Set to True when project deletion has been initiated. Blocks UI access to this project until the async task completes.
+ * @nullable
+ */
+ readonly is_pending_deletion: boolean | null
+ /**
+ * When the scheduled project deletion will run.
+ * @nullable
+ */
+ readonly deletion_scheduled_at: string | null
+ /** ID of the project this environment belongs to. */
+ readonly project_id: number
+ /**
+ * The effective access level the user has for this object
+ * @nullable
+ */
+ readonly user_access_level: string | null
+ readonly managed_viewsets: ProjectBackwardCompatApiManagedViewsets
+ /** Which table this project's feature flag usage data is read from. PostHog sets it for the whole organization. 0 reads the events table. 1 and 2 read the flag_evaluations table. */
+ readonly flag_evaluations_mode: FlagEvaluationsModeEnumApi
+ revenue_analytics_config?: TeamRevenueAnalyticsConfigApi
+ marketing_analytics_config?: TeamMarketingAnalyticsConfigApi
+ customer_analytics_config?: TeamCustomerAnalyticsConfigApi
+ workflows_config?: TeamWorkflowsConfigApi
+ feature_flag_policy_config?: TeamFeatureFlagPolicyConfigApi
+ base_currency?: BaseCurrencyEnumApi
+ /**
+ * Enables capturing clicks that had no effect (rage-click detection).
+ * @nullable
+ */
+ capture_dead_clicks?: boolean | null
+ cookieless_server_hash_mode?: CookielessServerHashModeEnumApi | null
+ /** @nullable */
+ human_friendly_comparison_periods?: boolean | null
+ /** @nullable */
+ feature_flag_confirmation_enabled?: boolean | null
+ /** @nullable */
+ feature_flag_confirmation_message?: string | null
+ /**
+ * Whether to automatically apply default evaluation contexts to new feature flags
+ * @nullable
+ */
+ default_evaluation_contexts_enabled?: boolean | null
+ /**
+ * Whether to require at least one evaluation context tag when creating new feature flags
+ * @nullable
+ */
+ require_evaluation_contexts?: boolean | null
+ /**
+ * @minimum -2147483648
+ * @maximum 2147483647
+ * @nullable
+ */
+ default_data_theme?: number | null
+ onboarding_tasks?: unknown
+ /** @nullable */
+ web_analytics_pre_aggregated_tables_enabled?: boolean | null
+}
+
+export type PatchedProjectBackwardCompatApiGroupTypesItem = { [key: string]: unknown }
+
+export type PatchedProjectBackwardCompatApiDefaultModifiers = { [key: string]: unknown }
+
+export type PatchedProjectBackwardCompatApiProductIntentsItem = {
+ product_type?: string
+ created_at?: string
+ /** @nullable */
+ onboarding_completed_at?: string | null
+ updated_at?: string
+}
+
+/**
+ * Settings for Conversations. Must be a JSON object or null.
+ * @nullable
+ */
+export type PatchedProjectBackwardCompatApiConversationsSettings = { [key: string]: unknown } | null
+
+export type PatchedProjectBackwardCompatApiManagedViewsets = { [key: string]: boolean }
+
+/**
+ * A project and its settings, including the settings that live on its passthrough Team.
+ *
+ * This shape is a superset of TeamSerializer's, so a request rewritten from /api/environments/
+ * onto /api/projects/ never loses a field.
+ */
+export interface PatchedProjectBackwardCompatApi {
+ readonly id?: number
+ readonly organization?: string
+ /**
+ * Project name. Must be unique within the organization (case-insensitive). If omitted on creation, a unique default name is generated.
+ * @minLength 1
+ * @maxLength 200
+ */
+ name?: string
+ /**
+ * Short description of what the project is about. This is helpful to give our AI agents context about your project.
+ * @maxLength 1000
+ * @nullable
+ */
+ product_description?: string | null
+ /**
+ * Labels applied to this project. Names are trimmed and lowercased, and sending this field replaces the project's existing tags.
+ * @items.maxLength 255
+ */
+ tags?: string[]
+ readonly created_at?: string
+ readonly effective_membership_level?: OrganizationMembershipLevelEnumApi
+ readonly has_group_types?: boolean
+ readonly group_types?: readonly PatchedProjectBackwardCompatApiGroupTypesItem[]
+ /** @nullable */
+ readonly live_events_token?: string | null
+ /** @nullable */
+ readonly updated_at?: string | null
+ readonly uuid?: string
+ readonly api_token?: string
/** @items.maxLength 200 */
app_urls?: (string | null)[]
/** When true, PostHog drops the IP address from every ingested event. */
@@ -3535,6 +4359,11 @@ export interface PatchedProjectBackwardCompatApi {
* @nullable
*/
primary_dashboard?: number | null
+ /**
+ * ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view.
+ * @nullable
+ */
+ home_tab_dashboard?: number | null
/** @nullable */
live_events_columns?: string[] | null
/**
diff --git a/frontend/src/generated/core/api.ts b/frontend/src/generated/core/api.ts
index 686c1210d5cb..21d6a79df9ee 100644
--- a/frontend/src/generated/core/api.ts
+++ b/frontend/src/generated/core/api.ts
@@ -90,6 +90,7 @@ import type {
ProductEnablementResultApi,
ProjectApi,
ProjectBackwardCompatApi,
+ ProjectCreateRequestApi,
ProjectSecretAPIKeyApi,
ProjectSecretApiKeysListParams,
PropertyDefinitionsListParams,
@@ -848,14 +849,14 @@ export const getOrganizationsProjectsCreateUrl = (organizationId: string) => {
*/
export const organizationsProjectsCreate = async (
organizationId: string,
- projectBackwardCompatApi?: NonReadonly<ProjectBackwardCompatApi>,
+ projectCreateRequestApi?: ProjectCreateRequestApi,
options?: RequestInit
): Promise<ProjectBackwardCompatApi> => {
return apiMutator<ProjectBackwardCompatApi>(getOrganizationsProjectsCreateUrl(organizationId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(projectBackwardCompatApi),
+ body: JSON.stringify(projectCreateRequestApi),
})
}
diff --git a/frontend/src/lib/api.mock.ts b/frontend/src/lib/api.mock.ts
index 9560293ebb21..30ca516950b5 100644
--- a/frontend/src/lib/api.mock.ts
+++ b/frontend/src/lib/api.mock.ts
@@ -125,6 +125,7 @@ export const MOCK_DEFAULT_TEAM: TeamType = {
],
has_group_types: true,
primary_dashboard: 1,
+ home_tab_dashboard: null,
live_events_columns: null,
person_on_events_querying_enabled: true,
live_events_token: '123',
diff --git a/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.stories.tsx b/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.stories.tsx
new file mode 100644
index 000000000000..818b2b06914b
--- /dev/null
+++ b/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.stories.tsx
@@ -0,0 +1,39 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import { useChartTheme } from 'lib/charts/hooks'
+
+import { AnalyticsMetricCard } from './AnalyticsMetricCard'
+
+const meta: Meta<typeof AnalyticsMetricCard> = {
+ title: 'Components/Analytics Metric Card',
+ component: AnalyticsMetricCard,
+ parameters: { layout: 'padded' },
+ args: { title: 'Active users', value: 12450, change: { value: 12.4 }, subtitle: 'vs. 11,076 prior' },
+}
+export default meta
+
+type Story = StoryObj<typeof AnalyticsMetricCard>
+export const Static: Story = {}
+export const Clickable: Story = { args: { onClick: () => {}, ariaLabel: 'Active users' } }
+export const Selected: Story = { args: { onClick: () => {}, selected: true } }
+export const WithoutComparison: Story = { args: { showChange: false, subtitle: 'For selected period' } }
+export const Loading: Story = {
+ args: { loading: true },
+ parameters: { testOptions: { waitForLoadersToDisappear: false } },
+}
+export const Error: Story = { args: { error: 'Could not load' } }
+export const Empty: Story = { args: { value: undefined } }
+
+export const WithTrendLine: Story = {
+ render: function Render(args) {
+ const theme = useChartTheme()
+ return (
+ <AnalyticsMetricCard
+ {...args}
+ theme={theme}
+ data={[9100, 10400, 9800, 11100, 12450]}
+ labels={['Mon', 'Tue', 'Wed', 'Thu', 'Fri']}
+ />
+ )
+ },
+}
diff --git a/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.test.tsx b/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.test.tsx
new file mode 100644
index 000000000000..ae72a5e67bbf
--- /dev/null
+++ b/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.test.tsx
@@ -0,0 +1,50 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+
+import { AnalyticsMetricCard } from './AnalyticsMetricCard'
+
+describe('AnalyticsMetricCard', () => {
+ afterEach(cleanup)
+ it('keeps static metrics out of the keyboard tab order', () => {
+ render(<AnalyticsMetricCard title="Sessions" value={120} />)
+ expect(screen.queryByRole('button')).not.toBeInTheDocument()
+ expect(screen.getByText('Sessions')).toBeInTheDocument()
+ })
+
+ it('supports keyboard selection with native button behavior', async () => {
+ const onClick = jest.fn()
+ render(<AnalyticsMetricCard title="Sessions" value={120} onClick={onClick} selected={false} />)
+ await userEvent.tab()
+ expect(screen.getByRole('button')).toHaveFocus()
+ await userEvent.keyboard('{Enter}')
+ await userEvent.keyboard(' ')
+ expect(onClick).toHaveBeenCalledTimes(2)
+ expect(screen.getByRole('button')).toHaveAttribute('aria-pressed', 'false')
+ })
+
+ it('does not trigger a containing click action', () => {
+ const parentClick = jest.fn()
+ const onClick = jest.fn()
+ render(
+ <div onClick={parentClick}>
+ <AnalyticsMetricCard title="Sessions" value={120} onClick={onClick} selected />
+ </div>
+ )
+ fireEvent.click(screen.getByRole('button'))
+ expect(onClick).toHaveBeenCalledTimes(1)
+ expect(parentClick).not.toHaveBeenCalled()
+ expect(screen.getByRole('button')).toHaveAttribute('aria-pressed', 'true')
+ })
+
+ it('keeps loading distinct from an empty or failed response', () => {
+ const { rerender } = render(<AnalyticsMetricCard title="Sessions" loading error="Could not load" />)
+ expect(screen.queryByText('Could not load')).not.toBeInTheDocument()
+ expect(screen.queryByText('No data for this period')).not.toBeInTheDocument()
+ rerender(<AnalyticsMetricCard title="Sessions" error="Could not load" />)
+ expect(screen.getByText('Could not load')).toBeInTheDocument()
+ rerender(<AnalyticsMetricCard title="Sessions" />)
+ expect(screen.getByText('No data for this period')).toBeInTheDocument()
+ })
+})
diff --git a/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.tsx b/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.tsx
new file mode 100644
index 000000000000..4a2f6fa4740a
--- /dev/null
+++ b/frontend/src/lib/components/AnalyticsMetricCard/AnalyticsMetricCard.tsx
@@ -0,0 +1,88 @@
+import clsx from 'clsx'
+import type { ReactNode } from 'react'
+
+import { IconChevronRight } from '@posthog/icons'
+import { LemonSkeleton } from '@posthog/lemon-ui'
+import { MetricCard, type MetricCardProps } from '@posthog/quill-charts'
+
+export interface AnalyticsMetricCardProps extends MetricCardProps {
+ loading?: boolean
+ error?: ReactNode
+ emptyMessage?: ReactNode
+ onClick?: () => void
+ selected?: boolean
+ ariaLabel?: string
+ adornment?: ReactNode
+}
+
+/** Shared surface for analytics metrics; pass data/theme for a sparkline and showChange for comparisons. */
+export function AnalyticsMetricCard({
+ loading = false,
+ error,
+ emptyMessage = 'No data for this period',
+ onClick,
+ selected,
+ ariaLabel,
+ adornment,
+ className,
+ dataAttr,
+ title,
+ ...metricProps
+}: AnalyticsMetricCardProps): JSX.Element {
+ const Content = onClick ? 'button' : 'div'
+ const hasValue = metricProps.value != null || metricProps.data?.some(Number.isFinite)
+ const label = <span className={clsx('inline-flex items-center gap-1', selected && 'text-accent')}>{title}</span>
+
+ return (
+ <div
+ className={clsx(
+ 'relative flex min-w-0 flex-col rounded border transition-colors',
+ selected ? 'border-accent bg-accent-highlight-secondary' : 'border-primary bg-surface-primary',
+ onClick && 'hover:border-accent',
+ className
+ )}
+ >
+ <Content
+ type={onClick ? 'button' : undefined}
+ onClick={
+ onClick
+ ? (event) => {
+ event.stopPropagation()
+ onClick()
+ }
+ : undefined
+ }
+ aria-label={ariaLabel}
+ aria-pressed={onClick ? selected : undefined}
+ aria-busy={loading}
+ data-attr={dataAttr}
+ className={clsx(
+ 'flex h-full w-full min-w-0 flex-col rounded p-3 text-left',
+ onClick &&
+ 'cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent'
+ )}
+ >
+ {loading ? (
+ <span className="flex w-full flex-col gap-2">
+ <LemonSkeleton className="h-3 w-16" />
+ <LemonSkeleton className="h-9 w-24" />
+ <LemonSkeleton className="h-3 w-20" />
+ </span>
+ ) : error || !hasValue ? (
+ <>
+ <span className="mb-2 text-sm font-medium">{label}</span>
+ <span className={clsx('text-sm', error ? 'text-danger' : 'text-secondary')}>
+ {error || emptyMessage}
+ </span>
+ </>
+ ) : (
+ <MetricCard {...metricProps} title={label} className="h-full [&>div:first-child]:flex-1" />
+ )}
+ {onClick && (
+ <IconChevronRight className="absolute bottom-3 right-3 size-3 text-secondary" aria-hidden />
+ )}
+ </Content>
+ {adornment}
+ </div>
+ )
+}
diff --git a/frontend/src/lib/components/SceneDashboardChoice/SceneDashboardChoiceModal.tsx b/frontend/src/lib/components/SceneDashboardChoice/SceneDashboardChoiceModal.tsx
index 0b8e2f4bffed..3f519f73ebee 100644
--- a/frontend/src/lib/components/SceneDashboardChoice/SceneDashboardChoiceModal.tsx
+++ b/frontend/src/lib/components/SceneDashboardChoice/SceneDashboardChoiceModal.tsx
@@ -9,6 +9,7 @@ import { LemonModal } from 'lib/lemon-ui/LemonModal'
import { LemonRow } from 'lib/lemon-ui/LemonRow'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { cn } from 'lib/utils/css-classes'
+import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { dashboardsModel } from '~/models/dashboardsModel'
@@ -21,15 +22,21 @@ import {
export function SceneDashboardChoiceModal({ scene }: SceneDashboardChoiceModalProps): JSX.Element {
const modalLogic = sceneDashboardChoiceModalLogic({ scene })
- const { isOpen, currentDashboardId, dashboards, searchTerm } = useValues(modalLogic)
+ const { isOpen, currentDashboardId, dashboards, searchTerm, dashboardChoiceView } = useValues(modalLogic)
const { closeSceneDashboardChoiceModal, setSceneDashboardChoice, setSearchTerm } = useActions(modalLogic)
const { dashboardsLoading } = useValues(dashboardsModel)
return (
<LemonModal
- isOpen={isOpen}
+ isOpen={isOpen && (scene !== Scene.ProductAnalyticsHomeTab || dashboardChoiceView === 'existing')}
onClose={closeSceneDashboardChoiceModal}
- title={<>Select a default dashboard for {sceneDescription[scene]}</>}
+ title={
+ scene === Scene.ProductAnalyticsHomeTab ? (
+ <>Choose an existing dashboard</>
+ ) : (
+ <>Select a default dashboard for {sceneDescription[scene]}</>
+ )
+ }
footer={
<div className={cn('flex gap-2 w-full', currentDashboardId ? 'justify-between' : 'justify-end')}>
{currentDashboardId ? (
@@ -42,7 +49,7 @@ export function SceneDashboardChoiceModal({ scene }: SceneDashboardChoiceModalPr
closeSceneDashboardChoiceModal()
}}
>
- Reset to "new tab"
+ {scene === Scene.ProductAnalyticsHomeTab ? 'Use PostHog Home' : 'Reset to "new tab"'}
</LemonButton>
) : null}
<LemonButton
@@ -87,7 +94,11 @@ export function SceneDashboardChoiceModal({ scene }: SceneDashboardChoiceModalPr
<SceneIcon scene={scene} size="small" /> <span>Default</span>
</>
) : (
- <strong className="set-default-text">Set as default</strong>
+ <strong className="set-default-text">
+ {scene === Scene.ProductAnalyticsHomeTab
+ ? 'Set as Home dashboard'
+ : 'Set as default'}
+ </strong>
)}
</div>
)
@@ -107,7 +118,14 @@ export function SceneDashboardChoiceModal({ scene }: SceneDashboardChoiceModalPr
setSceneDashboardChoice(dashboard.id)
setSearchTerm('')
closeSceneDashboardChoiceModal()
- router.actions.replace(urls.projectHomepage())
+ // Only the project homepage scene needs a redirect — its
+ // trigger can live elsewhere, so the result isn't
+ // necessarily on screen yet. Other scenes (including this
+ // one) render the modal from the same place its result
+ // shows, so the picked dashboard already appears in place.
+ if (scene === Scene.ProjectHomepage) {
+ router.actions.replace(urls.projectHomepage())
+ }
}}
>
{rowContents}
diff --git a/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.test.ts b/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.test.ts
index e05394a6d54e..6e809cd75003 100644
--- a/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.test.ts
+++ b/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.test.ts
@@ -42,6 +42,7 @@ describe('sceneDashboardChoiceModalLogic', () => {
{
...MOCK_DEFAULT_TEAM,
primary_dashboard: data?.primary_dashboard,
+ home_tab_dashboard: data?.home_tab_dashboard,
},
]
},
@@ -104,4 +105,36 @@ describe('sceneDashboardChoiceModalLogic', () => {
})
})
})
+
+ describe('for product analytics Home', () => {
+ beforeEach(() => {
+ logic = sceneDashboardChoiceModalLogic({ scene: Scene.ProductAnalyticsHomeTab })
+ logic.mount()
+ })
+
+ it('opens the starter before the existing dashboard picker', async () => {
+ await expectLogic(logic, () => {
+ logic.actions.showSceneDashboardChoiceModal()
+ }).toMatchValues({
+ isOpen: true,
+ dashboardChoiceView: 'starter',
+ })
+
+ await expectLogic(logic, () => {
+ logic.actions.showDashboardPicker()
+ }).toMatchValues({
+ dashboardChoiceView: 'existing',
+ })
+ })
+
+ it('can restore PostHog Home', async () => {
+ await expectLogic(logic, () => {
+ logic.actions.setSceneDashboardChoice(null)
+ })
+ .toDispatchActions(teamLogic, ['updateCurrentTeam', 'updateCurrentTeamSuccess'])
+ .toMatchValues({
+ currentDashboardId: null,
+ })
+ })
+ })
})
diff --git a/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts b/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts
index 49e6b649df5c..53a7eeb5020f 100644
--- a/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts
+++ b/frontend/src/lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic.ts
@@ -11,16 +11,30 @@ import { DashboardBasicType } from '~/types'
import type { DashboardType, TeamPublicType, TeamType, UserType } from '../../../types'
-export type DashboardCompatibleScenes = Scene.ProjectHomepage | Scene.Person | Scene.Group
+export type DashboardCompatibleScenes =
+ | Scene.ProjectHomepage
+ | Scene.Person
+ | Scene.Group
+ | Scene.ProductAnalyticsHomeTab
export interface SceneDashboardChoiceModalProps {
scene: DashboardCompatibleScenes
}
+export type DashboardChoiceView = 'starter' | 'existing'
+
export const sceneDescription: Record<DashboardCompatibleScenes, string> = {
[Scene.Person]: 'persons',
[Scene.Group]: 'groups',
[Scene.ProjectHomepage]: 'this project',
+ [Scene.ProductAnalyticsHomeTab]: 'the product analytics Home tab',
+}
+
+// Scenes whose choice is team-scoped (currentTeam.<field>) rather than the per-user
+// user.scene_personalisation default that other scenes use.
+const TEAM_SCOPED_DASHBOARD_FIELD: Partial<Record<DashboardCompatibleScenes, keyof TeamType>> = {
+ [Scene.ProjectHomepage]: 'primary_dashboard',
+ [Scene.ProductAnalyticsHomeTab]: 'home_tab_dashboard',
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -29,6 +43,7 @@ export interface sceneDashboardChoiceModalLogicValues {
currentTeam: TeamPublicType | TeamType | null // teamLogic
user: UserType | null // userLogic
currentDashboardId: number | null
+ dashboardChoiceView: DashboardChoiceView
dashboards: (DashboardBasicType | DashboardType)[]
isOpen: boolean
searchTerm: string | null
@@ -54,7 +69,9 @@ export interface sceneDashboardChoiceModalLogicActions {
setSearchTerm: (searchTerm: string) => {
searchTerm: string
}
+ showDashboardPicker: () => boolean
showSceneDashboardChoiceModal: () => boolean
+ showStarterOptions: () => boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -96,10 +113,19 @@ export const sceneDashboardChoiceModalLogic = kea<sceneDashboardChoiceModalLogic
closeSceneDashboardChoiceModal: () => true,
setSceneDashboardChoice: (dashboardId: number | null) => ({ dashboardId }),
setSearchTerm: (searchTerm: string) => ({ searchTerm }),
+ showDashboardPicker: () => true,
+ showStarterOptions: () => true,
}),
reducers({
searchTerm: [null as string | null, { setSearchTerm: (_, { searchTerm }) => searchTerm }],
isOpen: [false, { showSceneDashboardChoiceModal: () => true, closeSceneDashboardChoiceModal: () => false }],
+ dashboardChoiceView: [
+ 'existing' as DashboardChoiceView,
+ {
+ showDashboardPicker: () => 'existing',
+ showStarterOptions: () => 'starter',
+ },
+ ],
}),
selectors(({ props }) => ({
currentDashboardId: [
@@ -108,12 +134,10 @@ export const sceneDashboardChoiceModalLogic = kea<sceneDashboardChoiceModalLogic
currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType,
user: null | import('~/types').UserType
) => {
- let currentDashboard: number | DashboardBasicType | null =
- user?.scene_personalisation?.find((choice) => choice.scene === props.scene)?.dashboard ?? null
-
- if (!currentDashboard && props.scene === Scene.ProjectHomepage) {
- currentDashboard = currentTeam?.primary_dashboard ?? null
- }
+ const teamScopedField = TEAM_SCOPED_DASHBOARD_FIELD[props.scene]
+ let currentDashboard: number | DashboardBasicType | null = teamScopedField
+ ? ((currentTeam?.[teamScopedField] as number | null) ?? null)
+ : (user?.scene_personalisation?.find((choice) => choice.scene === props.scene)?.dashboard ?? null)
return (typeof currentDashboard === 'number' ? currentDashboard : currentDashboard?.id) ?? null
},
@@ -137,20 +161,26 @@ export const sceneDashboardChoiceModalLogic = kea<sceneDashboardChoiceModalLogic
})),
listeners(({ actions, props }) => ({
setSceneDashboardChoice: async ({ dashboardId }) => {
- // TODO needs to report scene and dashboard
- if (props.scene === Scene.ProjectHomepage) {
- // TODO be able to save individual or team level home dashboard
- actions.updateCurrentTeam({ primary_dashboard: dashboardId ?? null })
- posthog.capture('primary dashboard changed')
+ const teamScopedField = TEAM_SCOPED_DASHBOARD_FIELD[props.scene]
+ if (teamScopedField) {
+ actions.updateCurrentTeam({ [teamScopedField]: dashboardId ?? null })
+ posthog.capture(
+ props.scene === Scene.ProjectHomepage ? 'primary dashboard changed' : 'home tab dashboard changed'
+ )
} else {
actions.setUserScenePersonalisation(props.scene, dashboardId ?? 0)
posthog.capture('scene dashboard choice set', { scene: props.scene, dashboardId: dashboardId })
}
},
showSceneDashboardChoiceModal: async () => {
+ if (props.scene === Scene.ProductAnalyticsHomeTab) {
+ actions.showStarterOptions()
+ }
actions.loadDashboardsIfNeeded()
if (props.scene === Scene.ProjectHomepage) {
posthog.capture('primary dashboard modal opened')
+ } else if (props.scene === Scene.ProductAnalyticsHomeTab) {
+ posthog.capture('home tab dashboard modal opened')
} else {
posthog.capture('scene dashboard choice modal opened', { scene: props.scene })
}
diff --git a/frontend/src/queries/nodes/InsightViz/InsightViz.scss b/frontend/src/queries/nodes/InsightViz/InsightViz.scss
index 218a03fa4ebb..a3a184841e77 100644
--- a/frontend/src/queries/nodes/InsightViz/InsightViz.scss
+++ b/frontend/src/queries/nodes/InsightViz/InsightViz.scss
@@ -140,7 +140,8 @@
.MarkdownNotebook__real-node &,
.InsightCard &,
.ExportedInsight &,
- .WebAnalyticsDashboard & {
+ .WebAnalyticsDashboard &,
+ .HomeTabDefaultChart & {
flex: 1;
height: 100%;
@@ -202,6 +203,12 @@
}
}
+.HomeTabDefaultChart {
+ .InsightVizDisplay {
+ --insight-viz-min-height: 24rem;
+ }
+}
+
.RetentionContainer {
display: flex;
flex: 1;
@@ -259,7 +266,8 @@
.NotebookNode &,
.InsightCard &,
.ExportedInsight &,
- .WebAnalyticsDashboard & {
+ .WebAnalyticsDashboard &,
+ .HomeTabDefaultChart & {
height: auto;
min-height: auto;
max-height: none;
diff --git a/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx b/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx
index d6b4442a8d33..7e05e5965a5e 100644
--- a/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx
+++ b/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx
@@ -1,11 +1,11 @@
-import clsx from 'clsx'
import { useValues } from 'kea'
import type React from 'react'
import { IconWarning } from '@posthog/icons'
-import { LemonSkeleton, Link } from '@posthog/lemon-ui'
-import { MetricCard, type MetricChange } from '@posthog/quill-charts'
+import { Link } from '@posthog/lemon-ui'
+import { type MetricChange } from '@posthog/quill-charts'
+import { AnalyticsMetricCard } from 'lib/components/AnalyticsMetricCard/AnalyticsMetricCard'
import { PreAggregatedBadge } from 'lib/components/PreAggregatedBadge'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { range } from 'lib/utils/arrays'
@@ -49,7 +49,7 @@ export function OverviewMetricCardGrid({
}
>
{loading
- ? range(numSkeletons).map((i) => <MetricCardSkeleton key={i} />)
+ ? range(numSkeletons).map((i) => <AnalyticsMetricCard key={i} title={null} loading />)
: items.map((item) => (
<MetricCardCell
key={item.key}
@@ -84,50 +84,25 @@ function MetricCardCell({
const format = (n: number): string => formatItem(n, item.kind, { currency: baseCurrency })
const subtitle = item.previous != null ? `vs. ${format(item.previous)} prior` : item.caption
- const clickable = !!item.onClick
- const handleClick = clickable
- ? (event: React.MouseEvent) => {
- event.stopPropagation()
- item.onClick?.()
- }
- : undefined
- const handleKeyDown = clickable
- ? (event: React.KeyboardEvent) => {
- if (event.key === 'Enter' || event.key === ' ') {
- event.preventDefault()
- item.onClick?.()
- }
- }
- : undefined
-
return (
- <div
- className={clsx(
- 'relative flex flex-col rounded border bg-surface-primary p-3 transition-colors',
- item.selected && 'border-accent ring-1 ring-accent',
- clickable && 'cursor-pointer hover:border-accent'
- )}
- onClick={handleClick}
- onKeyDown={handleKeyDown}
- role={clickable ? 'button' : undefined}
- tabIndex={clickable ? 0 : undefined}
- aria-pressed={clickable ? !!item.selected : undefined}
- >
- {preComputeStrategy === WebAnalyticsPreComputeStrategy.LazyPrecompute ? (
- <PreAggregatedBadge variant="precomputed" position="bottom-right" onDisable={onDisablePrecompute} />
- ) : preComputeStrategy === WebAnalyticsPreComputeStrategy.PreAggregated ? (
- <PreAggregatedBadge variant="preagg" position="bottom-right" />
- ) : null}
- <MetricCard
- className={stretch ? 'h-full [&>div:first-child]:flex-1' : undefined}
- title={<MetricCardTitle label={labelFromKey(item.key)} item={item} />}
- value={item.value}
- change={metricChange(item)}
- goodDirection={item.isIncreaseBad ? 'down' : 'up'}
- formatValue={format}
- subtitle={subtitle}
- />
- </div>
+ <AnalyticsMetricCard
+ className={stretch ? 'h-full' : undefined}
+ title={<MetricCardTitle label={labelFromKey(item.key)} item={item} />}
+ onClick={item.onClick}
+ selected={item.selected}
+ value={item.value}
+ change={metricChange(item)}
+ goodDirection={item.isIncreaseBad ? 'down' : 'up'}
+ formatValue={format}
+ subtitle={subtitle}
+ adornment={
+ preComputeStrategy === WebAnalyticsPreComputeStrategy.LazyPrecompute ? (
+ <PreAggregatedBadge variant="precomputed" position="bottom-right" onDisable={onDisablePrecompute} />
+ ) : preComputeStrategy === WebAnalyticsPreComputeStrategy.PreAggregated ? (
+ <PreAggregatedBadge variant="preagg" position="bottom-right" />
+ ) : undefined
+ }
+ />
)
}
@@ -170,13 +145,3 @@ function metricChange(item: OverviewMetricCardItem): MetricChange | null {
}
return { value: item.changeFromPreviousPct }
}
-
-function MetricCardSkeleton(): JSX.Element {
- return (
- <div className="flex flex-col gap-2 rounded border bg-surface-primary p-3">
- <LemonSkeleton className="h-3 w-16" />
- <LemonSkeleton className="h-9 w-24" />
- <LemonSkeleton className="h-3 w-20" />
- </div>
- )
-}
diff --git a/frontend/src/scenes/dashboard/NewDashboardModal.test.tsx b/frontend/src/scenes/dashboard/NewDashboardModal.test.tsx
index 35349861091d..e56362e1a49b 100644
--- a/frontend/src/scenes/dashboard/NewDashboardModal.test.tsx
+++ b/frontend/src/scenes/dashboard/NewDashboardModal.test.tsx
@@ -1,6 +1,6 @@
import '@testing-library/jest-dom'
-import { cleanup, render } from '@testing-library/react'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { useActions, useMountedLogic, useValues } from 'kea'
import { type ReactNode } from 'react'
@@ -43,7 +43,9 @@ jest.mock('scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic',
})
jest.mock('./dashboards/templates/DashboardTemplateChooser', () => ({
- DashboardTemplateChooser: () => <div data-attr="dashboard-template-chooser" />,
+ DashboardTemplateChooser: ({ redirectAfterCreation }: { redirectAfterCreation?: boolean }) => (
+ <div data-attr="dashboard-template-chooser" data-redirect-after-creation={String(redirectAfterCreation)} />
+ ),
}))
jest.mock('./DashboardTemplateVariables', () => ({
@@ -109,11 +111,13 @@ const Z_INDEX_CLASS = 'z-[calc(var(--z-popover)-1)]'
describe('NewDashboardModal', () => {
let newDashboardValues: Record<string, unknown>
+ let createDashboardFromTemplate: jest.Mock
beforeEach(() => {
jest.clearAllMocks()
mockedUseValues.mockReset()
mockedUseActions.mockReset()
+ createDashboardFromTemplate = jest.fn()
newDashboardValues = {
newDashboardModalVisible: true,
@@ -169,7 +173,7 @@ describe('NewDashboardModal', () => {
return {
hideNewDashboardModal: jest.fn(),
clearActiveDashboardTemplate: jest.fn(),
- createDashboardFromTemplate: jest.fn(),
+ createDashboardFromTemplate,
}
}
@@ -219,4 +223,27 @@ describe('NewDashboardModal', () => {
expectDialogStacking()
expect(document.querySelector('[data-attr="dashboard-template-chooser"]')).toBeInTheDocument()
})
+
+ it('keeps the user on the current page when creating a Home dashboard from a template', () => {
+ render(<NewDashboardModal redirectAfterCreation={false} />)
+
+ fireEvent.click(screen.getByText('Create'))
+
+ expect(createDashboardFromTemplate).toHaveBeenCalledWith(newDashboardValues.activeDashboardTemplate, [], false)
+ })
+
+ it('passes the Home redirect behavior to the template chooser', () => {
+ newDashboardValues = {
+ newDashboardModalVisible: true,
+ activeDashboardTemplate: null,
+ variableSelectModalVisible: false,
+ }
+
+ render(<NewDashboardModal redirectAfterCreation={false} />)
+
+ expect(document.querySelector('[data-attr="dashboard-template-chooser"]')).toHaveAttribute(
+ 'data-redirect-after-creation',
+ 'false'
+ )
+ })
})
diff --git a/frontend/src/scenes/dashboard/NewDashboardModal.tsx b/frontend/src/scenes/dashboard/NewDashboardModal.tsx
index 6797ce92cc81..5a3a3d636581 100644
--- a/frontend/src/scenes/dashboard/NewDashboardModal.tsx
+++ b/frontend/src/scenes/dashboard/NewDashboardModal.tsx
@@ -15,11 +15,11 @@ import { DashboardTemplateChooser } from './dashboards/templates/DashboardTempla
import { DashboardTemplateVariables } from './DashboardTemplateVariables'
import { dashboardTemplateVariablesLogic } from './dashboardTemplateVariablesLogic'
-export function NewDashboardModal(): JSX.Element {
+export function NewDashboardModal({ redirectAfterCreation = true }: { redirectAfterCreation?: boolean }): JSX.Element {
const builtLogic = useMountedLogic(newDashboardLogic)
const { hideNewDashboardModal, clearActiveDashboardTemplate, createDashboardFromTemplate } =
useActions(newDashboardLogic)
- const { newDashboardModalVisible, activeDashboardTemplate, variableSelectModalVisible } =
+ const { newDashboardModalVisible, activeDashboardTemplate, variableSelectModalVisible, isLoading } =
useValues(newDashboardLogic)
const { variables } = useValues(dashboardTemplateVariablesLogic)
@@ -34,8 +34,9 @@ export function NewDashboardModal(): JSX.Element {
dashboardTemplateChooserLogic({
scope: templateScope,
availabilityContexts: undefined,
+ redirectAfterCreation,
}),
- [templateScope]
+ [redirectAfterCreation, templateScope]
)
const { isLoading: blankDashboardLoading } = useValues(createChooserLogic)
const { blankTileClicked } = useActions(createChooserLogic)
@@ -105,7 +106,7 @@ export function NewDashboardModal(): JSX.Element {
{activeDashboardTemplate ? (
<DashboardTemplateVariables />
) : (
- <DashboardTemplateChooser scope={templateScope} />
+ <DashboardTemplateChooser scope={templateScope} redirectAfterCreation={redirectAfterCreation} />
)}
</div>
</div>
@@ -120,9 +121,13 @@ export function NewDashboardModal(): JSX.Element {
)}
<LemonButton
onClick={() => {
- activeDashboardTemplate && createDashboardFromTemplate(activeDashboardTemplate, variables)
+ if (activeDashboardTemplate) {
+ createDashboardFromTemplate(activeDashboardTemplate, variables, redirectAfterCreation)
+ }
}}
type="primary"
+ loading={isLoading}
+ disabled={isLoading}
>
Create
</LemonButton>
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.test.ts b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
index 83678add18f3..445cbcdf9587 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.test.ts
+++ b/frontend/src/scenes/dashboard/dashboardLogic.test.ts
@@ -328,6 +328,13 @@ describe('dashboardLogic', () => {
})
describe('malformed dashboard id', () => {
+ it('mounts and reports not found when id props are omitted during a scene transition', async () => {
+ const invalidLogic = dashboardLogic.build()
+ invalidLogic.mount()
+
+ await expectLogic(invalidLogic).toMatchValues({ error404: true, hasInvalidDashboardId: true })
+ })
+
it.each([
['NaN', NaN],
['undefined', undefined as unknown as number],
diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsx
index fdc18e7547c2..5990a1e18be3 100644
--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx
+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx
@@ -1387,7 +1387,7 @@ export const dashboardLogic = kea<dashboardLogicType>([
logic: [dashboardsModel, insightsModel, eventUsageLogic, addInsightToDashboardLogic],
})),
- props({} as DashboardLogicProps),
+ props({ id: NaN } as DashboardLogicProps),
key((props) => {
if (!Number.isFinite(props.id)) {
diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts
index 90806fda1fd9..2aa03c259f80 100644
--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts
+++ b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateChooserLogic.ts
@@ -131,7 +131,7 @@ export const dashboardTemplateChooserLogic = kea<dashboardTemplateChooserLogicTy
props({} as DashboardTemplateChooserLogicProps),
key(
(p: DashboardTemplateChooserLogicProps) =>
- `${p.scope ?? 'default'}|${availabilityContextsKey(p.availabilityContexts)}`
+ `${p.scope ?? 'default'}|${availabilityContextsKey(p.availabilityContexts)}|${p.redirectAfterCreation ?? true}`
),
connect((props: DashboardTemplateChooserLogicProps) => ({
values: [
@@ -264,6 +264,7 @@ export const dashboardTemplateChooserLogic = kea<dashboardTemplateChooserLogicTy
})
runBlankDashboardFlow({
isLoading: values.isLoading,
+ redirectAfterCreation: props.redirectAfterCreation,
setIsLoading: actions.setIsLoading,
addDashboard: actions.addDashboard,
})
diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows.test.ts b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows.test.ts
new file mode 100644
index 000000000000..e7e13a3e6157
--- /dev/null
+++ b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows.test.ts
@@ -0,0 +1,71 @@
+import { initKeaTests } from '~/test/init'
+import type { DashboardTemplateType } from '~/types'
+
+import { dashboardTemplateChooserLogic } from './dashboardTemplateChooserLogic'
+import { runBlankDashboardFlow, runDashboardTemplateClickFlow } from './dashboardTemplateCreationFlows'
+
+describe('dashboard template creation flows', () => {
+ it('passes the Home navigation choice when creating a template without variables', () => {
+ const template = { id: 7, template_name: 'Starter', variables: [] } as unknown as DashboardTemplateType
+ const createDashboardFromTemplate = jest.fn()
+
+ runDashboardTemplateClickFlow(template, {
+ isLoading: false,
+ newDashboardModalVisible: false,
+ redirectAfterCreation: false,
+ setIsLoading: jest.fn(),
+ createDashboardFromTemplate,
+ showVariableSelectModal: jest.fn(),
+ setActiveDashboardTemplate: jest.fn(),
+ })
+
+ expect(createDashboardFromTemplate).toHaveBeenCalledWith(template, [], false)
+ })
+
+ it('creates a blank Home dashboard without navigating away', () => {
+ const addDashboard = jest.fn()
+
+ runBlankDashboardFlow({
+ isLoading: false,
+ redirectAfterCreation: false,
+ setIsLoading: jest.fn(),
+ addDashboard,
+ })
+
+ expect(addDashboard).toHaveBeenCalledWith(expect.objectContaining({ show: false }))
+ })
+
+ it('keeps Home and ordinary dashboard creation in separate chooser instances', () => {
+ initKeaTests()
+
+ const homeChooser = dashboardTemplateChooserLogic({ scope: 'default', redirectAfterCreation: false })
+ const ordinaryChooser = dashboardTemplateChooserLogic({ scope: 'default' })
+
+ expect(ordinaryChooser).not.toBe(homeChooser)
+ expect(ordinaryChooser).toBe(dashboardTemplateChooserLogic({ scope: 'default', redirectAfterCreation: true }))
+ expect(homeChooser.props.redirectAfterCreation).toBe(false)
+ expect(ordinaryChooser.props.redirectAfterCreation).toBe(true)
+
+ const addDashboard = jest.fn()
+ runBlankDashboardFlow({
+ isLoading: false,
+ redirectAfterCreation: ordinaryChooser.props.redirectAfterCreation,
+ setIsLoading: jest.fn(),
+ addDashboard,
+ })
+ expect(addDashboard).toHaveBeenCalledWith(expect.objectContaining({ show: true }))
+
+ const template = { id: 8, template_name: 'Starter', variables: [] } as unknown as DashboardTemplateType
+ const createDashboardFromTemplate = jest.fn()
+ runDashboardTemplateClickFlow(template, {
+ isLoading: false,
+ newDashboardModalVisible: false,
+ redirectAfterCreation: ordinaryChooser.props.redirectAfterCreation ?? true,
+ setIsLoading: jest.fn(),
+ createDashboardFromTemplate,
+ showVariableSelectModal: jest.fn(),
+ setActiveDashboardTemplate: jest.fn(),
+ })
+ expect(createDashboardFromTemplate).toHaveBeenCalledWith(template, [], true)
+ })
+})
diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows.ts b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows.ts
index 3d2431dfd827..85f41bb7662d 100644
--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows.ts
+++ b/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows.ts
@@ -27,7 +27,6 @@ export function runDashboardTemplateClickFlow(
if (ctx.isLoading) {
return
}
- ctx.setIsLoading(true)
const variables = template.variables ?? []
if (variables.length === 0) {
ctx.createDashboardFromTemplate(template, variables, ctx.redirectAfterCreation)
@@ -46,14 +45,16 @@ export type BlankDashboardFlowActions = {
addDashboard: (form: Partial<NewDashboardForm>) => void
}
-export function runBlankDashboardFlow(ctx: { isLoading: boolean } & BlankDashboardFlowActions): void {
+export function runBlankDashboardFlow(
+ ctx: { isLoading: boolean; redirectAfterCreation?: boolean } & BlankDashboardFlowActions
+): void {
if (ctx.isLoading) {
return
}
ctx.setIsLoading(true)
ctx.addDashboard({
name: 'New Dashboard',
- show: true,
+ show: ctx.redirectAfterCreation ?? true,
_create_in_folder: UNFILED_DASHBOARDS_FOLDER,
})
}
diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.test.tsx b/frontend/src/scenes/dashboard/newDashboardLogic.test.tsx
index 5e5ea22233ac..d7196d62d05a 100644
--- a/frontend/src/scenes/dashboard/newDashboardLogic.test.tsx
+++ b/frontend/src/scenes/dashboard/newDashboardLogic.test.tsx
@@ -1,6 +1,16 @@
+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'
+
+import { expectLogic } from 'kea-test-utils'
+
+import { teamLogic } from 'scenes/teamLogic'
+
+import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
+import { useMocks } from '~/mocks/jest'
import { NodeKind } from '~/queries/schema/schema-general'
+import { initKeaTests } from '~/test/init'
+import { DashboardTemplateType, DashboardType, SidePanelTab } from '~/types'
-import { applyTemplate } from './newDashboardLogic'
+import { applyTemplate, newDashboardLogic } from './newDashboardLogic'
describe('template function in newDashboardLogic', () => {
it('ignores unused variables', () => {
@@ -130,3 +140,194 @@ describe('template function in newDashboardLogic', () => {
})
})
})
+
+describe('Home dashboard creation', () => {
+ let templateCreateRequestCount: number
+
+ beforeEach(() => {
+ templateCreateRequestCount = 0
+ useMocks({
+ patch: {
+ '/api/environments/:team': async ({ request }) => {
+ const data = (await request.json()) as Record<string, unknown>
+ return [200, { ...MOCK_DEFAULT_TEAM, ...data }]
+ },
+ },
+ post: {
+ '/api/environments/:team/dashboards/': [201, { id: 123, name: 'My product analytics dashboard' }],
+ '/api/environments/:team/dashboards/create_from_template_json/': async () => {
+ templateCreateRequestCount += 1
+ return [201, { id: 456, name: 'Product analytics starter' }]
+ },
+ },
+ })
+ initKeaTests()
+ teamLogic.mount()
+ sidePanelStateLogic.mount()
+ teamLogic.actions.loadCurrentTeamSuccess(MOCK_DEFAULT_TEAM)
+ })
+
+ it('sets a new blank dashboard as Home for the AI flow', async () => {
+ const logic = newDashboardLogic()
+ logic.mount()
+
+ await expectLogic(logic, () => {
+ logic.actions.setAsHomeTabDashboardAfterCreation(true, true)
+ logic.actions.addDashboard({ name: 'My product analytics dashboard', show: false })
+ })
+ .toDispatchActions(logic, ['submitNewDashboardSuccessWithResult'])
+ .toDispatchActions(teamLogic, ['updateCurrentTeam', 'updateCurrentTeamSuccess'])
+
+ expect(teamLogic.values.currentTeam?.home_tab_dashboard).toBe(123)
+ expect(sidePanelStateLogic.values.selectedTab).toBe(SidePanelTab.Max)
+ expect(sidePanelStateLogic.values.selectedTabOptions).toContain('dashboard ID 123')
+ expect(sidePanelStateLogic.values.selectedTabOptions).toContain('Ask me what I want to track')
+ })
+
+ it('waits for the Home assignment to be saved before opening AI', async () => {
+ let finishPatch: () => void = () => {}
+ const patchBarrier = new Promise<void>((resolve) => {
+ finishPatch = resolve
+ })
+ useMocks({
+ patch: {
+ '/api/environments/:team': async ({ request }) => {
+ await patchBarrier
+ const data = (await request.json()) as Record<string, unknown>
+ return [200, { ...MOCK_DEFAULT_TEAM, ...data }]
+ },
+ },
+ })
+
+ const logic = newDashboardLogic()
+ logic.mount()
+
+ await expectLogic(logic, () => {
+ logic.actions.submitNewDashboardSuccessWithResult({ id: 123 } as DashboardType, undefined, true, true)
+ }).toDispatchActions(teamLogic, ['updateCurrentTeam'])
+
+ expect(sidePanelStateLogic.values.sidePanelOpen).toBe(false)
+ expect(teamLogic.values.currentTeam?.home_tab_dashboard).toBeNull()
+
+ finishPatch()
+ await expectLogic(logic).toDispatchActions(teamLogic, ['updateCurrentTeamSuccess']).toFinishAllListeners()
+
+ expect(teamLogic.values.currentTeam?.home_tab_dashboard).toBe(123)
+ expect(sidePanelStateLogic.values.selectedTab).toBe(SidePanelTab.Max)
+ })
+
+ it('does not open AI when the Home assignment fails', async () => {
+ useMocks({
+ patch: {
+ '/api/environments/:team': [500, { type: 'server_error', detail: 'Unable to save Home' }],
+ },
+ })
+
+ const logic = newDashboardLogic()
+ logic.mount()
+
+ await expectLogic(logic, () => {
+ logic.actions.submitNewDashboardSuccessWithResult({ id: 123 } as DashboardType, undefined, true, true)
+ })
+ .toDispatchActions(teamLogic, ['updateCurrentTeamFailure'])
+ .toFinishAllListeners()
+
+ expect(teamLogic.values.currentTeam?.home_tab_dashboard).toBeNull()
+ expect(sidePanelStateLogic.values.sidePanelOpen).toBe(false)
+ })
+
+ it('sets a dashboard created from a template as Home', async () => {
+ const logic = newDashboardLogic()
+ logic.mount()
+
+ await expectLogic(logic, () => {
+ logic.actions.setAsHomeTabDashboardAfterCreation(true)
+ logic.actions.createDashboardFromTemplate(
+ { id: '7', template_name: 'Product analytics starter', tiles: [] } as DashboardTemplateType,
+ [],
+ false
+ )
+ })
+ .toDispatchActions(logic, ['submitNewDashboardSuccessWithResult'])
+ .toDispatchActions(teamLogic, ['updateCurrentTeam', 'updateCurrentTeamSuccess'])
+
+ expect(teamLogic.values.currentTeam?.home_tab_dashboard).toBe(456)
+ expect(sidePanelStateLogic.values.sidePanelOpen).toBe(false)
+ })
+
+ it('creates a template dashboard once when Create is clicked repeatedly', async () => {
+ const logic = newDashboardLogic()
+ logic.mount()
+ const template = {
+ id: 7,
+ template_name: 'Product analytics starter',
+ tiles: [],
+ } as unknown as DashboardTemplateType
+
+ await expectLogic(logic, () => {
+ logic.actions.createDashboardFromTemplate(template, [], false)
+ logic.actions.createDashboardFromTemplate(template, [], false)
+ }).toFinishAllListeners()
+
+ expect(templateCreateRequestCount).toBe(1)
+ })
+
+ it.each([false, true])('clears Home and AI intent on cancellation (AI: %s)', (openAI) => {
+ const logic = newDashboardLogic()
+ logic.mount()
+
+ logic.actions.setAsHomeTabDashboardAfterCreation(true, openAI)
+ logic.actions.hideNewDashboardModal()
+
+ expect(logic.values.setAsHomeTabDashboardAfterCreation).toBe(false)
+ expect(logic.values.openAIAfterCreation).toBe(false)
+ })
+
+ it('preserves Home and AI intent when retrying failed dashboard creation', async () => {
+ let attempts = 0
+ useMocks({
+ post: {
+ '/api/environments/:team/dashboards/': () => {
+ attempts += 1
+ return attempts === 1
+ ? [500, { type: 'server_error', detail: 'Unable to create dashboard' }]
+ : [201, { id: 123, name: 'My dashboard' }]
+ },
+ },
+ })
+ const logic = newDashboardLogic()
+ logic.mount()
+ logic.actions.setAsHomeTabDashboardAfterCreation(true, true)
+
+ await expectLogic(logic, () => {
+ logic.actions.addDashboard({ name: 'My dashboard', show: false })
+ }).toFinishAllListeners()
+
+ expect(logic.values.isLoading).toBe(false)
+ expect(logic.values.setAsHomeTabDashboardAfterCreation).toBe(true)
+ expect(logic.values.openAIAfterCreation).toBe(true)
+
+ await expectLogic(logic, () => {
+ logic.actions.addDashboard({ name: 'My dashboard', show: false })
+ }).toFinishAllListeners()
+
+ expect(attempts).toBe(2)
+ expect(teamLogic.values.currentTeam?.home_tab_dashboard).toBe(123)
+ expect(sidePanelStateLogic.values.selectedTab).toBe(SidePanelTab.Max)
+ expect(logic.values.setAsHomeTabDashboardAfterCreation).toBe(false)
+ expect(logic.values.openAIAfterCreation).toBe(false)
+ })
+
+ it('leaves Home unchanged after ordinary dashboard creation', async () => {
+ const logic = newDashboardLogic()
+ logic.mount()
+ const dashboard = { id: 456, name: 'Another dashboard' } as DashboardType
+
+ await expectLogic(logic, () => {
+ logic.actions.submitNewDashboardSuccessWithResult(dashboard)
+ }).toFinishAllListeners()
+
+ expect(teamLogic.values.currentTeam?.home_tab_dashboard).toBeNull()
+ expect(sidePanelStateLogic.values.sidePanelOpen).toBe(false)
+ })
+})
diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.ts b/frontend/src/scenes/dashboard/newDashboardLogic.ts
index d4dfdb41e879..39ca2309ddff 100644
--- a/frontend/src/scenes/dashboard/newDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/newDashboardLogic.ts
@@ -20,9 +20,11 @@ import api from 'lib/api'
import { tryShowMCPHint } from 'lib/components/MCPHint/mcpHintLogic'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/types'
+import { autoRunMaxPrompt } from 'scenes/max/maxPrompt'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
+import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { dashboardsModel } from '~/models/dashboardsModel'
import {
legacyEntityToNode,
@@ -38,6 +40,7 @@ import {
DashboardTile,
DashboardType,
JsonType,
+ SidePanelTab,
} from '~/types'
import { WEBSITE_METRICS_METRIC_CARD_TILES } from 'products/dashboards/frontend/websiteMetricsMetricCardTemplate'
@@ -154,7 +157,9 @@ export interface newDashboardLogicValues {
newDashboardTouched: boolean
newDashboardTouches: Record<string, boolean>
newDashboardValidationErrors: DeepPartialMap<NewDashboardForm, ValidationErrorType>
+ openAIAfterCreation: boolean
redirectAfterCreation: boolean
+ setAsHomeTabDashboardAfterCreation: boolean
showNewDashboardErrors: boolean
variableSelectModalVisible: boolean
}
@@ -187,6 +192,13 @@ export interface newDashboardLogicActions {
setActiveDashboardTemplate: (template: DashboardTemplateType) => {
template: DashboardTemplateType
}
+ setAsHomeTabDashboardAfterCreation: (
+ setAsHomeTabDashboard: boolean,
+ openAI?: boolean
+ ) => {
+ openAI: boolean
+ setAsHomeTabDashboard: boolean
+ }
setIsLoading: (isLoading: boolean) => {
isLoading: boolean
}
@@ -230,9 +242,13 @@ export interface newDashboardLogicActions {
}
submitNewDashboardSuccessWithResult: (
result: DashboardType,
- variables?: DashboardTemplateVariableType[]
+ variables?: DashboardTemplateVariableType[],
+ setAsHomeTabDashboard?: boolean,
+ openAI?: boolean
) => {
+ openAI: boolean | undefined
result: DashboardType
+ setAsHomeTabDashboard: boolean | undefined
variables: DashboardTemplateVariableType[] | undefined
}
touchNewDashboardField: (key: string) => {
@@ -268,6 +284,10 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
setActiveDashboardTemplate: (template: DashboardTemplateType) => ({ template }),
clearActiveDashboardTemplate: true,
setRedirectAfterCreation: (redirect: boolean) => ({ redirect }),
+ setAsHomeTabDashboardAfterCreation: (setAsHomeTabDashboard: boolean, openAI: boolean = false) => ({
+ setAsHomeTabDashboard,
+ openAI,
+ }),
createDashboardFromTemplate: (
template: DashboardTemplateType,
variables: DashboardTemplateVariableType[],
@@ -279,10 +299,12 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
redirectAfterCreation,
creationContext,
}),
- submitNewDashboardSuccessWithResult: (result: DashboardType, variables?: DashboardTemplateVariableType[]) => ({
- result,
- variables,
- }),
+ submitNewDashboardSuccessWithResult: (
+ result: DashboardType,
+ variables?: DashboardTemplateVariableType[],
+ setAsHomeTabDashboard?: boolean,
+ openAI?: boolean
+ ) => ({ result, variables, setAsHomeTabDashboard, openAI }),
}),
reducers({
isLoading: [
@@ -324,6 +346,20 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
showNewDashboardModal: () => true,
},
],
+ setAsHomeTabDashboardAfterCreation: [
+ false,
+ {
+ setAsHomeTabDashboardAfterCreation: (_, { setAsHomeTabDashboard }) => setAsHomeTabDashboard,
+ hideNewDashboardModal: () => false,
+ },
+ ],
+ openAIAfterCreation: [
+ false,
+ {
+ setAsHomeTabDashboardAfterCreation: (_, { openAI }) => openAI,
+ hideNewDashboardModal: () => false,
+ },
+ ],
}),
forms(({ actions, props, values }) => ({
newDashboard: {
@@ -338,6 +374,8 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
// `values` afterwards throws `[KEA] Can not find path`, which the catch below
// would mislabel as "Could not create dashboard" even though creation succeeded.
const redirectAfterCreation = values.redirectAfterCreation
+ const setAsHomeTabDashboard = values.setAsHomeTabDashboardAfterCreation
+ const openAI = values.openAIAfterCreation
try {
// nosemgrep: prefer-codegen-api -- Legacy raw API call with a hand-written URL and an unchecked response type. Use dashboardsCreate() from 'products/dashboards/frontend/generated/api' instead.
const result: DashboardType = await api.create(
@@ -354,7 +392,7 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
actions.resetNewDashboard()
const queryBasedDashboard = getQueryBasedDashboard(result)
queryBasedDashboard && dashboardsModel.actions.addDashboardSuccess(queryBasedDashboard)
- actions.submitNewDashboardSuccessWithResult(result)
+ actions.submitNewDashboardSuccessWithResult(result, undefined, setAsHomeTabDashboard, openAI)
tryShowMCPHint('dashboards.create', {
derivedPrompt: result.name ? `Build a dashboard called ${result.name}` : undefined,
})
@@ -388,62 +426,99 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
actions.clearActiveDashboardTemplate()
actions.resetNewDashboard()
},
- createDashboardFromTemplate: async ({
- template,
- variables,
- redirectAfterCreation = true,
- creationContext = null,
- }) => {
- actions.setIsLoading(true)
- const tiles = makeTilesUsingVariables(
- isMetricTemplate(template) ? WEBSITE_METRICS_METRIC_CARD_TILES : template.tiles,
- variables
- )
- const dashboardJSON = {
- ...template,
- tiles,
+ showVariableSelectModal: ({ template }) => {
+ actions.setActiveDashboardTemplate(template)
+ },
+ submitNewDashboardSuccessWithResult: async ({ result, setAsHomeTabDashboard, openAI }) => {
+ if (setAsHomeTabDashboard) {
+ try {
+ await teamLogic.asyncActions.updateCurrentTeam({ home_tab_dashboard: result.id })
+ // Loader failures finish asyncActions without throwing, so confirm the saved selection.
+ if (teamLogic.values.currentTeam?.home_tab_dashboard !== result.id) {
+ lemonToast.error('Could not set this dashboard as Home. Please try again.')
+ return
+ }
+ } catch {
+ lemonToast.error('Could not set this dashboard as Home. Please try again.')
+ return
+ }
}
+ if (openAI) {
+ sidePanelStateLogic.actions.openSidePanel(
+ SidePanelTab.Max,
+ autoRunMaxPrompt(
+ `Help me build my product analytics Home dashboard (dashboard ID ${result.id}). Ask me what I want to track, then add relevant insights to this dashboard.`
+ )
+ )
+ }
+ },
+ })),
+ listeners(({ actions, values }) => {
+ let templateCreationInFlight = false
- try {
- actions.hideNewDashboardModal()
- // nosemgrep: prefer-codegen-api -- Legacy raw API call with a hand-written URL and an unchecked response type. dashboardsCreateFromTemplateJsonCreate() from 'products/dashboards/frontend/generated/api' serves this route, but its generated types do not describe this call yet, so fix the endpoint's OpenAPI schema first.
- const result: DashboardType = await api.create(
- `api/projects/${teamLogic.values.currentTeamId}/dashboards/create_from_template_json`,
- {
- template: dashboardJSON,
- creation_context: creationContext,
- _create_in_folder: UNFILED_DASHBOARDS_FOLDER,
- }
+ return {
+ createDashboardFromTemplate: async ({
+ template,
+ variables,
+ redirectAfterCreation = true,
+ creationContext = null,
+ }) => {
+ if (templateCreationInFlight) {
+ return
+ }
+ templateCreationInFlight = true
+ actions.setIsLoading(true)
+ const setAsHomeTabDashboard = values.setAsHomeTabDashboardAfterCreation
+ actions.setAsHomeTabDashboardAfterCreation(false)
+ const tiles = makeTilesUsingVariables(
+ isMetricTemplate(template) ? WEBSITE_METRICS_METRIC_CARD_TILES : template.tiles,
+ variables
)
+ const dashboardJSON = {
+ ...template,
+ tiles,
+ }
- actions.resetNewDashboard()
- const queryBasedDashboard = getQueryBasedDashboard(result)
- queryBasedDashboard && dashboardsModel.actions.addDashboardSuccess(queryBasedDashboard)
- actions.submitNewDashboardSuccessWithResult(result, variables)
+ try {
+ actions.hideNewDashboardModal()
+ // nosemgrep: prefer-codegen-api -- Legacy raw API call with a hand-written URL and an unchecked response type. dashboardsCreateFromTemplateJsonCreate() from 'products/dashboards/frontend/generated/api' serves this route, but its generated types do not describe this call yet, so fix the endpoint's OpenAPI schema first.
+ const result: DashboardType = await api.create(
+ `api/projects/${teamLogic.values.currentTeamId}/dashboards/create_from_template_json`,
+ {
+ template: dashboardJSON,
+ creation_context: creationContext,
+ _create_in_folder: UNFILED_DASHBOARDS_FOLDER,
+ }
+ )
- posthog.capture('dashboard created from template', {
- dashboard_id: result.id,
- template_id: template.id,
- template_name: template.template_name,
- template_variable_count: variables.length,
- template_scope: template.scope ?? null,
- })
+ actions.resetNewDashboard()
+ const queryBasedDashboard = getQueryBasedDashboard(result)
+ queryBasedDashboard && dashboardsModel.actions.addDashboardSuccess(queryBasedDashboard)
+ actions.submitNewDashboardSuccessWithResult(result, variables, setAsHomeTabDashboard)
- if (redirectAfterCreation) {
- router.actions.push(urls.dashboard(result.id))
- }
- } catch (e: any) {
- if (!isBreakpoint(e)) {
- const message = e.code && e.detail ? `${e.code}: ${e.detail}` : e
- lemonToast.error(`Could not create dashboard: ${message}`)
+ posthog.capture('dashboard created from template', {
+ dashboard_id: result.id,
+ template_id: template.id,
+ template_name: template.template_name,
+ template_variable_count: variables.length,
+ template_scope: template.scope ?? null,
+ })
+
+ if (redirectAfterCreation) {
+ router.actions.push(urls.dashboard(result.id))
+ }
+ } catch (e: any) {
+ if (!isBreakpoint(e)) {
+ const message = e.code && e.detail ? `${e.code}: ${e.detail}` : e
+ lemonToast.error(`Could not create dashboard: ${message}`)
+ }
+ } finally {
+ templateCreationInFlight = false
+ actions.setIsLoading(false)
}
- }
- actions.setIsLoading(false)
- },
- showVariableSelectModal: ({ template }) => {
- actions.setActiveDashboardTemplate(template)
- },
- })),
+ },
+ }
+ }),
urlToAction(({ actions }) => ({
'/dashboard': (_, _searchParams, hashParams) => {
if ('newDashboard' in hashParams) {
diff --git a/frontend/src/scenes/insights/InsightAsScene.tsx b/frontend/src/scenes/insights/InsightAsScene.tsx
index 187c2d791ea5..b374a43735f6 100644
--- a/frontend/src/scenes/insights/InsightAsScene.tsx
+++ b/frontend/src/scenes/insights/InsightAsScene.tsx
@@ -14,6 +14,8 @@ import { Node } from '~/queries/schema/schema-general'
import { containsHogQLQuery, isBIVisualizationNode, isDataVisualizationNode, isInsightVizNode } from '~/queries/utils'
import { InsightShortId, ItemMode } from '~/types'
+import { InsightHomeGuide } from 'products/product_analytics/frontend/insights/home/InsightHomeGuide'
+
import { teamLogic } from '../teamLogic'
import { InsightRetentionBanner } from './dataRetention/InsightRetentionBanner'
import { insightDataLogic } from './insightDataLogic'
@@ -91,6 +93,8 @@ export function InsightAsScene({ insightId, attachTo }: InsightAsSceneProps): JS
<InsightSceneHeader insightLogicProps={insightProps} />
)}
+ {insightId === 'new' && isEditing && <InsightHomeGuide query={query} />}
+
<InsightRetentionBanner insightProps={insightProps} />
{!isBIVisualizationNode(query) && <InsightQueryScanBanner insightProps={insightProps} />}
diff --git a/frontend/src/scenes/saved-insights/ActiveUsers.tsx b/frontend/src/scenes/saved-insights/ActiveUsers.tsx
deleted file mode 100644
index d4106e5a9a0e..000000000000
--- a/frontend/src/scenes/saved-insights/ActiveUsers.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { useActions, useValues } from 'kea'
-
-import { IconInfo } from '@posthog/icons'
-
-import { CompactList } from 'lib/components/CompactList/CompactList'
-import { Tooltip } from 'lib/lemon-ui/Tooltip'
-import { urls } from 'scenes/urls'
-
-import { ActivePersonType, activeUsersLogic } from './activeUsersLogic'
-import { PersonRow } from './PersonRow'
-
-export function ActiveUsers(): JSX.Element {
- const { persons, personsLoading, personsLoadedError } = useValues(activeUsersLogic)
- const { loadPersons } = useActions(activeUsersLogic)
-
- return (
- <CompactList
- title={
- <div className="flex items-center gap-1">
- Most active users
- <Tooltip title="Users with the most events in the last 7 days. For large data volumes, PostHog uses an event sample.">
- <IconInfo className="text-muted text-base" />
- </Tooltip>
- </div>
- }
- viewAllURL={urls.persons()}
- viewAllDataAttr="insights-home-tab-active-users-view-all"
- loading={personsLoading}
- error={personsLoadedError}
- errorMessage={{
- title: "Couldn't load active users",
- description: 'Something went wrong loading this list.',
- buttonText: 'Retry',
- buttonOnClick: loadPersons,
- }}
- emptyMessage={{
- title: 'No active people',
- description: 'People who have been active in your product will appear here.',
- buttonText: 'View all people',
- buttonTo: urls.persons(),
- }}
- items={persons.slice(0, 5)}
- renderRow={(person: ActivePersonType) => <PersonRow key={person.id} person={person} />}
- contentHeightBehavior="fit-content"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/Activity.tsx b/frontend/src/scenes/saved-insights/Activity.tsx
deleted file mode 100644
index 70f50a52f6e3..000000000000
--- a/frontend/src/scenes/saved-insights/Activity.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import { useValues } from 'kea'
-
-import { ActivityLogLogicProps, activityLogLogic } from 'lib/components/ActivityLog/activityLogLogic'
-import { ActivityLogRow } from 'lib/components/ActivityLog/ActivityLogRow'
-import { HumanizedActivityLogItem } from 'lib/components/ActivityLog/humanizeActivity'
-import { CompactList } from 'lib/components/CompactList/CompactList'
-import { urls } from 'scenes/urls'
-
-import { ActivityScope, SavedInsightsTabs } from '~/types'
-
-const ACTIVITY_LIMIT = 5
-
-export function Activity(): JSX.Element {
- const logic = activityLogLogic({ scope: ActivityScope.INSIGHT } satisfies ActivityLogLogicProps)
- const { humanizedActivity, activityLoading } = useValues(logic)
-
- return (
- <CompactList
- title="Activity"
- viewAllURL={urls.savedInsights(SavedInsightsTabs.History)}
- viewAllDataAttr="insights-home-tab-activity-view-all"
- loading={activityLoading}
- emptyMessage={{
- title: 'No activity yet',
- description: 'Activity on insights will appear here.',
- buttonText: 'View all activity',
- buttonTo: urls.savedInsights(SavedInsightsTabs.History),
- }}
- items={humanizedActivity.slice(0, ACTIVITY_LIMIT)}
- renderRow={(logItem: HumanizedActivityLogItem, index) => (
- <div key={index} className="mb-2 last:mb-0" data-attr="activity-log-item">
- <ActivityLogRow logItem={logItem} />
- </div>
- )}
- contentHeightBehavior="fit-content"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/AlertRow.tsx b/frontend/src/scenes/saved-insights/AlertRow.tsx
deleted file mode 100644
index 6f66989a72dc..000000000000
--- a/frontend/src/scenes/saved-insights/AlertRow.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { TZLabel } from 'lib/components/TZLabel'
-import { urls } from 'scenes/urls'
-
-import { AlertType } from 'products/alerts/frontend/types'
-
-import { ProjectHomePageCompactListItem } from '../project-homepage/ProjectHomePageCompactListItem'
-
-export function AlertRow({ alert }: { alert: AlertType }): JSX.Element {
- return (
- <ProjectHomePageCompactListItem
- title={alert.name}
- subtitle={
- alert.last_checked_at ? (
- <div className="flex items-center gap-1">
- {alert.last_value !== undefined && (
- <>
- <span className="font-medium">Value: {alert.last_value}</span>
- <span>•</span>
- </>
- )}
- <span>
- Last checked <TZLabel time={alert.last_checked_at} />
- </span>
- </div>
- ) : (
- 'Not yet checked'
- )
- }
- to={urls.alert(alert.id)}
- dataAttr="firing-alert-item"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/EventRow.tsx b/frontend/src/scenes/saved-insights/EventRow.tsx
deleted file mode 100644
index 431962cfbd88..000000000000
--- a/frontend/src/scenes/saved-insights/EventRow.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { dayjs } from 'lib/dayjs'
-import { eventToIcon } from 'scenes/session-recordings/player/inspector/components/PlayerInspectorListItem'
-import { urls } from 'scenes/urls'
-
-import { EventDefinition } from '~/types'
-
-import { ProjectHomePageCompactListItem } from '../project-homepage/ProjectHomePageCompactListItem'
-
-export function EventRow({ event }: { event: EventDefinition }): JSX.Element {
- const subtitle = event.created_at
- ? `Created ${dayjs(event.created_at).fromNow()}`
- : event.last_seen_at
- ? `Last seen ${dayjs(event.last_seen_at).fromNow()}`
- : 'Recently added'
- const EventIcon = eventToIcon(event.name)
-
- return (
- <ProjectHomePageCompactListItem
- to={urls.eventDefinition(event.id)}
- title={event.name}
- subtitle={subtitle}
- prefix={<EventIcon className="text-lg" />}
- dataAttr="new-event-item"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/FiringAlerts.tsx b/frontend/src/scenes/saved-insights/FiringAlerts.tsx
deleted file mode 100644
index bbfeb85680c4..000000000000
--- a/frontend/src/scenes/saved-insights/FiringAlerts.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useValues } from 'kea'
-
-import { CompactList } from 'lib/components/CompactList/CompactList'
-import { urls } from 'scenes/urls'
-
-import { AlertState } from '~/queries/schema/schema-general'
-import { SavedInsightsTabs } from '~/types'
-
-import { alertsLogic } from 'products/alerts/frontend/logic/alertsLogic'
-import { AlertType } from 'products/alerts/frontend/types'
-
-import { AlertRow } from './AlertRow'
-
-export function FiringAlerts(): JSX.Element {
- const { alerts, alertsResponseLoading } = useValues(alertsLogic)
- const firingAlerts = alerts.filter((alert) => alert.state === AlertState.FIRING && alert.enabled)
-
- return (
- <CompactList
- title="Firing alerts"
- viewAllURL={urls.savedInsights(SavedInsightsTabs.Alerts)}
- viewAllDataAttr="insights-home-tab-firing-alerts-view-all"
- loading={alertsResponseLoading}
- emptyMessage={{
- title: 'No alerts are firing',
- description: 'PostHog will show active alerts here.',
- buttonText: 'View all alerts',
- buttonTo: urls.savedInsights(SavedInsightsTabs.Alerts),
- buttonDataAttr: 'firing-alerts-empty-view-all',
- }}
- items={firingAlerts.slice(0, 5)}
- renderRow={(alert: AlertType) => <AlertRow key={alert.id} alert={alert} />}
- contentHeightBehavior="fit-content"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/HomeTab.test.tsx b/frontend/src/scenes/saved-insights/HomeTab.test.tsx
new file mode 100644
index 000000000000..80e47ab39158
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTab.test.tsx
@@ -0,0 +1,65 @@
+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'
+
+import '@testing-library/jest-dom'
+
+import { cleanup, render, screen } from '@testing-library/react'
+
+import { teamLogic } from 'scenes/teamLogic'
+
+import { initKeaTests } from '~/test/init'
+
+import { HomeTab } from './HomeTab'
+
+jest.mock('./HomeTabDefault', () => ({
+ HomeTabDefault: () => <div>PostHog Home</div>,
+}))
+jest.mock('scenes/dashboard/Dashboard', () => ({
+ Dashboard: ({ id }: { id: string }) => <div>Home dashboard {id}</div>,
+}))
+
+describe('HomeTab', () => {
+ afterEach(cleanup)
+
+ it.each([
+ ['the opinionated Home dashboard', null, 'PostHog Home'],
+ ['a selected Home dashboard', 42, 'Home dashboard 42'],
+ ])('renders %s', (_scenario, existingDashboardId, expectedContent) => {
+ initKeaTests()
+ teamLogic.mount()
+ teamLogic.actions.loadCurrentTeamSuccess({
+ ...MOCK_DEFAULT_TEAM,
+ home_tab_dashboard: existingDashboardId,
+ })
+
+ render(<HomeTab />)
+ expect(screen.getByText(expectedContent)).toBeInTheDocument()
+ })
+
+ it('keeps the selected dashboard visible while team data refreshes', () => {
+ initKeaTests()
+ teamLogic.mount()
+ teamLogic.actions.loadCurrentTeamSuccess({
+ ...MOCK_DEFAULT_TEAM,
+ home_tab_dashboard: 42,
+ })
+ teamLogic.actions.loadCurrentTeam()
+ expect(teamLogic.values.currentTeamLoading).toBe(true)
+
+ render(<HomeTab />)
+
+ expect(screen.getByText('Home dashboard 42')).toBeInTheDocument()
+ expect(screen.queryByRole('status')).not.toBeInTheDocument()
+ })
+
+ it('shows the initial loading state before a team is available', () => {
+ initKeaTests()
+ teamLogic.mount()
+ teamLogic.actions.loadCurrentTeamSuccess(null)
+ teamLogic.actions.loadCurrentTeam()
+
+ render(<HomeTab />)
+
+ expect(screen.getByLabelText('Loading product analytics Home')).toBeInTheDocument()
+ expect(screen.queryByText('PostHog Home')).not.toBeInTheDocument()
+ })
+})
diff --git a/frontend/src/scenes/saved-insights/HomeTab.tsx b/frontend/src/scenes/saved-insights/HomeTab.tsx
index 3e29a3efd54a..75e98e1b05fd 100644
--- a/frontend/src/scenes/saved-insights/HomeTab.tsx
+++ b/frontend/src/scenes/saved-insights/HomeTab.tsx
@@ -1,33 +1,52 @@
+import { useValues } from 'kea'
import posthog from 'posthog-js'
+import type { ReactNode } from 'react'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
+import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
+import { Dashboard } from 'scenes/dashboard/Dashboard'
+import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'
+import { teamLogic } from 'scenes/teamLogic'
-import { ActiveUsers } from './ActiveUsers'
-import { Activity } from './Activity'
-import { FiringAlerts } from './FiringAlerts'
-import { NewEvents } from './NewEvents'
-import { RecentlyViewed } from './RecentlyViewed'
-import { Trending } from './Trending'
+import { DashboardPlacement } from '~/types'
+
+import { HomeTabDefault } from './HomeTabDefault'
+
+export function HomeTab({ dashboardActions }: { dashboardActions?: ReactNode }): JSX.Element {
+ const { currentTeam, currentTeamLoading } = useValues(teamLogic)
+ const { isLoading: dashboardCreationLoading } = useValues(newDashboardLogic)
-export function HomeTab(): JSX.Element {
useOnMountEffect(() => {
posthog.capture('product analytics home viewed')
})
+ if (!currentTeam && currentTeamLoading) {
+ return (
+ <div className="flex min-h-80 flex-col gap-3 py-3" aria-label="Loading product analytics Home">
+ <LemonSkeleton.Row repeat={3} />
+ </div>
+ )
+ }
+
return (
- <div className="py-4">
- <div className="flex flex-col gap-4 @min-[48rem]/main-content:flex-row @min-[48rem]/main-content:items-start">
- <div className="flex min-w-0 flex-1 flex-col gap-4">
- <RecentlyViewed />
- <FiringAlerts />
- <ActiveUsers />
+ <div className="@container/home-tab pb-4 @min-[48rem]/saved-insights:py-3">
+ {dashboardCreationLoading ? (
+ <div
+ className="flex min-h-80 flex-col gap-3 py-3"
+ role="status"
+ aria-live="polite"
+ aria-label="Creating your Home dashboard"
+ >
+ <div className="font-semibold">Creating your Home dashboard…</div>
+ <LemonSkeleton.Row repeat={3} />
</div>
- <div className="flex min-w-0 flex-1 flex-col gap-4">
- <Trending />
- <NewEvents />
- <Activity />
+ ) : currentTeam?.home_tab_dashboard ? (
+ <div className="-mt-8">
+ <Dashboard id={String(currentTeam.home_tab_dashboard)} placement={DashboardPlacement.Builtin} />
</div>
- </div>
+ ) : (
+ <HomeTabDefault dashboardActions={dashboardActions} />
+ )}
</div>
)
}
diff --git a/frontend/src/scenes/saved-insights/HomeTabChartCard.scss b/frontend/src/scenes/saved-insights/HomeTabChartCard.scss
new file mode 100644
index 000000000000..fa3d298dab79
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTabChartCard.scss
@@ -0,0 +1,33 @@
+.HomeTabChartCard {
+ .HomeTabChartCard__header {
+ min-height: 4.5rem;
+ }
+
+ .HomeTabChartCard__visualization {
+ display: flex;
+ flex: none;
+ flex-direction: column;
+ min-width: 0;
+ padding: 0.5rem;
+
+ .InsightVizDisplay {
+ --insight-viz-min-height: 11rem;
+ }
+
+ .RetentionContainer__graph {
+ min-height: 10rem;
+ }
+ }
+
+ .HomeTabChartCard__visualization--primary {
+ height: 14rem;
+ }
+
+ .HomeTabChartCard__visualization--supporting {
+ height: 21rem;
+ }
+
+ .HomeTabChartCard__visualization--ranking {
+ height: 15rem;
+ }
+}
diff --git a/frontend/src/scenes/saved-insights/HomeTabChartCard.stories.tsx b/frontend/src/scenes/saved-insights/HomeTabChartCard.stories.tsx
new file mode 100644
index 000000000000..c9e330a699fb
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTabChartCard.stories.tsx
@@ -0,0 +1,38 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { mswDecorator } from '~/mocks/browser'
+import trendsLine from '~/mocks/fixtures/api/projects/team_id/insights/trendsLine.json'
+
+import { HomeTabChartCard } from './HomeTabChartCard'
+import { getHomeTabChartOptions } from './homeTabDefaultTiles'
+
+const meta: Meta<typeof HomeTabChartCard> = {
+ component: HomeTabChartCard,
+ title: 'Scenes-App/Product analytics home chart card',
+ parameters: { layout: 'centered' },
+ decorators: [
+ mswDecorator({
+ post: {
+ '/api/environments/:team_id/query/': { results: trendsLine.result },
+ '/api/environments/:team_id/query/:query_kind/': { results: trendsLine.result },
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj<typeof HomeTabChartCard>
+
+export const Primary: Story = {
+ args: {
+ option: getHomeTabChartOptions({ date_from: '-30d' }, true)[0],
+ size: 'primary',
+ source: 'Pageviews and screen views',
+ },
+ render: (args) => (
+ // The chart card gets this width beside a retention card on a laptop.
+ <div className="w-[420px] max-w-full">
+ <HomeTabChartCard {...args} />
+ </div>
+ ),
+}
diff --git a/frontend/src/scenes/saved-insights/HomeTabChartCard.tsx b/frontend/src/scenes/saved-insights/HomeTabChartCard.tsx
new file mode 100644
index 000000000000..1327485e496d
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTabChartCard.tsx
@@ -0,0 +1,57 @@
+import './HomeTabChartCard.scss'
+
+import type { ReactNode } from 'react'
+
+import { IconInfo } from '@posthog/icons'
+import { LemonButton, LemonCard } from '@posthog/lemon-ui'
+
+import { Tooltip } from 'lib/lemon-ui/Tooltip'
+
+import { Query } from '~/queries/Query/Query'
+
+import { getHomeTabExploreUrl, type HomeTabChartOption } from './homeTabDefaultTiles'
+
+interface HomeTabChartCardProps {
+ option: HomeTabChartOption
+ size: 'primary' | 'supporting' | 'ranking'
+ control?: ReactNode
+ source?: string
+}
+
+export function HomeTabChartCard({ option, size, control, source }: HomeTabChartCardProps): JSX.Element {
+ return (
+ <LemonCard hoverEffect={false} className="HomeTabChartCard flex min-w-0 flex-col overflow-hidden p-0">
+ <div className="HomeTabChartCard__header border-b border-primary px-4 py-2.5">
+ <div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1">
+ <div className="flex min-w-0 items-center gap-1">
+ <h3 className="m-0 truncate text-base font-semibold">{option.title}</h3>
+ {source && (
+ <Tooltip title={`Based on ${source}`}>
+ <IconInfo className="shrink-0 text-secondary" />
+ </Tooltip>
+ )}
+ </div>
+ <div className="flex flex-wrap items-center gap-1">
+ {control}
+ <LemonButton
+ type="tertiary"
+ size="small"
+ to={getHomeTabExploreUrl(option.query)}
+ data-attr={`home-tab-explore-${option.key}`}
+ >
+ Explore
+ </LemonButton>
+ </div>
+ </div>
+ <Tooltip title={option.description}>
+ <p className="m-0 mt-0.5 text-xs text-secondary">{option.description}</p>
+ </Tooltip>
+ </div>
+ <div
+ className={`HomeTabDefaultChart HomeTabChartCard__visualization HomeTabChartCard__visualization--${size}`}
+ >
+ <Query query={option.query} readOnly uniqueKey={option.key} />
+ </div>
+ </LemonCard>
+ )
+}
diff --git a/frontend/src/scenes/saved-insights/HomeTabDefault.stories.tsx b/frontend/src/scenes/saved-insights/HomeTabDefault.stories.tsx
new file mode 100644
index 000000000000..7891a5fc89a1
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTabDefault.stories.tsx
@@ -0,0 +1,185 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { mswDecorator } from '~/mocks/browser'
+import trendsBarBreakdown from '~/mocks/fixtures/api/projects/team_id/insights/trendsBarBreakdown.json'
+import trendsLine from '~/mocks/fixtures/api/projects/team_id/insights/trendsLine.json'
+import trendsNumber from '~/mocks/fixtures/api/projects/team_id/insights/trendsNumber.json'
+import { NodeKind } from '~/queries/schema/schema-general'
+import { BaseMathType, ChartDisplayType, PropertyMathType } from '~/types'
+
+import { realisticRetentionResult } from 'products/product_analytics/frontend/insights/retention/shared/retentionStoryFixtures'
+
+import { HomeTabDefault } from './HomeTabDefault'
+
+interface StoryQuery {
+ kind?: NodeKind
+ source?: StoryQuery
+ series?: { math?: string }[]
+ trendsFilter?: { display?: ChartDisplayType }
+ breakdownFilter?: { breakdown?: string }
+}
+
+const statValues: Record<string, number> = {
+ [BaseMathType.UniqueUsers]: 4268,
+ [BaseMathType.UniqueSessions]: 6132,
+ [BaseMathType.FirstTimeForUser]: 1375,
+ [PropertyMathType.Average]: 184,
+}
+
+const trendDays = Array.from({ length: 30 }, (_, index) => {
+ const date = new Date(Date.UTC(2023, 5, 12 + index))
+ return date.toISOString().slice(0, 10)
+})
+const trendData = trendDays.map((_, index) => Math.round(510 + index * 11 + [18, -12, 7, 28, 4, -26, -16][index % 7]))
+
+function rankedResults(names: string[], counts: number[]): unknown[] {
+ return names.map((name, index) => ({
+ ...trendsBarBreakdown.result[0],
+ label: name,
+ breakdown_value: name,
+ count: counts[index],
+ aggregated_value: counts[index],
+ data: [counts[index]],
+ days: [trendDays[trendDays.length - 1]],
+ labels: ['Jul 11'],
+ }))
+}
+
+async function homeQueryMock({ request }: { request: Request }): Promise<[number, { results: unknown[] }]> {
+ const body = (await request.json()) as { query?: StoryQuery }
+ const query = body.query?.source ?? body.query
+
+ if (query?.kind === NodeKind.RetentionQuery) {
+ return [200, { results: realisticRetentionResult }]
+ }
+
+ if (query?.trendsFilter?.display === ChartDisplayType.BoldNumber) {
+ const value = statValues[query.series?.[0]?.math ?? ''] ?? 4268
+ return [
+ 200,
+ {
+ results: [
+ { ...trendsNumber.result[0], aggregated_value: value },
+ { ...trendsNumber.result[0], aggregated_value: Math.round(value * 0.84) },
+ ],
+ },
+ ]
+ }
+
+ if (query?.trendsFilter?.display === ChartDisplayType.WorldMap) {
+ return [
+ 200,
+ {
+ results: rankedResults(
+ ['US', 'GB', 'DE', 'FR', 'IN', 'AU', 'BR', 'CA', 'JP'],
+ [1540, 620, 490, 380, 340, 260, 220, 210, 180]
+ ),
+ },
+ ]
+ }
+ if (query?.trendsFilter?.display === ChartDisplayType.ActionsDonut) {
+ return [200, { results: rankedResults(['Desktop', 'Mobile', 'Tablet'], [3820, 1980, 332]) }]
+ }
+ if (query?.trendsFilter?.display === ChartDisplayType.ActionsBarValue) {
+ if (query.breakdownFilter?.breakdown === '$pathname') {
+ return [
+ 200,
+ {
+ results: rankedResults(
+ ['/', '/pricing', '/docs', '/signup', '/blog'],
+ [4821, 3204, 2450, 1673, 1196]
+ ),
+ },
+ ]
+ }
+ if (query.breakdownFilter?.breakdown === '$screen_name') {
+ return [
+ 200,
+ { results: rankedResults(['Home', 'Explore', 'Settings', 'Profile'], [3320, 2310, 1484, 956]) },
+ ]
+ }
+ return [
+ 200,
+ {
+ results: rankedResults(
+ ['$pageview', '$autocapture', '$screen', 'signup', 'purchase'],
+ [9204, 5432, 3187, 1268, 793]
+ ),
+ },
+ ]
+ }
+
+ const scale =
+ query?.series?.[0]?.math === BaseMathType.UniqueSessions
+ ? 1.45
+ : query?.series?.[0]?.math === BaseMathType.FirstTimeForUser
+ ? 0.4
+ : query?.series?.[0]?.math === PropertyMathType.Average
+ ? 0.3
+ : 1
+ return [
+ 200,
+ {
+ results: [
+ {
+ ...trendsLine.result[0],
+ label: 'Activity',
+ data: trendData.map((value) => Math.round(value * scale)),
+ days: trendDays,
+ labels: trendDays.map((day) => day.slice(5)),
+ count: Math.round(trendData.reduce((sum, value) => sum + value, 0) * scale),
+ },
+ ],
+ },
+ ]
+}
+
+const meta: Meta<typeof HomeTabDefault> = {
+ component: HomeTabDefault,
+ title: 'Scenes-App/Product analytics home overview',
+ parameters: {
+ layout: 'fullscreen',
+ mockDate: '2023-07-11',
+ testOptions: { viewport: { width: 1440, height: 1200 }, waitForLoadersToDisappear: true },
+ },
+ decorators: [
+ mswDecorator({
+ post: {
+ '/api/environments/:team_id/query/': homeQueryMock,
+ '/api/environments/:team_id/query/:query_kind/': homeQueryMock,
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj<typeof HomeTabDefault>
+
+export const Populated: Story = {
+ render: () => (
+ <div className="@container/main-content mx-auto w-full max-w-screen-xl p-4">
+ <HomeTabDefault />
+ </div>
+ ),
+}
+
+export const Narrow: Story = {
+ // A docked side panel leaves roughly 520px for the scene on a laptop.
+ render: () => (
+ <div className="@container/main-content mx-auto w-[520px] max-w-full p-4">
+ <HomeTabDefault />
+ </div>
+ ),
+}
+
+export const Empty: Story = {
+ render: Populated.render,
+ decorators: [
+ mswDecorator({
+ post: {
+ '/api/environments/:team_id/query/': { results: [] },
+ '/api/environments/:team_id/query/:query_kind/': { results: [] },
+ },
+ }),
+ ],
+}
diff --git a/frontend/src/scenes/saved-insights/HomeTabDefault.tsx b/frontend/src/scenes/saved-insights/HomeTabDefault.tsx
new file mode 100644
index 000000000000..91c6bcbec386
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTabDefault.tsx
@@ -0,0 +1,138 @@
+import { useActions, useValues } from 'kea'
+import type { ReactNode } from 'react'
+
+import { IconCalendar } from '@posthog/icons'
+import { LemonSelect } from '@posthog/lemon-ui'
+
+import { CompareFilter } from 'lib/components/CompareFilter/CompareFilter'
+import { DateFilter } from 'lib/components/DateFilter/DateFilter'
+import { CUSTOM_OPTION_KEY } from 'lib/components/DateFilter/types'
+import { dateMapping } from 'lib/utils/dateFilters'
+
+import { HomeTabExplore } from 'products/product_analytics/frontend/insights/home/HomeTabExplore'
+
+import { HomeTabChartCard } from './HomeTabChartCard'
+import { homeTabDefaultLogic } from './homeTabDefaultLogic'
+import { getHomeTabAudienceOptions, getHomeTabBreakdownOptions, getHomeTabChartOptions } from './homeTabDefaultTiles'
+import { HomeTabStatTiles } from './HomeTabStatTiles'
+
+const HOME_DATE_OPTIONS = dateMapping.filter((option) => option.key !== CUSTOM_OPTION_KEY)
+
+export function HomeTabDefault({ dashboardActions }: { dashboardActions?: ReactNode }): JSX.Element {
+ const { dateRange, compare, selectedMetric, selectedContentKey } = useValues(homeTabDefaultLogic)
+ const { setDates, setCompare, setSelectedMetric, setSelectedContentKey } = useActions(homeTabDefaultLogic)
+
+ const metricCharts = getHomeTabChartOptions(dateRange, compare)
+ const audienceCharts = getHomeTabAudienceOptions(dateRange)
+ const breakdownCharts = getHomeTabBreakdownOptions(dateRange)
+ const primaryChart = metricCharts.find((option) => option.key === selectedMetric) ?? metricCharts[0]
+ const retentionChart =
+ metricCharts.find((option) => option.key === 'retention') ?? metricCharts[metricCharts.length - 1]
+ const contentChart = breakdownCharts.find((option) => option.key === selectedContentKey) ?? breakdownCharts[0]
+ const eventsChart =
+ breakdownCharts.find((option) => option.key === 'top_events') ?? breakdownCharts[breakdownCharts.length - 1]
+
+ return (
+ <div className="@container/home-overview flex flex-col gap-4 @max-[32rem]/saved-insights:gap-3">
+ <div className="flex flex-wrap items-center justify-between gap-2 border-b border-primary pb-2 @min-[32rem]/home-overview:pb-3">
+ <div className="flex w-full items-center justify-between gap-2 @min-[48rem]/home-overview:w-auto">
+ <h2 className="m-0 min-w-0 text-lg font-semibold">
+ <span className="hidden @min-[32rem]/home-overview:inline">Product Analytics </span>
+ <span>Overview</span>
+ </h2>
+ <div className="shrink-0 whitespace-nowrap @min-[48rem]/saved-insights:hidden">
+ {dashboardActions}
+ </div>
+ </div>
+ <div className="home-tab-date-controls grid w-full min-w-0 grid-cols-2 gap-2 [&_.LemonButton]:h-full [&_.LemonButton__content]:truncate @max-[32rem]/home-overview:[&_.LemonButton__content]:text-xs @min-[48rem]/home-overview:flex @min-[48rem]/home-overview:w-auto @min-[48rem]/home-overview:flex-wrap">
+ <div className="min-w-0 [&_.LemonButton]:w-full @min-[48rem]/home-overview:[&_.LemonButton]:w-auto">
+ <DateFilter
+ showCustom
+ showExplicitDateToggle
+ dateFrom={dateRange.date_from}
+ dateTo={dateRange.date_to}
+ explicitDate={dateRange.explicitDate ?? false}
+ dateOptions={HOME_DATE_OPTIONS}
+ onChange={setDates}
+ makeLabel={(label) => (
+ <span className="flex items-center gap-1.5">
+ <IconCalendar />
+ <span>{label}</span>
+ </span>
+ )}
+ />
+ </div>
+ <div className="min-w-0 [&_.LemonSelect]:w-full [&_.LemonButton]:w-full @min-[48rem]/home-overview:[&_.LemonSelect]:w-auto @min-[48rem]/home-overview:[&_.LemonButton]:w-auto">
+ <CompareFilter
+ compareFilter={{ compare }}
+ updateCompareFilter={(filter) => setCompare(!!filter.compare)}
+ allowCustomComparison={false}
+ />
+ </div>
+ </div>
+ </div>
+
+ <HomeTabStatTiles
+ dateRange={dateRange}
+ compare={compare}
+ selectedKey={selectedMetric}
+ onSelect={setSelectedMetric}
+ />
+
+ <HomeTabChartCard
+ key={primaryChart.key}
+ option={primaryChart}
+ size="primary"
+ source="Pageviews and screen views"
+ />
+
+ <section className="flex flex-col gap-3" aria-label="What people do">
+ <div className="flex flex-wrap items-baseline justify-between gap-2">
+ <h2 className="m-0 text-base font-semibold">What people do</h2>
+ <span className="text-xs text-secondary">Most common content and events in this period</span>
+ </div>
+ <div className="grid min-w-0 grid-cols-1 gap-3 @min-[44rem]/home-overview:grid-cols-2">
+ <HomeTabChartCard
+ key={contentChart.key}
+ option={contentChart}
+ size="ranking"
+ source={selectedContentKey === 'top_pages' ? 'Pageviews' : 'Screen views'}
+ control={
+ <LemonSelect
+ size="small"
+ value={selectedContentKey}
+ onChange={(value) => value && setSelectedContentKey(value)}
+ options={[
+ { value: 'top_pages', label: 'Pages' },
+ { value: 'top_screens', label: 'Screens' },
+ ]}
+ dropdownMatchSelectWidth={false}
+ data-attr="home-tab-content-chart"
+ />
+ }
+ />
+ <HomeTabChartCard option={eventsChart} size="ranking" source="Captured events" />
+ </div>
+ </section>
+
+ <section className="flex flex-col gap-3" aria-label="Your audience">
+ <h2 className="m-0 text-base font-semibold">Your audience</h2>
+ <div className="grid min-w-0 grid-cols-1 gap-3 @min-[56rem]/home-overview:grid-cols-[2fr_1fr]">
+ {audienceCharts.map((option) => (
+ <HomeTabChartCard
+ key={option.key}
+ option={option}
+ size="supporting"
+ source="Pageviews and screen views"
+ />
+ ))}
+ </div>
+ </section>
+
+ <div className="grid min-w-0 grid-cols-1 gap-3 @min-[44rem]/home-overview:grid-cols-2">
+ <HomeTabChartCard option={retentionChart} size="supporting" source="Pageviews" />
+ <HomeTabExplore />
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/saved-insights/HomeTabStatTile.tsx b/frontend/src/scenes/saved-insights/HomeTabStatTile.tsx
new file mode 100644
index 000000000000..ab2169584e1c
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTabStatTile.tsx
@@ -0,0 +1,70 @@
+import { useValues } from 'kea'
+
+import { AnalyticsMetricCard } from 'lib/components/AnalyticsMetricCard/AnalyticsMetricCard'
+import { Tooltip } from 'lib/lemon-ui/Tooltip'
+
+import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
+import { formatItem } from '~/queries/nodes/OverviewGrid/OverviewGrid'
+import type { TrendsQueryResponse } from '~/queries/schema/schema-general'
+import type { TrendResult } from '~/types'
+
+import { getHomeTabStatValue, type HomeTabStatQuery } from './homeTabDefaultTiles'
+
+interface HomeTabStatTileProps {
+ stat: HomeTabStatQuery
+ compare: boolean
+ selected: boolean
+ onSelect: () => void
+}
+
+export function HomeTabStatTile({ stat, compare, selected, onSelect }: HomeTabStatTileProps): JSX.Element {
+ const key = `HomeTabStatTile.${stat.key}`
+ const { response, responseError, responseLoading } = useValues(
+ dataNodeLogic({ query: stat.query, key, dataNodeCollectionId: key })
+ )
+ const loading = responseLoading || (!response && !responseError)
+
+ const results = (response as TrendsQueryResponse | undefined)?.results ?? (response as { result?: unknown })?.result
+ const current = (results as TrendResult[] | undefined)?.[0]
+ const previous = compare ? (results as TrendResult[] | undefined)?.[1] : undefined
+ const value = getHomeTabStatValue(stat, current)
+ const previousValue = getHomeTabStatValue(stat, previous)
+ const changeFromPreviousPct =
+ value != null && previousValue != null && previousValue !== 0
+ ? ((value - previousValue) / Math.abs(previousValue)) * 100
+ : undefined
+
+ const label =
+ stat.description || stat.key === 'session_duration' ? (
+ <Tooltip title={stat.description ?? 'Average duration of sessions with a page or screen view.'}>
+ {stat.title}
+ </Tooltip>
+ ) : (
+ stat.title
+ )
+
+ const subtitle = !compare
+ ? 'For selected period'
+ : previousValue == null
+ ? 'No previous period data'
+ : `vs. ${formatItem(previousValue, stat.kind)} prior`
+
+ return (
+ <AnalyticsMetricCard
+ className="h-full w-full"
+ title={label}
+ ariaLabel={stat.title}
+ onClick={onSelect}
+ selected={selected}
+ loading={loading}
+ error={responseError ? 'Could not load' : undefined}
+ dataAttr={`home-tab-metric-${stat.key}`}
+ value={value ?? undefined}
+ showChange={compare}
+ change={changeFromPreviousPct ? { value: changeFromPreviousPct } : null}
+ goodDirection="up"
+ formatValue={(statValue) => formatItem(statValue, stat.kind)}
+ subtitle={<span translate="no">{subtitle}</span>}
+ />
+ )
+}
diff --git a/frontend/src/scenes/saved-insights/HomeTabStatTiles.tsx b/frontend/src/scenes/saved-insights/HomeTabStatTiles.tsx
new file mode 100644
index 000000000000..b1ba851c6e57
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/HomeTabStatTiles.tsx
@@ -0,0 +1,34 @@
+import type { DateRange } from '~/queries/schema/schema-general'
+
+import type { HomeTabMetricKey } from './homeTabDefaultLogic'
+import { getHomeTabStatQueries } from './homeTabDefaultTiles'
+import { HomeTabStatTile } from './HomeTabStatTile'
+
+interface HomeTabStatTilesProps {
+ dateRange: DateRange
+ compare: boolean
+ selectedKey: HomeTabMetricKey
+ onSelect: (key: HomeTabMetricKey) => void
+}
+
+export function HomeTabStatTiles({ dateRange, compare, selectedKey, onSelect }: HomeTabStatTilesProps): JSX.Element {
+ const stats = getHomeTabStatQueries(dateRange, compare)
+
+ return (
+ <div className="flex snap-x snap-proximity gap-2 overflow-x-auto pb-1" aria-label="Overview metrics">
+ {stats.map((stat) => (
+ <div
+ key={stat.key}
+ className="w-52 min-w-[10rem] shrink-0 snap-start @min-[60rem]/home-overview:flex-1"
+ >
+ <HomeTabStatTile
+ stat={stat}
+ compare={compare}
+ selected={selectedKey === stat.key}
+ onSelect={() => onSelect(stat.key)}
+ />
+ </div>
+ ))}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/saved-insights/InsightRow.tsx b/frontend/src/scenes/saved-insights/InsightRow.tsx
deleted file mode 100644
index 4446332ea0ca..000000000000
--- a/frontend/src/scenes/saved-insights/InsightRow.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import { useActions } from 'kea'
-
-import { IconChevronRight, IconExternal } from '@posthog/icons'
-
-import { dayjs } from 'lib/dayjs'
-import { LemonButton } from 'lib/lemon-ui/LemonButton'
-import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
-import { Tooltip } from 'lib/lemon-ui/Tooltip'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
-import { urls } from 'scenes/urls'
-
-import { Query } from '~/queries/Query/Query'
-import { InsightModel } from '~/types'
-
-import { InsightIcon } from './InsightIcon'
-
-interface InsightRowProps {
- insight: InsightModel
- isExpanded: boolean
- onToggle: () => void
- dataAttr?: string
-}
-
-export function InsightRow({ insight, isExpanded, onToggle, dataAttr }: InsightRowProps): JSX.Element {
- const { reportInsightOpenedFromRecentInsightList } = useActions(eventUsageLogic)
-
- return (
- <div className="border border-border rounded bg-surface-primary mb-2 last:mb-0" data-attr={dataAttr}>
- <Tooltip
- title={
- insight.view_count !== undefined
- ? `${insight.view_count} ${insight.view_count === 1 ? 'view' : 'views'}`
- : undefined
- }
- placement="left"
- >
- <div
- role="button"
- tabIndex={0}
- aria-expanded={isExpanded}
- className="flex items-center gap-3 p-3 cursor-pointer hover:bg-surface-secondary rounded-t focus-visible:bg-surface-secondary focus-visible:outline-none"
- onClick={onToggle}
- onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.preventDefault()
- onToggle()
- }
- }}
- >
- <div className={`transform transition-transform ${isExpanded ? 'rotate-90' : ''}`}>
- <IconChevronRight className="text-xl" />
- </div>
- <InsightIcon insight={insight} className="text-secondary text-3xl" />
- <div className="flex flex-col flex-1 truncate">
- <span className="font-semibold truncate">
- {insight.name || <i>{insight.derived_name || 'Insight'}</i>}
- </span>
- <span className="text-muted text-xs mt-0.5 truncate">
- {`Last modified ${dayjs(insight.last_modified_at).fromNow()}`}
- </span>
- </div>
- {insight.viewers && insight.viewers.length > 0 && (
- <div className="flex items-center -space-x-2 mr-2">
- {insight.viewers.slice(0, 3).map((viewer, index) => (
- <ProfilePicture
- key={viewer.uuid || index}
- user={viewer}
- size="md"
- showName={false}
- className="border-2 border-surface-primary"
- title={`Viewed by ${viewer.first_name || viewer.email}`}
- />
- ))}
- {insight.viewers.length > 3 && (
- <div
- className="w-6 h-6 rounded-full bg-surface-secondary border-2 border-surface-primary flex items-center justify-center text-xs font-semibold text-muted"
- title={`${insight.viewers.length - 3} more viewers`}
- >
- +{insight.viewers.length - 3}
- </div>
- )}
- </div>
- )}
- <LemonButton
- size="small"
- icon={<IconExternal />}
- to={urls.insightView(insight.short_id)}
- onClick={(e) => {
- e.stopPropagation()
- reportInsightOpenedFromRecentInsightList()
- }}
- tooltip="Open insight"
- />
- </div>
- </Tooltip>
- {isExpanded && (
- <div className="border-t border-border bg-surface-primary">
- <div className="p-4 h-60 relative flex flex-col">
- <Query
- query={insight.query}
- readOnly
- embedded
- context={{ insightProps: { dashboardItemId: insight.short_id as any } }}
- />
- </div>
- <div className="flex justify-end items-center p-3 border-t border-border">
- <LemonButton
- type="primary"
- icon={<IconExternal />}
- to={urls.insightView(insight.short_id)}
- onClick={() => reportInsightOpenedFromRecentInsightList()}
- >
- Open insight
- </LemonButton>
- </div>
- </div>
- )}
- </div>
- )
-}
diff --git a/frontend/src/scenes/saved-insights/NewEvents.tsx b/frontend/src/scenes/saved-insights/NewEvents.tsx
deleted file mode 100644
index 7fb173fb5f9b..000000000000
--- a/frontend/src/scenes/saved-insights/NewEvents.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import { useActions, useValues } from 'kea'
-
-import { IconInfo } from '@posthog/icons'
-
-import { CompactList } from 'lib/components/CompactList/CompactList'
-import { Tooltip } from 'lib/lemon-ui/Tooltip'
-import { urls } from 'scenes/urls'
-
-import { EventDefinition } from '~/types'
-
-import { EventRow } from './EventRow'
-import { newEventsLogic } from './newEventsLogic'
-
-export function NewEvents(): JSX.Element {
- const { newEvents, newEventsLoading, newEventsLoadedError } = useValues(newEventsLogic)
- const { loadNewEvents } = useActions(newEventsLogic)
-
- return (
- <CompactList
- title={
- <div className="flex items-center gap-1">
- New events
- <Tooltip title="Events that PostHog saw for the first time recently.">
- <IconInfo className="text-muted text-base" />
- </Tooltip>
- </div>
- }
- viewAllURL={urls.eventDefinitions()}
- viewAllDataAttr="insights-home-tab-new-events-view-all"
- loading={newEventsLoading}
- error={newEventsLoadedError}
- errorMessage={{
- title: "Couldn't load new events",
- description: 'Something went wrong loading this list.',
- buttonText: 'Retry',
- buttonOnClick: loadNewEvents,
- }}
- emptyMessage={{
- title: 'No events found',
- description: 'Set up event capture to see events here.',
- buttonText: 'View all events',
- buttonTo: urls.eventDefinitions(),
- }}
- items={newEvents.slice(0, 5)}
- renderRow={(event: EventDefinition) => <EventRow key={event.id} event={event} />}
- contentHeightBehavior="fit-content"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/NewInsightMenu.tsx b/frontend/src/scenes/saved-insights/NewInsightMenu.tsx
index a5e12bcd852e..0f5df5423720 100644
--- a/frontend/src/scenes/saved-insights/NewInsightMenu.tsx
+++ b/frontend/src/scenes/saved-insights/NewInsightMenu.tsx
@@ -355,7 +355,7 @@ export function NewInsightMenuOverlay(): JSX.Element {
)
}
-export function NewInsightButton(): JSX.Element {
+export function NewInsightButton({ compact = false }: { compact?: boolean }): JSX.Element {
const button = (
<LemonButton
type="primary"
@@ -363,8 +363,9 @@ export function NewInsightButton(): JSX.Element {
size="small"
icon={<IconPlusSmall />}
tooltip="New insight"
+ aria-label="New insight"
>
- New
+ {compact ? <span className="hidden @min-[32rem]/saved-insights:inline">New</span> : 'New'}
</LemonButton>
)
diff --git a/frontend/src/scenes/saved-insights/PersonRow.tsx b/frontend/src/scenes/saved-insights/PersonRow.tsx
deleted file mode 100644
index 086af6e1b2b8..000000000000
--- a/frontend/src/scenes/saved-insights/PersonRow.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { useActions } from 'kea'
-
-import { dayjs } from 'lib/dayjs'
-import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
-import { urls } from 'scenes/urls'
-
-import { asDisplay, asLink } from 'products/persons/frontend/person-utils'
-
-import { ProjectHomePageCompactListItem } from '../project-homepage/ProjectHomePageCompactListItem'
-import { ActivePersonType } from './activeUsersLogic'
-
-export function PersonRow({ person }: { person: ActivePersonType }): JSX.Element {
- const { reportPersonOpenedFromNewlySeenPersonsList } = useActions(eventUsageLogic)
-
- return (
- <ProjectHomePageCompactListItem
- to={person.uuid ? urls.personByUUID(person.uuid) : asLink(person) || urls.persons()}
- title={asDisplay(person)}
- subtitle={
- <div className="flex items-center gap-1">
- <span className="font-medium">
- {person.activity_count} {person.activity_count === 1 ? 'event' : 'events'}
- </span>
- <span>•</span>
- <span>First seen {dayjs(person.created_at).fromNow()}</span>
- </div>
- }
- prefix={<ProfilePicture name={asDisplay(person)} />}
- onClick={reportPersonOpenedFromNewlySeenPersonsList}
- dataAttr="active-user-item"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/RecentlyViewed.tsx b/frontend/src/scenes/saved-insights/RecentlyViewed.tsx
deleted file mode 100644
index 0238efe3f922..000000000000
--- a/frontend/src/scenes/saved-insights/RecentlyViewed.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { useActions, useValues } from 'kea'
-
-import { CompactList } from 'lib/components/CompactList/CompactList'
-import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
-import { urls } from 'scenes/urls'
-
-import { InsightModel, SavedInsightsTabs } from '~/types'
-
-import { projectHomepageLogic } from '../project-homepage/projectHomepageLogic'
-import { InsightRow } from './InsightRow'
-
-export function RecentlyViewed(): JSX.Element {
- const { recentInsights, recentInsightsLoading, expandedInsightIds } = useValues(projectHomepageLogic)
- const { loadRecentInsights, toggleInsightExpanded } = useActions(projectHomepageLogic)
- useOnMountEffect(loadRecentInsights)
-
- return (
- <CompactList
- title="Recently viewed"
- viewAllURL={urls.savedInsights(SavedInsightsTabs.All)}
- viewAllDataAttr="insights-home-tab-recently-viewed-view-all"
- loading={recentInsightsLoading}
- emptyMessage={{
- title: 'No recently viewed insights',
- description: 'Open an insight to find it here later.',
- buttonText: 'View insights',
- buttonTo: urls.savedInsights(SavedInsightsTabs.All),
- }}
- items={recentInsights.slice(0, 5)}
- renderRow={(insight: InsightModel) => (
- <InsightRow
- key={insight.short_id}
- insight={insight}
- isExpanded={expandedInsightIds.has(insight.short_id)}
- onToggle={() => toggleInsightExpanded(insight.short_id)}
- dataAttr="recently-viewed-insight-item"
- />
- )}
- contentHeightBehavior="fit-content"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/SavedInsights.scss b/frontend/src/scenes/saved-insights/SavedInsights.scss
index e20994996f11..a152c3cde0fc 100644
--- a/frontend/src/scenes/saved-insights/SavedInsights.scss
+++ b/frontend/src/scenes/saved-insights/SavedInsights.scss
@@ -1,6 +1,69 @@
@import '../../styles/mixins';
@import '../../styles/vars';
+@layer utilities {
+ @container home-overview (max-width: 32rem) {
+ .home-tab-date-controls {
+ .LemonButton__chrome > .LemonButton__icon:first-child {
+ display: none !important;
+ }
+
+ .LemonButton__content > span {
+ display: block !important;
+ overflow: hidden;
+ font-size: 0.75rem !important;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ }
+ }
+
+ @container saved-insights (max-width: 32rem) {
+ .saved-insights--home {
+ // The overview already explains the page; keep the narrow header focused on navigation.
+ > div:has(> .scene-description) {
+ display: none !important;
+ }
+
+ [data-attr='toggle-description-button-collapse'],
+ [data-attr='toggle-description-button-expand'] {
+ display: none !important;
+ }
+
+ .scene-title-section {
+ flex-direction: row !important;
+ align-items: center !important;
+ padding-top: 0.5rem !important;
+ padding-bottom: 0 !important;
+ padding-left: 1.5rem !important;
+
+ > :last-child {
+ flex-wrap: nowrap !important;
+ align-self: center !important;
+ order: initial !important;
+ margin-left: 0 !important;
+ }
+ }
+
+ .scene-name h1 {
+ font-size: 1rem !important;
+ }
+
+ > .LemonTabs {
+ margin-top: -0.5rem !important;
+
+ .LemonTabs__bar {
+ scrollbar-width: none;
+
+ &::-webkit-scrollbar {
+ display: none;
+ }
+ }
+ }
+ }
+ }
+}
+
.saved-insights {
.new-insight-dropdown-btn {
height: 40px;
diff --git a/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx b/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx
index 53ad666c03ad..d6c204d363f5 100644
--- a/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx
+++ b/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx
@@ -76,6 +76,22 @@ export const HomeWithBooleanFlag: Story = {
},
}
+export const HomeNarrow: Story = {
+ ...Home,
+ parameters: {
+ ...Home.parameters,
+ testOptions: { viewport: { width: 800, height: 2000 }, waitForLoadersToDisappear: true },
+ },
+}
+
+export const HomePhone: Story = {
+ ...Home,
+ parameters: {
+ ...Home.parameters,
+ testOptions: { viewport: { width: 375, height: 2000 }, waitForLoadersToDisappear: true },
+ },
+}
+
export const EmptyState: Story = {
decorators: [
mswDecorator({
diff --git a/frontend/src/scenes/saved-insights/SavedInsights.tsx b/frontend/src/scenes/saved-insights/SavedInsights.tsx
index 62fa401987a4..e1c8aaf944f6 100644
--- a/frontend/src/scenes/saved-insights/SavedInsights.tsx
+++ b/frontend/src/scenes/saved-insights/SavedInsights.tsx
@@ -3,18 +3,21 @@ import './SavedInsights.scss'
import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
-import { IconHeart, IconHeartFilled, IconTrash } from '@posthog/icons'
+import { IconEllipsis, IconHeart, IconHeartFilled, IconTrash } from '@posthog/icons'
import { AccessControlAction } from 'lib/components/AccessControlAction'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { BulkUpdateTagsButton } from 'lib/components/BulkActions/BulkUpdateTagsButton'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
+import { SceneDashboardChoiceModal } from 'lib/components/SceneDashboardChoice/SceneDashboardChoiceModal'
+import { sceneDashboardChoiceModalLogic } from 'lib/components/SceneDashboardChoice/sceneDashboardChoiceModalLogic'
import { TZLabel } from 'lib/components/TZLabel'
import { dayjs } from 'lib/dayjs'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
+import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { LemonTableLink } from 'lib/lemon-ui/LemonTable/LemonTableLink'
import { LemonTabs } from 'lib/lemon-ui/LemonTabs'
@@ -24,13 +27,18 @@ import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { accessLevelSatisfied } from 'lib/utils/accessControlUtils'
import { cn } from 'lib/utils/css-classes'
import { deleteInsightWithUndo } from 'lib/utils/deleteWithUndo'
+import { UNFILED_DASHBOARDS_FOLDER } from 'scenes/dashboard/dashboardConstants'
+import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'
+import { NewDashboardModal } from 'scenes/dashboard/NewDashboardModal'
import { SavedInsightsEmptyState, SavedInsightsErrorState } from 'scenes/insights/EmptyStates'
import { useSummarizeInsight } from 'scenes/insights/summarizeInsight'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { projectLogic } from 'scenes/projectLogic'
import { NewInsightShortcuts } from 'scenes/saved-insights/newInsightsMenu'
import { SavedInsightsFilters } from 'scenes/saved-insights/SavedInsightsFilters'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
+import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
@@ -39,6 +47,10 @@ import { ProductKey } from '~/queries/schema/schema-general'
import { AccessControlLevel, AccessControlResourceType, ActivityScope, SavedInsightsTabs } from '~/types'
import { productAnalyticsEmptyState } from 'products/product_analytics/frontend/emptyState/productAnalyticsEmptyState'
+import { HomeDashboardStarterModal } from 'products/product_analytics/frontend/insights/home/HomeDashboardStarterModal'
+
+export * from './insightTypesMetadata'
+
import { ProductAnalyticsNotifications } from 'products/product_analytics/frontend/notifications/ProductAnalyticsNotifications'
import { productAnalyticsNotificationsLogic } from 'products/product_analytics/frontend/notifications/productAnalyticsNotificationsLogic'
@@ -81,7 +93,20 @@ export function SavedInsights(): JSX.Element {
const { currentProjectId } = useValues(projectLogic)
const { notificationCount } = useValues(productAnalyticsNotificationsLogic)
+ const { currentTeam, currentTeamLoading } = useValues(teamLogic)
+ const { dataProcessingAccepted, dataProcessingApprovalDisabledReason } = useValues(maxGlobalLogic)
const summarizeInsight = useSummarizeInsight()
+ const dashboardChoiceLogic = sceneDashboardChoiceModalLogic({ scene: Scene.ProductAnalyticsHomeTab })
+ const { isOpen: homeDashboardModalOpen, dashboardChoiceView } = useValues(dashboardChoiceLogic)
+ const {
+ closeSceneDashboardChoiceModal,
+ setSceneDashboardChoice,
+ showDashboardPicker,
+ showSceneDashboardChoiceModal,
+ showStarterOptions,
+ } = useActions(dashboardChoiceLogic)
+ const { isLoading: dashboardCreationLoading } = useValues(newDashboardLogic)
+ const { addDashboard, setAsHomeTabDashboardAfterCreation, showNewDashboardModal } = useActions(newDashboardLogic)
const { tab } = filters
@@ -295,8 +320,82 @@ export function SavedInsights(): JSX.Element {
},
]
+ const openHomeDashboardStarter = (): void => {
+ showStarterOptions()
+ showSceneDashboardChoiceModal()
+ }
+
+ const createHomeDashboardWithAI = (): void => {
+ if (dashboardCreationLoading) {
+ return
+ }
+ closeSceneDashboardChoiceModal()
+ setAsHomeTabDashboardAfterCreation(true, true)
+ addDashboard({
+ name: 'My product analytics dashboard',
+ description: '',
+ show: false,
+ useTemplate: '',
+ _create_in_folder: UNFILED_DASHBOARDS_FOLDER,
+ })
+ }
+
+ const openHomeDashboardTemplates = (): void => {
+ closeSceneDashboardChoiceModal()
+ setAsHomeTabDashboardAfterCreation(true)
+ showNewDashboardModal()
+ }
+
+ const restorePostHogHome = (): void => {
+ setSceneDashboardChoice(null)
+ closeSceneDashboardChoiceModal()
+ }
+
+ const homeDashboardActions =
+ tab === SavedInsightsTabs.Home && showHomeTab ? (
+ currentTeam?.home_tab_dashboard ? (
+ <LemonMenu
+ items={[
+ {
+ label: 'Change Home dashboard',
+ onClick: openHomeDashboardStarter,
+ 'data-attr': 'home-tab-choose-dashboard',
+ },
+ {
+ label: 'Use PostHog Home',
+ onClick: restorePostHogHome,
+ 'data-attr': 'home-tab-restore-posthog-home',
+ },
+ ]}
+ >
+ <LemonButton
+ type="tertiary"
+ size="small"
+ icon={<IconEllipsis />}
+ aria-label="Home dashboard options"
+ tooltip="Home dashboard options"
+ data-attr="home-tab-dashboard-options"
+ />
+ </LemonMenu>
+ ) : (
+ <LemonButton
+ type="secondary"
+ size="small"
+ data-attr="home-tab-choose-dashboard"
+ onClick={openHomeDashboardStarter}
+ >
+ Make my own dashboard
+ </LemonButton>
+ )
+ ) : null
+
return (
- <SceneContent className={cn('saved-insights')}>
+ <SceneContent
+ className={cn(
+ 'saved-insights @container/saved-insights',
+ tab === SavedInsightsTabs.Home && showHomeTab && 'saved-insights--home'
+ )}
+ >
<NewInsightShortcuts />
<SceneTitleSection
name={sceneConfigurations[Scene.SavedInsights].name}
@@ -304,7 +403,14 @@ export function SavedInsights(): JSX.Element {
resourceType={{
type: sceneConfigurations[Scene.SavedInsights].iconType || 'default_icon_type',
}}
- actions={<NewInsightButton />}
+ actions={
+ <>
+ <NewInsightButton compact={tab === SavedInsightsTabs.Home && showHomeTab} />
+ {currentTeam?.home_tab_dashboard && (
+ <div className="@min-[48rem]/saved-insights:hidden">{homeDashboardActions}</div>
+ )}
+ </>
+ }
/>
<LemonTabs
activeKey={tab}
@@ -336,10 +442,31 @@ export function SavedInsights(): JSX.Element {
{ key: SavedInsightsTabs.History, label: 'History' },
]}
sceneInset
+ rightSlot={homeDashboardActions}
+ rightSlotClassName="hidden @min-[48rem]/saved-insights:flex"
/>
{tab === SavedInsightsTabs.Home && showHomeTab ? (
- <HomeTab />
+ <>
+ <HomeTab dashboardActions={homeDashboardActions} />
+ <HomeDashboardStarterModal
+ isOpen={homeDashboardModalOpen && dashboardChoiceView === 'starter'}
+ onClose={closeSceneDashboardChoiceModal}
+ onTalkToAI={createHomeDashboardWithAI}
+ onStartFromTemplate={openHomeDashboardTemplates}
+ onChooseExisting={showDashboardPicker}
+ hasCustomDashboard={!!currentTeam?.home_tab_dashboard}
+ onRestorePostHogHome={restorePostHogHome}
+ restoringPostHogHome={currentTeamLoading}
+ creatingWithAI={dashboardCreationLoading}
+ aiDisabledReason={
+ !dataProcessingAccepted &&
+ (dataProcessingApprovalDisabledReason ?? 'Approve AI data processing to use PostHog AI')
+ }
+ />
+ <SceneDashboardChoiceModal scene={Scene.ProductAnalyticsHomeTab} />
+ <NewDashboardModal redirectAfterCreation={false} />
+ </>
) : tab === SavedInsightsTabs.Notifications ? (
<ProductAnalyticsNotifications />
) : tab === SavedInsightsTabs.History ? (
diff --git a/frontend/src/scenes/saved-insights/Trending.tsx b/frontend/src/scenes/saved-insights/Trending.tsx
deleted file mode 100644
index 0987ccfdc740..000000000000
--- a/frontend/src/scenes/saved-insights/Trending.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import { useActions, useValues } from 'kea'
-
-import { IconInfo } from '@posthog/icons'
-
-import { CompactList } from 'lib/components/CompactList/CompactList'
-import { Tooltip } from 'lib/lemon-ui/Tooltip'
-import { urls } from 'scenes/urls'
-
-import { InsightModel, SavedInsightsTabs } from '~/types'
-
-import { InsightRow } from './InsightRow'
-import { trendingInsightsLogic } from './trendingInsightsLogic'
-
-export function Trending(): JSX.Element {
- const { trendingInsights, trendingInsightsLoading, trendingInsightsLoadedError, expandedInsightIds } =
- useValues(trendingInsightsLogic)
- const { toggleInsightExpanded, loadTrendingInsights } = useActions(trendingInsightsLogic)
-
- return (
- <CompactList
- title={
- <div className="flex items-center gap-1">
- Trending
- <Tooltip title="Trending insights have the most unique views in the last 7 days.">
- <IconInfo className="text-muted text-base" />
- </Tooltip>
- </div>
- }
- viewAllURL={urls.savedInsights(SavedInsightsTabs.All)}
- viewAllDataAttr="insights-home-tab-trending-view-all"
- loading={trendingInsightsLoading}
- error={trendingInsightsLoadedError}
- errorMessage={{
- title: "Couldn't load trending insights",
- description: 'Something went wrong loading this list.',
- buttonText: 'Retry',
- buttonOnClick: loadTrendingInsights,
- }}
- emptyMessage={{
- title: 'No trending insights',
- description: 'Frequently viewed insights will appear here.',
- buttonText: 'View all insights',
- buttonTo: urls.savedInsights(SavedInsightsTabs.All),
- }}
- items={trendingInsights.slice(0, 5)}
- renderRow={(insight: InsightModel) => (
- <InsightRow
- key={insight.short_id}
- insight={insight}
- isExpanded={expandedInsightIds.has(insight.short_id)}
- onToggle={() => toggleInsightExpanded(insight.short_id)}
- dataAttr="trending-insight-item"
- />
- )}
- contentHeightBehavior="fit-content"
- />
- )
-}
diff --git a/frontend/src/scenes/saved-insights/activeUsersLogic.ts b/frontend/src/scenes/saved-insights/activeUsersLogic.ts
deleted file mode 100644
index 4c87e6588d76..000000000000
--- a/frontend/src/scenes/saved-insights/activeUsersLogic.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import { MakeLogicType, afterMount, kea, path, reducers } from 'kea'
-import { loaders } from 'kea-loaders'
-
-import api from 'lib/api'
-
-import { hogql } from '~/queries/utils'
-import { PersonType } from '~/types'
-
-export interface ActivePersonType extends PersonType {
- activity_count: number
-}
-
-export interface activeUsersLogicValues {
- persons: ActivePersonType[]
- personsLoading: boolean
- personsLoadedError: boolean
-}
-
-export interface activeUsersLogicActions {
- loadPersons: () => any
- loadPersonsFailure: (error: string, errorObject?: any) => { error: string; errorObject?: any }
- loadPersonsSuccess: (persons: ActivePersonType[], payload?: any) => { persons: ActivePersonType[]; payload?: any }
-}
-
-export type activeUsersLogicType = MakeLogicType<activeUsersLogicValues, activeUsersLogicActions>
-
-export const activeUsersLogic = kea<activeUsersLogicType>([
- path(['scenes', 'saved-insights', 'activeUsersLogic']),
- loaders({
- persons: {
- __default: [] as ActivePersonType[],
- loadPersons: async () => {
- // HogQL provides activity ranking that the persons API does not support.
- const query = hogql`
- SELECT any(distinct_id), count() as activity_count
- FROM events
- SAMPLE 10000000
- WHERE timestamp > now() - INTERVAL 7 DAY
- GROUP BY person_id
- ORDER BY activity_count DESC
- LIMIT 5
- `
- const idsResponse = await api.queryHogQL(query, {
- scene: 'SavedInsights',
- productKey: 'persons',
- })
- const results = idsResponse.results || []
- const distinctIds = results.map((row) => row[0] as string)
- const counts = new Map(results.map((row) => [row[0] as string, row[1] as number]))
- const personsMap = await api.persons.getByDistinctIds(distinctIds)
-
- return distinctIds
- .map((distinctId) => {
- const person = personsMap[distinctId]
- return person ? { ...person, activity_count: counts.get(distinctId) || 0 } : null
- })
- .filter((person): person is ActivePersonType => person !== null)
- .sort((a, b) => b.activity_count - a.activity_count)
- },
- },
- }),
- reducers({
- personsLoadedError: [
- false,
- {
- loadPersons: () => false,
- loadPersonsSuccess: () => false,
- loadPersonsFailure: () => true,
- },
- ],
- }),
- afterMount(({ actions }) => actions.loadPersons()),
-])
diff --git a/frontend/src/scenes/saved-insights/homeTabDefaultLogic.test.ts b/frontend/src/scenes/saved-insights/homeTabDefaultLogic.test.ts
new file mode 100644
index 000000000000..f8cb23554cab
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/homeTabDefaultLogic.test.ts
@@ -0,0 +1,35 @@
+import { initKeaTests } from '~/test/init'
+
+import { HOME_TAB_DEFAULT_DATE_RANGE, homeTabDefaultLogic } from './homeTabDefaultLogic'
+
+describe('homeTabDefaultLogic', () => {
+ beforeEach(() => {
+ initKeaTests()
+ homeTabDefaultLogic.mount()
+ })
+
+ afterEach(() => {
+ homeTabDefaultLogic.unmount()
+ })
+
+ it('keeps the chosen range, exact-date setting, and comparison', () => {
+ expect(homeTabDefaultLogic.values.dateRange).toEqual(HOME_TAB_DEFAULT_DATE_RANGE)
+ expect(homeTabDefaultLogic.values.compare).toBe(true)
+ expect(homeTabDefaultLogic.values.selectedMetric).toBe('active_users')
+ expect(homeTabDefaultLogic.values.selectedContentKey).toBe('top_pages')
+
+ homeTabDefaultLogic.actions.setDates('2026-08-01T12:00:00Z', '2026-08-31T12:00:00Z', true)
+ homeTabDefaultLogic.actions.setCompare(false)
+ homeTabDefaultLogic.actions.setSelectedMetric('sessions')
+ homeTabDefaultLogic.actions.setSelectedContentKey('top_screens')
+
+ expect(homeTabDefaultLogic.values.dateRange).toEqual({
+ date_from: '2026-08-01T12:00:00Z',
+ date_to: '2026-08-31T12:00:00Z',
+ explicitDate: true,
+ })
+ expect(homeTabDefaultLogic.values.compare).toBe(false)
+ expect(homeTabDefaultLogic.values.selectedMetric).toBe('sessions')
+ expect(homeTabDefaultLogic.values.selectedContentKey).toBe('top_screens')
+ })
+})
diff --git a/frontend/src/scenes/saved-insights/homeTabDefaultLogic.ts b/frontend/src/scenes/saved-insights/homeTabDefaultLogic.ts
new file mode 100644
index 000000000000..f74b80221956
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/homeTabDefaultLogic.ts
@@ -0,0 +1,69 @@
+import { MakeLogicType, actions, kea, path, reducers } from 'kea'
+
+import { DateRange } from '~/queries/schema/schema-general'
+
+export const HOME_TAB_DEFAULT_DATE_RANGE: DateRange = { date_from: '-30d', date_to: null }
+
+export type HomeTabMetricKey = 'active_users' | 'sessions' | 'new_users' | 'session_duration' | 'daily_active_users'
+export type HomeTabContentKey = 'top_pages' | 'top_screens'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface homeTabDefaultLogicValues {
+ compare: boolean
+ dateRange: DateRange
+ selectedContentKey: HomeTabContentKey
+ selectedMetric: HomeTabMetricKey
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface homeTabDefaultLogicActions {
+ setCompare: (compare: boolean) => {
+ compare: boolean
+ }
+ setDates: (
+ dateFrom: string | null,
+ dateTo: string | null,
+ explicitDate?: boolean
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ explicitDate: boolean | undefined
+ }
+ setSelectedContentKey: (key: HomeTabContentKey) => {
+ key: HomeTabContentKey
+ }
+ setSelectedMetric: (key: HomeTabMetricKey) => {
+ key: HomeTabMetricKey
+ }
+}
+
+export type homeTabDefaultLogicType = MakeLogicType<homeTabDefaultLogicValues, homeTabDefaultLogicActions>
+
+export const homeTabDefaultLogic = kea<homeTabDefaultLogicType>([
+ path(['scenes', 'saved-insights', 'homeTabDefaultLogic']),
+ actions({
+ setDates: (dateFrom: string | null, dateTo: string | null, explicitDate?: boolean) => ({
+ dateFrom,
+ dateTo,
+ explicitDate,
+ }),
+ setCompare: (compare: boolean) => ({ compare }),
+ setSelectedContentKey: (key: HomeTabContentKey) => ({ key }),
+ setSelectedMetric: (key: HomeTabMetricKey) => ({ key }),
+ }),
+ reducers({
+ dateRange: [
+ HOME_TAB_DEFAULT_DATE_RANGE,
+ {
+ setDates: (_, { dateFrom, dateTo, explicitDate }) => ({
+ date_from: dateFrom ?? '-30d',
+ date_to: dateTo,
+ explicitDate,
+ }),
+ },
+ ],
+ compare: [true, { setCompare: (_, { compare }) => compare }],
+ selectedContentKey: ['top_pages' as HomeTabContentKey, { setSelectedContentKey: (_, { key }) => key }],
+ selectedMetric: ['active_users' as HomeTabMetricKey, { setSelectedMetric: (_, { key }) => key }],
+ }),
+])
diff --git a/frontend/src/scenes/saved-insights/homeTabDefaultTiles.test.ts b/frontend/src/scenes/saved-insights/homeTabDefaultTiles.test.ts
new file mode 100644
index 000000000000..3dac6b804e57
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/homeTabDefaultTiles.test.ts
@@ -0,0 +1,252 @@
+import { combineUrl } from 'kea-router'
+
+import { RETENTION_FIRST_OCCURRENCE_MATCHING_FILTERS } from 'lib/constants'
+
+import { DateRange, NodeKind } from '~/queries/schema/schema-general'
+import {
+ BaseMathType,
+ ChartDisplayType,
+ PropertyFilterType,
+ PropertyMathType,
+ PropertyOperator,
+ RetentionDashboardDisplayType,
+ TrendResult,
+} from '~/types'
+
+import {
+ getHomeTabAudienceOptions,
+ getHomeTabBreakdownOptions,
+ getHomeTabChartOptions,
+ getHomeTabExploreUrl,
+ getHomeTabInterval,
+ getHomeTabStatQueries,
+ getHomeTabStatValue,
+} from './homeTabDefaultTiles'
+
+describe('homeTabDefaultTiles', () => {
+ const dateRange: DateRange = { date_from: '-14d', date_to: null }
+
+ it('aggregates each stat on the combined event group', () => {
+ const stats = getHomeTabStatQueries(dateRange, true)
+
+ expect(stats.map(({ key, query }) => ({ key, series: query.series[0] }))).toEqual([
+ {
+ key: 'active_users',
+ series: expect.objectContaining({
+ kind: NodeKind.GroupNode,
+ math: BaseMathType.UniqueUsers,
+ nodes: expect.arrayContaining([
+ expect.objectContaining({ event: '$pageview' }),
+ expect.objectContaining({ event: '$screen' }),
+ ]),
+ }),
+ },
+ {
+ key: 'sessions',
+ series: expect.objectContaining({ kind: NodeKind.GroupNode, math: BaseMathType.UniqueSessions }),
+ },
+ {
+ key: 'new_users',
+ series: expect.objectContaining({ kind: NodeKind.GroupNode, math: BaseMathType.FirstTimeForUser }),
+ },
+ {
+ key: 'session_duration',
+ series: expect.objectContaining({
+ kind: NodeKind.GroupNode,
+ math: PropertyMathType.Average,
+ math_property: '$session_duration',
+ }),
+ },
+ {
+ key: 'daily_active_users',
+ series: expect.objectContaining({ kind: NodeKind.GroupNode, math: BaseMathType.UniqueUsers }),
+ },
+ ])
+
+ expect(
+ getHomeTabChartOptions(dateRange, true).find(({ key }) => key === 'weekly_active_users')?.query
+ ).toMatchObject({
+ source: {
+ kind: NodeKind.TrendsQuery,
+ series: [expect.objectContaining({ kind: NodeKind.GroupNode, math: BaseMathType.WeeklyActiveUsers })],
+ },
+ })
+ })
+
+ it('averages daily user counts including zero-activity days instead of using period-wide unique users', () => {
+ const stat = getHomeTabStatQueries(dateRange, true).find(({ key }) => key === 'daily_active_users')!
+ const result = { data: [6, 0, 3], aggregated_value: 7 } as TrendResult
+ expect(getHomeTabStatValue(stat, result)).toBe(3)
+ expect(getHomeTabStatValue(stat, { ...result, data: [0, 0, 0] })).toBe(0)
+ expect(getHomeTabStatValue(stat, { ...result, data: [] })).toBeUndefined()
+
+ const hourlyRange: DateRange = { date_from: '-24h', date_to: null }
+ const dailyStat = getHomeTabStatQueries(hourlyRange, true).find(({ key }) => key === 'daily_active_users')!
+ expect(dailyStat.query).toMatchObject({
+ interval: 'day',
+ dateRange: hourlyRange,
+ compareFilter: { compare: true },
+ })
+ expect(
+ getHomeTabChartOptions(hourlyRange, true).find(({ key }) => key === 'daily_active_users')?.query.source
+ ).toMatchObject({ interval: 'day', dateRange: hourlyRange, compareFilter: { compare: true } })
+ })
+
+ it('applies the selected range and comparison to stats and charts, including retention', () => {
+ const stats = getHomeTabStatQueries(dateRange, false)
+ const charts = getHomeTabChartOptions(dateRange, false)
+
+ for (const stat of stats) {
+ expect(stat.query.dateRange).toEqual(dateRange)
+ expect(stat.query.compareFilter?.compare).toBe(false)
+ }
+
+ for (const chart of charts) {
+ expect(chart.query.source.dateRange).toEqual(dateRange)
+ if (chart.query.source.kind === NodeKind.TrendsQuery) {
+ expect(chart.query.source.compareFilter?.compare).toBe(false)
+ }
+ }
+
+ const retentionQuery = charts.find(({ key }) => key === 'retention')?.query.source
+ expect(retentionQuery).toMatchObject({
+ kind: NodeKind.RetentionQuery,
+ retentionFilter: {
+ totalIntervals: 3,
+ dashboardDisplay: RetentionDashboardDisplayType.TableOnly,
+ retentionType: RETENTION_FIRST_OCCURRENCE_MATCHING_FILTERS,
+ },
+ })
+ const activityEntity = {
+ type: 'events',
+ properties: [
+ {
+ type: PropertyFilterType.EventMetadata,
+ key: 'event',
+ operator: PropertyOperator.In,
+ value: ['$pageview', '$screen'],
+ },
+ ],
+ }
+ const retentionFilter = retentionQuery?.kind === NodeKind.RetentionQuery ? retentionQuery.retentionFilter : null
+ expect(retentionFilter?.targetEntity).toEqual(activityEntity)
+ expect(retentionFilter?.returningEntity).toEqual(activityEntity)
+ expect(
+ getHomeTabChartOptions({ date_from: '-30d', date_to: null }, true).find(({ key }) => key === 'retention')
+ ?.query.source
+ ).toMatchObject({ retentionFilter: { totalIntervals: 6 } })
+ })
+
+ it('offers a matching trend for every selectable summary metric', () => {
+ const statKeys = getHomeTabStatQueries(dateRange, true).map(({ key }) => key)
+ const charts = getHomeTabChartOptions(dateRange, true)
+
+ for (const key of statKeys) {
+ expect(charts.find((chart) => chart.key === key)?.query.source.kind).toBe(NodeKind.TrendsQuery)
+ }
+ })
+
+ it.each([
+ ['2026-09-01', '2026-09-30', 'week'],
+ ['2024-01-01', '2026-01-01', 'month'],
+ ['2024-01-01T12:00:00', '2026-01-01T12:00:00', 'month'],
+ ])('uses a suitable interval for custom dates %s to %s', (date_from, date_to, interval) => {
+ expect(getHomeTabInterval({ date_from, date_to })).toBe(interval)
+ })
+
+ it('labels the selected time bucket in activity charts', () => {
+ const hourlyChart = getHomeTabChartOptions({ date_from: '-24h', date_to: null }, true).find(
+ ({ key }) => key === 'active_users'
+ )
+ expect(hourlyChart?.description).toContain('each hour')
+ expect(hourlyChart?.query.source).toMatchObject({
+ interval: 'hour',
+ compareFilter: { compare: true },
+ })
+
+ const minuteChart = getHomeTabChartOptions({ date_from: '-1h', date_to: null }, false).find(
+ ({ key }) => key === 'active_users'
+ )
+ expect(minuteChart?.description).toContain('each minute')
+ expect(minuteChart?.query.source).toMatchObject({ interval: 'minute' })
+ })
+
+ it('ranks web pages, mobile screens, and all event names within the selected range', () => {
+ const exactRange: DateRange = { date_from: '2026-08-01', date_to: '2026-08-31', explicitDate: true }
+ const options = getHomeTabBreakdownOptions(exactRange)
+
+ expect(options.map(({ key }) => key)).toEqual(['top_pages', 'top_screens', 'top_events'])
+ expect(options.map(({ query }) => query.source)).toEqual([
+ expect.objectContaining({
+ dateRange: exactRange,
+ series: [expect.objectContaining({ event: '$pageview', math: BaseMathType.TotalCount })],
+ trendsFilter: { display: ChartDisplayType.ActionsBarValue },
+ breakdownFilter: expect.objectContaining({
+ breakdown: '$pathname',
+ breakdown_type: 'event',
+ breakdown_limit: 8,
+ }),
+ }),
+ expect.objectContaining({
+ dateRange: exactRange,
+ series: [expect.objectContaining({ event: '$screen', math: BaseMathType.TotalCount })],
+ breakdownFilter: expect.objectContaining({ breakdown: '$screen_name', breakdown_type: 'event' }),
+ }),
+ expect.objectContaining({
+ dateRange: exactRange,
+ series: [expect.objectContaining({ event: null, math: BaseMathType.TotalCount })],
+ breakdownFilter: expect.objectContaining({ breakdown: 'event', breakdown_type: 'event_metadata' }),
+ }),
+ ])
+
+ for (const option of options) {
+ expect(option.query.source.kind).toBe(NodeKind.TrendsQuery)
+ if (option.query.source.kind === NodeKind.TrendsQuery) {
+ expect(option.query.source.compareFilter?.compare).toBeFalsy()
+ }
+ }
+ const destination = combineUrl(getHomeTabExploreUrl(options[2].query))
+ expect(JSON.parse(destination.hashParams.q).source.breakdownFilter.breakdown).toBe('event')
+ })
+
+ it('counts web and mobile activity with the series and filters supported by each audience chart', () => {
+ const charts = getHomeTabAudienceOptions({ date_from: '-1h', date_to: null })
+ const [map, devices] = charts
+ expect(charts.map(({ key }) => key)).toEqual(['users_by_country', 'sessions_by_device'])
+ expect(map.query.source).toMatchObject({
+ series: [
+ {
+ kind: NodeKind.GroupNode,
+ math: BaseMathType.UniqueUsers,
+ nodes: [{ event: '$pageview' }, { event: '$screen' }],
+ },
+ ],
+ dateRange: { date_from: '-1h', date_to: null },
+ compareFilter: { compare: false },
+ trendsFilter: { display: ChartDisplayType.WorldMap },
+ breakdownFilter: { breakdown: '$geoip_country_code', breakdown_type: 'event', breakdown_limit: 250 },
+ })
+ expect(devices.query.source).toMatchObject({
+ series: [{ math: BaseMathType.UniqueSessions }],
+ trendsFilter: { display: ChartDisplayType.ActionsDonut },
+ breakdownFilter: { breakdown: '$device_type' },
+ })
+ for (const chart of charts) {
+ const destination = combineUrl(getHomeTabExploreUrl(chart.query))
+ expect(JSON.parse(destination.hashParams.q).source).toEqual(JSON.parse(JSON.stringify(chart.query.source)))
+ }
+ })
+
+ it.each(['active_users', 'retention'])('opens %s in the insight editor with its selected range', (key) => {
+ const chart = getHomeTabChartOptions(dateRange, true).find((chart) => chart.key === key)
+ expect(chart).toBeTruthy()
+
+ const destination = combineUrl(getHomeTabExploreUrl(chart!.query))
+ expect(destination.pathname).toBe('/insights/new')
+ const editorQuery = JSON.parse(destination.hashParams.q)
+ expect(editorQuery.kind).toBe(NodeKind.InsightVizNode)
+ expect(editorQuery.embedded).toBeUndefined()
+ expect(editorQuery.source).toEqual(JSON.parse(JSON.stringify(chart!.query.source)))
+ expect(editorQuery.source.dateRange).toEqual(dateRange)
+ })
+})
diff --git a/frontend/src/scenes/saved-insights/homeTabDefaultTiles.ts b/frontend/src/scenes/saved-insights/homeTabDefaultTiles.ts
new file mode 100644
index 000000000000..d6b886682981
--- /dev/null
+++ b/frontend/src/scenes/saved-insights/homeTabDefaultTiles.ts
@@ -0,0 +1,440 @@
+import { RETENTION_FIRST_OCCURRENCE_MATCHING_FILTERS } from 'lib/constants'
+import { dateMapping, getDefaultInterval } from 'lib/utils/dateFilters'
+import { urls } from 'scenes/urls'
+
+import {
+ DateRange,
+ EventsNode,
+ GroupNode,
+ InsightVizNode,
+ MathType,
+ NodeKind,
+ RetentionQuery,
+ TrendsQuery,
+ WebAnalyticsItemKind,
+} from '~/queries/schema/schema-general'
+import {
+ BaseMathType,
+ ChartDisplayType,
+ FilterLogicalOperator,
+ IntervalType,
+ PropertyMathType,
+ PropertyFilterType,
+ PropertyOperator,
+ RetentionDashboardDisplayType,
+ RetentionPeriod,
+ TrendResult,
+} from '~/types'
+
+import type { HomeTabMetricKey } from './homeTabDefaultLogic'
+
+/** A single-number stat shown in the compact tile row at the top of the Home tab. */
+export interface HomeTabStatQuery {
+ key: HomeTabMetricKey
+ title: string
+ kind: WebAnalyticsItemKind
+ isIncreaseBad?: boolean
+ query: TrendsQuery
+ summary?: 'daily_average'
+ description?: string
+}
+
+/** A full chart shown below the tile row, chosen via the chart picker. */
+export interface HomeTabChartOption {
+ key: string
+ title: string
+ description: string
+ query: InsightVizNode<TrendsQuery> | InsightVizNode<RetentionQuery>
+}
+
+// $pageview covers web, $screen covers mobile apps — combined so the tile works day one
+// regardless of platform, without asking the customer to pick one first.
+function activityEvent(math: MathType, mathProperty?: string): GroupNode {
+ const series: EventsNode[] = [
+ { kind: NodeKind.EventsNode, event: '$pageview' },
+ { kind: NodeKind.EventsNode, event: '$screen' },
+ ]
+ return {
+ kind: NodeKind.GroupNode,
+ operator: FilterLogicalOperator.Or,
+ nodes: series,
+ math,
+ math_property: mathProperty,
+ }
+}
+
+export function getHomeTabInterval(dateRange: DateRange): IntervalType {
+ const dateFrom = dateRange.date_from
+ const dateTo = dateRange.date_to
+ const preset = dateMapping.find(({ values }) => values[0] === dateFrom && (values[1] ?? null) === (dateTo ?? null))
+ if (preset?.defaultInterval) {
+ return preset.defaultInterval
+ }
+
+ const minuteRange = dateFrom?.match(/^-(\d+)M$/)
+ if (minuteRange) {
+ return 'minute'
+ }
+ const hourRange = dateFrom?.match(/^-(\d+)h$/)
+ if (hourRange) {
+ return Number(hourRange[1]) <= 1 ? 'minute' : Number(hourRange[1]) <= 48 ? 'hour' : 'day'
+ }
+ const dayRange = dateFrom?.match(/^-(\d+)d$/)
+ if (dayRange) {
+ return Number(dayRange[1]) <= 2 ? 'hour' : 'day'
+ }
+
+ if (dateFrom?.match(/^\d{4}-\d{2}-\d{2}(?:T|$)/)) {
+ const durationMs = Date.parse(dateTo ?? new Date().toISOString()) - Date.parse(dateFrom)
+ if (durationMs > 0 && durationMs <= 60 * 60 * 1000) {
+ return 'minute'
+ }
+ if (durationMs > 0 && durationMs <= 48 * 60 * 60 * 1000) {
+ return 'hour'
+ }
+ if (durationMs > 0) {
+ return getDefaultInterval(dateFrom, dateTo ?? new Date().toISOString())
+ }
+ }
+ return 'day'
+}
+
+function getHomeTabRetentionIntervals(dateRange: DateRange): number {
+ const dateFrom = dateRange.date_from
+ const relative = dateFrom?.match(/^-(\d+)([hdwm])$/)
+ const unitDays: Record<string, number> = { h: 1 / 24, d: 1, w: 7, m: 30 }
+ const rangeDays = relative
+ ? Number(relative[1]) * unitDays[relative[2]]
+ : dateFrom && /^\d{4}-\d{2}-\d{2}/.test(dateFrom)
+ ? (Date.parse(dateRange.date_to ?? new Date().toISOString()) - Date.parse(dateFrom)) / 86_400_000
+ : 30
+
+ return Math.min(12, Math.max(2, Math.ceil(rangeDays / 7) + 1))
+}
+
+function trendsQuery(series: GroupNode | EventsNode, dateRange: DateRange, compare: boolean): TrendsQuery {
+ return {
+ kind: NodeKind.TrendsQuery,
+ series: [series],
+ interval: getHomeTabInterval(dateRange),
+ dateRange,
+ compareFilter: { compare },
+ }
+}
+
+function statQuery(
+ key: HomeTabMetricKey,
+ title: string,
+ kind: WebAnalyticsItemKind,
+ series: GroupNode,
+ dateRange: DateRange,
+ compare: boolean,
+ isIncreaseBad?: boolean
+): HomeTabStatQuery {
+ return {
+ key,
+ title,
+ kind,
+ isIncreaseBad,
+ query: {
+ ...trendsQuery(series, dateRange, compare),
+ trendsFilter: { display: ChartDisplayType.BoldNumber },
+ },
+ }
+}
+
+function chartOption(
+ key: string,
+ title: string,
+ description: string,
+ series: GroupNode,
+ dateRange: DateRange,
+ compare: boolean,
+ interval?: IntervalType
+): HomeTabChartOption {
+ return {
+ key,
+ title,
+ description,
+ query: {
+ kind: NodeKind.InsightVizNode,
+ embedded: true,
+ source: {
+ ...trendsQuery(series, dateRange, compare),
+ ...(interval ? { interval } : {}),
+ },
+ },
+ }
+}
+
+export function getHomeTabStatValue(stat: HomeTabStatQuery, result?: TrendResult): number | null | undefined {
+ if (stat.summary === 'daily_average') {
+ return result?.data?.length
+ ? result.data.reduce((total, value) => total + value, 0) / result.data.length
+ : undefined
+ }
+ return result?.aggregated_value
+}
+
+/** Summary metrics for the compact tile row. */
+export function getHomeTabStatQueries(dateRange: DateRange, compare: boolean): HomeTabStatQuery[] {
+ return [
+ statQuery('active_users', 'Active users', 'unit', activityEvent(BaseMathType.UniqueUsers), dateRange, compare),
+ statQuery('sessions', 'Sessions', 'unit', activityEvent(BaseMathType.UniqueSessions), dateRange, compare),
+ statQuery(
+ 'new_users',
+ 'First-time users',
+ 'unit',
+ activityEvent(BaseMathType.FirstTimeForUser),
+ dateRange,
+ compare
+ ),
+ statQuery(
+ 'session_duration',
+ 'Session duration',
+ 'duration_s',
+ activityEvent(PropertyMathType.Average, '$session_duration'),
+ dateRange,
+ compare
+ ),
+ {
+ key: 'daily_active_users',
+ title: 'Avg. DAU',
+ kind: 'unit',
+ summary: 'daily_average',
+ description:
+ 'Average daily unique people with a page or screen view in the selected period, including days with no activity.',
+ query: {
+ ...trendsQuery(activityEvent(BaseMathType.UniqueUsers), dateRange, compare),
+ interval: 'day',
+ trendsFilter: { display: ChartDisplayType.ActionsLineGraph },
+ },
+ },
+ ]
+}
+
+/** The full set of charts the chart picker can show, one at a time. */
+export function getHomeTabChartOptions(dateRange: DateRange, compare: boolean): HomeTabChartOption[] {
+ const interval = getHomeTabInterval(dateRange)
+ const intervalNoun: Record<IntervalType, string> = {
+ second: 'second',
+ minute: 'minute',
+ hour: 'hour',
+ day: 'day',
+ week: 'week',
+ month: 'month',
+ quarter: 'quarter',
+ year: 'year',
+ }
+ const bucket = intervalNoun[interval]
+
+ return [
+ chartOption(
+ 'daily_active_users',
+ 'Daily active users',
+ 'Unique people who viewed a page or screen each day. The tile shows the daily average for this period.',
+ activityEvent(BaseMathType.UniqueUsers),
+ dateRange,
+ compare,
+ 'day'
+ ),
+ chartOption(
+ 'active_users',
+ 'Active users',
+ `Unique people who viewed a page or screen each ${bucket}.`,
+ activityEvent(BaseMathType.UniqueUsers),
+ dateRange,
+ compare
+ ),
+ chartOption(
+ 'sessions',
+ 'Sessions',
+ `Distinct sessions with a page or screen view each ${bucket}.`,
+ activityEvent(BaseMathType.UniqueSessions),
+ dateRange,
+ compare
+ ),
+ chartOption(
+ 'weekly_active_users',
+ 'Weekly active users',
+ 'Unique people active in the trailing 7 days, trended daily.',
+ activityEvent(BaseMathType.WeeklyActiveUsers),
+ dateRange,
+ compare,
+ 'day'
+ ),
+ chartOption(
+ 'new_users',
+ 'First-time users',
+ `People with their first observed page or screen view each ${bucket}.`,
+ activityEvent(BaseMathType.FirstTimeForUser),
+ dateRange,
+ compare
+ ),
+ chartOption(
+ 'session_duration',
+ 'Avg. session duration',
+ `Average duration of observed sessions each ${bucket}.`,
+ activityEvent(PropertyMathType.Average, '$session_duration'),
+ dateRange,
+ compare
+ ),
+ {
+ key: 'retention',
+ title: 'New user retention',
+ description: 'Compare weekly cohorts of first-time visitors and see when they return.',
+ query: {
+ kind: NodeKind.InsightVizNode,
+ embedded: true,
+ source: {
+ kind: NodeKind.RetentionQuery,
+ dateRange,
+ retentionFilter: {
+ period: RetentionPeriod.Week,
+ totalIntervals: getHomeTabRetentionIntervals(dateRange),
+ dashboardDisplay: RetentionDashboardDisplayType.TableOnly,
+ retentionType: RETENTION_FIRST_OCCURRENCE_MATCHING_FILTERS,
+ targetEntity: {
+ type: 'events',
+ properties: [
+ {
+ type: PropertyFilterType.EventMetadata,
+ key: 'event',
+ operator: PropertyOperator.In,
+ value: ['$pageview', '$screen'],
+ },
+ ],
+ },
+ returningEntity: {
+ type: 'events',
+ properties: [
+ {
+ type: PropertyFilterType.EventMetadata,
+ key: 'event',
+ operator: PropertyOperator.In,
+ value: ['$pageview', '$screen'],
+ },
+ ],
+ },
+ },
+ },
+ },
+ },
+ ]
+}
+
+export function getHomeTabAudienceOptions(dateRange: DateRange): HomeTabChartOption[] {
+ return [
+ {
+ key: 'users_by_country',
+ title: 'Active users by country',
+ description: 'Where people use your product, based on IP geolocation.',
+ query: {
+ kind: NodeKind.InsightVizNode,
+ embedded: true,
+ source: {
+ ...trendsQuery(activityEvent(BaseMathType.UniqueUsers), dateRange, false),
+ trendsFilter: { display: ChartDisplayType.WorldMap },
+ breakdownFilter: {
+ breakdown: '$geoip_country_code',
+ breakdown_type: 'event',
+ breakdown_limit: 250,
+ breakdown_hide_other_aggregation: true,
+ },
+ },
+ },
+ },
+ {
+ key: 'sessions_by_device',
+ title: 'Sessions by device',
+ description: 'See the mix of desktop, mobile, and tablet sessions.',
+ query: {
+ kind: NodeKind.InsightVizNode,
+ embedded: true,
+ source: {
+ ...trendsQuery(activityEvent(BaseMathType.UniqueSessions), dateRange, false),
+ trendsFilter: {
+ display: ChartDisplayType.ActionsDonut,
+ showLegend: true,
+ legendPosition: 'bottom',
+ },
+ breakdownFilter: {
+ breakdown: '$device_type',
+ breakdown_type: 'event',
+ breakdown_limit: 8,
+ },
+ },
+ },
+ },
+ ]
+}
+
+function rankedBreakdownOption(
+ key: string,
+ title: string,
+ description: string,
+ event: string | null,
+ breakdown: string,
+ breakdownType: 'event' | 'event_metadata',
+ dateRange: DateRange
+): HomeTabChartOption {
+ return {
+ key,
+ title,
+ description,
+ query: {
+ kind: NodeKind.InsightVizNode,
+ embedded: true,
+ source: {
+ kind: NodeKind.TrendsQuery,
+ series: [{ kind: NodeKind.EventsNode, event, math: BaseMathType.TotalCount }],
+ dateRange,
+ interval: getHomeTabInterval(dateRange),
+ trendsFilter: { display: ChartDisplayType.ActionsBarValue },
+ breakdownFilter: {
+ breakdown,
+ breakdown_type: breakdownType,
+ breakdown_limit: 8,
+ breakdown_hide_other_aggregation: true,
+ },
+ },
+ },
+ }
+}
+
+export function getHomeTabBreakdownOptions(dateRange: DateRange): HomeTabChartOption[] {
+ return [
+ rankedBreakdownOption(
+ 'top_pages',
+ 'Top pages',
+ 'Pages with the most views.',
+ '$pageview',
+ '$pathname',
+ 'event',
+ dateRange
+ ),
+ rankedBreakdownOption(
+ 'top_screens',
+ 'Top screens',
+ 'Screens with the most views.',
+ '$screen',
+ '$screen_name',
+ 'event',
+ dateRange
+ ),
+ rankedBreakdownOption(
+ 'top_events',
+ 'Top events',
+ 'The most frequent event names in this period.',
+ null,
+ 'event',
+ 'event_metadata',
+ dateRange
+ ),
+ ]
+}
+
+export function getHomeTabExploreUrl(query: HomeTabChartOption['query']): string {
+ const insightQuery: HomeTabChartOption['query'] = { ...query, embedded: undefined }
+ return urls.insightNew({ query: insightQuery })
+}
diff --git a/frontend/src/scenes/saved-insights/newEventsLogic.ts b/frontend/src/scenes/saved-insights/newEventsLogic.ts
deleted file mode 100644
index 0cd623aef14d..000000000000
--- a/frontend/src/scenes/saved-insights/newEventsLogic.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { MakeLogicType, afterMount, kea, path, reducers } from 'kea'
-import { loaders } from 'kea-loaders'
-
-import api from 'lib/api'
-
-import { EventDefinition } from '~/types'
-
-export interface newEventsLogicValues {
- newEvents: EventDefinition[]
- newEventsLoading: boolean
- newEventsLoadedError: boolean
-}
-
-export interface newEventsLogicActions {
- loadNewEvents: () => any
- loadNewEventsFailure: (error: string, errorObject?: any) => { error: string; errorObject?: any }
- loadNewEventsSuccess: (
- newEvents: EventDefinition[],
- payload?: any
- ) => {
- newEvents: EventDefinition[]
- payload?: any
- }
-}
-
-export type newEventsLogicType = MakeLogicType<newEventsLogicValues, newEventsLogicActions>
-
-export const newEventsLogic = kea<newEventsLogicType>([
- path(['scenes', 'saved-insights', 'newEventsLogic']),
- loaders({
- newEvents: {
- __default: [] as EventDefinition[],
- loadNewEvents: async () => {
- const response = await api.eventDefinitions.list({ limit: 10, ordering: '-created_at' })
- return response.results
- },
- },
- }),
- reducers({
- newEventsLoadedError: [
- false,
- {
- loadNewEvents: () => false,
- loadNewEventsSuccess: () => false,
- loadNewEventsFailure: () => true,
- },
- ],
- }),
- afterMount(({ actions }) => actions.loadNewEvents()),
-])
diff --git a/frontend/src/scenes/saved-insights/trendingInsightsLogic.ts b/frontend/src/scenes/saved-insights/trendingInsightsLogic.ts
deleted file mode 100644
index 1c2cc8b77b02..000000000000
--- a/frontend/src/scenes/saved-insights/trendingInsightsLogic.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import { MakeLogicType, actions, afterMount, kea, path, reducers } from 'kea'
-import { loaders } from 'kea-loaders'
-
-import api from 'lib/api'
-
-import { getQueryBasedInsightModel } from '~/queries/nodes/InsightViz/utils'
-import { InsightModel } from '~/types'
-
-export interface trendingInsightsLogicValues {
- expandedInsightIds: Set<string>
- trendingInsights: InsightModel[]
- trendingInsightsLoading: boolean
- trendingInsightsLoadedError: boolean
-}
-
-export interface trendingInsightsLogicActions {
- loadTrendingInsights: () => any
- loadTrendingInsightsFailure: (error: string, errorObject?: any) => { error: string; errorObject?: any }
- loadTrendingInsightsSuccess: (
- trendingInsights: InsightModel[],
- payload?: any
- ) => {
- payload?: any
- trendingInsights: InsightModel[]
- }
- toggleInsightExpanded: (insightShortId: string) => { insightShortId: string }
-}
-
-export type trendingInsightsLogicType = MakeLogicType<trendingInsightsLogicValues, trendingInsightsLogicActions>
-
-export const trendingInsightsLogic = kea<trendingInsightsLogicType>([
- path(['scenes', 'saved-insights', 'trendingInsightsLogic']),
- actions({
- toggleInsightExpanded: (insightShortId: string) => ({ insightShortId }),
- }),
- loaders({
- trendingInsights: {
- __default: [] as InsightModel[],
- loadTrendingInsights: async () => {
- const insights = await api.insights.trending({ days: 7, limit: 5 })
- return insights.map(getQueryBasedInsightModel)
- },
- },
- }),
- reducers({
- expandedInsightIds: [
- new Set<string>(),
- {
- toggleInsightExpanded: (state, { insightShortId }) => {
- const next = new Set(state)
- next.has(insightShortId) ? next.delete(insightShortId) : next.add(insightShortId)
- return next
- },
- },
- ],
- trendingInsightsLoadedError: [
- false,
- {
- loadTrendingInsights: () => false,
- loadTrendingInsightsSuccess: () => false,
- loadTrendingInsightsFailure: () => true,
- },
- ],
- }),
- afterMount(({ actions }) => actions.loadTrendingInsights()),
-])
diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.ts
index 1fd73e2073c9..2cb33c91c6dc 100644
--- a/frontend/src/scenes/sceneTypes.ts
+++ b/frontend/src/scenes/sceneTypes.ts
@@ -163,6 +163,7 @@ export enum Scene {
SqlVariableEdit = 'SqlVariableEdit',
SQLEditor = 'SQLEditor',
SavedInsights = 'SavedInsights',
+ ProductAnalyticsHomeTab = 'ProductAnalyticsHomeTab',
Health = 'Health',
HealthCategoryDetail = 'HealthCategoryDetail',
HealthAlerts = 'HealthAlerts',
diff --git a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx b/frontend/src/scenes/team-activity/teamActivityDescriber.tsx
index 421861b6de11..820d898d1fae 100644
--- a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx
+++ b/frontend/src/scenes/team-activity/teamActivityDescriber.tsx
@@ -597,6 +597,28 @@ const TEAM_PROPERTIES_MAPPING: Record<
],
}
},
+ home_tab_dashboard: (change) => {
+ if (!change.after) {
+ return {
+ description: [
+ <>
+ reset the <em>Home tab dashboard</em> to the generic view
+ </>,
+ ],
+ }
+ }
+
+ return {
+ description: [
+ <>
+ {change.action === 'created' ? 'set' : 'changed'} the <em>Home tab dashboard</em> to{' '}
+ <Link to={urls.dashboard(change.after as number)}>
+ <em>{String(change.after)}</em>
+ </Link>
+ </>,
+ ],
+ }
+ },
flags_persistence_default: (change) => {
return {
description: [
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index e26375a03738..a73c3672684a 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -888,6 +888,7 @@ export interface TeamType extends TeamBasicType {
has_group_types: boolean
group_types: GroupType[]
primary_dashboard: number | null // Dashboard shown on the project homepage
+ home_tab_dashboard: number | null // Dashboard shown on the product analytics Home tab
live_events_columns: string[] | null // Custom columns shown on the Live Events page
live_events_token: string
cookieless_server_hash_mode?: CookielessServerHashMode
diff --git a/posthog/api/project.py b/posthog/api/project.py
index fe4db4ec7ceb..9ed5e45ebb5a 100644
--- a/posthog/api/project.py
+++ b/posthog/api/project.py
@@ -22,6 +22,7 @@ from posthog.schema import ProductKey
from posthog.api import project_tags
from posthog.api.routing import TeamAndOrgViewSetMixin
+from posthog.api.scoped_related_fields import TeamScopedPrimaryKeyRelatedField
from posthog.api.shared import ProjectBackwardCompatBasicSerializer
from posthog.api.tagged_item import TaggedItemSerializerMixin
@@ -126,6 +127,7 @@ from products.access_control.backend.presentation.access_control import (
UserAccessControlSerializerMixin,
)
from products.access_control.backend.presentation.access_control_settings import AccessControlSettingsViewSetMixin
+from products.dashboards.backend.models import Dashboard
from products.feature_flags.backend.facade.enums import FlagEvaluationsMode
from products.feature_flags.backend.facade.flags import get_flag_evaluations_read_mode
from products.feature_flags.backend.models import TeamFeatureFlagDefaultsConfig
@@ -645,10 +647,26 @@ class ProjectBackwardCompatSerializer(
allow_null=True,
help_text="Settings for Conversations. Must be a JSON object or null.",
)
+ # Lives on the passthrough Team's extension too, not a real Team column, so it can't be merged
+ # in by ProjectBackwardCompatBasicSerializer.get_fields() like a normal model field.
+ home_tab_dashboard = TeamScopedPrimaryKeyRelatedField(
+ queryset=Dashboard.objects.all(),
+ required=False,
+ allow_null=True,
+ error_messages={"does_not_exist": "Dashboard does not belong to this team."},
+ help_text=(
+ "ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view."
+ ),
+ ) # Compat with TeamSerializer
# No `default` on purpose: a default value would be auto-injected into every create payload, which trips the
# admin-only-fields-on-creation gate in validate_team_attrs and blocks members allowed to create projects.
base_currency = serializers.ChoiceField(choices=CURRENCY_CODE_CHOICES, required=False) # Compat with TeamSerializer
+ def get_fields(self) -> dict[str, serializers.Field]:
+ if isinstance(self.instance, Project):
+ self.context["team_id"] = self.instance.team_id
+ return super().get_fields()
+
def validate_app_urls(self, value: list[str | None] | None) -> list[str] | None:
if value is None:
return value
@@ -683,7 +701,7 @@ class ProjectBackwardCompatSerializer(
class Meta:
model = Project
- fields = (
+ fields: tuple[str, ...] = (
"id",
"organization",
"name",
@@ -733,6 +751,7 @@ class ProjectBackwardCompatSerializer(
"access_control", # Compat with TeamSerializer
"week_start_day", # Compat with TeamSerializer
"primary_dashboard", # Compat with TeamSerializer
+ "home_tab_dashboard", # Compat with TeamSerializer
"live_events_columns", # Compat with TeamSerializer
"recording_domains", # Compat with TeamSerializer
"person_on_events_querying_enabled", # Compat with TeamSerializer
@@ -845,6 +864,7 @@ class ProjectBackwardCompatSerializer(
"access_control",
"week_start_day",
"primary_dashboard",
+ "home_tab_dashboard",
"live_events_columns",
"recording_domains",
"person_on_events_querying_enabled",
@@ -1229,6 +1249,9 @@ class ProjectBackwardCompatSerializer(
team = instance.passthrough_team
team_before_update = team.__dict__.copy()
+ if "home_tab_dashboard" in validated_data:
+ dashboard = team.home_tab_dashboard
+ team_before_update["home_tab_dashboard"] = dashboard.id if dashboard else None
project_before_update = instance.__dict__.copy()
# Analytics configs live on related models, not Team columns — handle them via the shared helpers
@@ -1246,6 +1269,13 @@ class ProjectBackwardCompatSerializer(
if config_data := validated_data.pop("feature_flag_policy_config", None):
update_team_feature_flag_policy_config(team, config_data, context=config_context)
+ # Lives on a Team extension, not a Project or Team column, so it can't flow through the
+ # generic passthrough loop below.
+ if "home_tab_dashboard" in validated_data:
+ dashboard = validated_data.pop("home_tab_dashboard")
+ team.home_tab_dashboard = dashboard
+ home_tab_dashboard_id = dashboard.id if dashboard else None
+
if "session_recording_retention_period" in validated_data:
verify_team_session_recording_retention_period(team, validated_data["session_recording_retention_period"])
@@ -1355,6 +1385,8 @@ class ProjectBackwardCompatSerializer(
# Snapshot before the cache refresh below so the audit diff only reflects this
# request's writes, not fields a concurrent request changed.
team_after_update = team.__dict__.copy()
+ if "home_tab_dashboard" in team_before_update:
+ team_after_update["home_tab_dashboard"] = home_tab_dashboard_id
if updated_team_fields or conversations_lock_applied:
# The in-memory team may hold stale values for fields a concurrent request
# changed, and the post-save receiver has already cached that snapshot. Reload
@@ -1411,8 +1443,17 @@ class ProjectBackwardCompatSerializer(
return instance
+class ProjectCreateRequestSerializer(ProjectBackwardCompatSerializer):
+ def get_fields(self) -> dict[str, serializers.Field]:
+ return {name: field for name, field in super().get_fields().items() if not field.read_only}
+
+ class Meta(ProjectBackwardCompatSerializer.Meta):
+ fields = tuple(field for field in ProjectBackwardCompatSerializer.Meta.fields if field != "home_tab_dashboard")
+
+
@extend_schema(extensions={"x-product": "core"})
@extend_schema_view(
+ create=extend_schema(request=ProjectCreateRequestSerializer, responses=ProjectBackwardCompatSerializer),
list=extend_schema(
parameters=project_tags.LIST_FILTER_PARAMETERS,
),
diff --git a/posthog/api/team.py b/posthog/api/team.py
index 350b5a9794c6..383ce7117963 100644
--- a/posthog/api/team.py
+++ b/posthog/api/team.py
@@ -42,6 +42,7 @@ from posthog.schema import (
)
from posthog.api.routing import TeamAndOrgViewSetMixin
+from posthog.api.scoped_related_fields import TeamScopedPrimaryKeyRelatedField
from posthog.api.shared import TeamBasicSerializer
from posthog.api.utils import action, validate_authorized_url_wildcards
from posthog.auth import SessionAuthentication
@@ -130,6 +131,7 @@ from products.customer_analytics.backend.facade.account_property_pins import (
from products.customer_analytics.backend.facade.contracts import PinnedAccountProperty
from products.customer_analytics.backend.facade.enums import ACCOUNT_PROPERTY_PIN_KIND_CHOICES
from products.customer_analytics.backend.facade.team_extension import TeamCustomerAnalyticsConfig
+from products.dashboards.backend.models import Dashboard
from products.feature_flags.backend.facade.enums import FlagEvaluationsMode
from products.feature_flags.backend.facade.flags import get_flag_evaluations_read_mode
from products.feature_flags.backend.models.evaluation_context import EvaluationContext, normalize_context_name
@@ -628,6 +630,7 @@ TEAM_CONFIG_FIELDS = (
"survey_config",
"week_start_day",
"primary_dashboard",
+ "home_tab_dashboard",
"live_events_columns",
"recording_domains",
"cookieless_server_hash_mode",
@@ -672,6 +675,7 @@ TEAM_CONFIG_MEMBER_FIELDS = (
"autocapture_web_vitals_allowed_metrics",
"surveys_opt_in",
"primary_dashboard",
+ "home_tab_dashboard",
)
TEAM_CONFIG_MEMBER_FIELDS_SET = set(TEAM_CONFIG_MEMBER_FIELDS)
@@ -1396,6 +1400,15 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin
allow_null=True,
help_text="Settings for Conversations. Must be a JSON object or null.",
)
+ home_tab_dashboard = TeamScopedPrimaryKeyRelatedField(
+ queryset=Dashboard.objects.all(),
+ required=False,
+ allow_null=True,
+ error_messages={"does_not_exist": "Dashboard does not belong to this team."},
+ help_text=(
+ "ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view."
+ ),
+ )
heatmaps_screenshot_secret = serializers.SerializerMethodField(
help_text=(
@@ -1461,6 +1474,11 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin
"available_setup_task_ids",
)
+ def get_fields(self) -> dict[str, serializers.Field]:
+ if isinstance(self.instance, Team):
+ self.context["team_id"] = self.instance.pk
+ return super().get_fields()
+
def to_representation(self, instance):
with tracer.start_as_current_span("team_serializer.default_fields"):
representation = super().to_representation(instance)
@@ -2243,6 +2261,9 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin
# Captured before the locked block pops the keys, so the refresh/re-cache step
# below still knows this request touched the team row.
conversations_lock_applied = patch_conversations_settings or "conversations_enabled" in validated_data
+ if "home_tab_dashboard" in validated_data:
+ dashboard = instance.home_tab_dashboard
+ before_update["home_tab_dashboard"] = dashboard.id if dashboard else None
# Should be validated already, but let's be extra sure
if config_data := validated_data.pop("revenue_analytics_config", None):
@@ -2260,6 +2281,13 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin
if config_data := validated_data.pop("feature_flag_policy_config", None):
self._update_feature_flag_policy_config(instance, config_data)
+ # Lives on a Team extension, not a Team column, so it can't flow through the generic
+ # save(update_fields=...) loop below.
+ if "home_tab_dashboard" in validated_data:
+ dashboard = validated_data.pop("home_tab_dashboard")
+ instance.home_tab_dashboard = dashboard
+ home_tab_dashboard_id = dashboard.id if dashboard else None
+
if "session_recording_retention_period" in validated_data:
self._verify_update_session_recording_retention_period(
instance, validated_data["session_recording_retention_period"]
@@ -2354,6 +2382,8 @@ class TeamSerializer(serializers.ModelSerializer, UserPermissionsSerializerMixin
# Snapshot before the cache refresh below so the audit diff only reflects this
# request's writes, not fields a concurrent request changed.
after_update = instance.__dict__.copy()
+ if "home_tab_dashboard" in before_update:
+ after_update["home_tab_dashboard"] = home_tab_dashboard_id
if other_team_fields or conversations_lock_applied:
# The in-memory instance may hold stale values for fields a concurrent request
# changed, and the post-save receiver has already cached that snapshot. Reload
@@ -3360,6 +3390,14 @@ def validate_team_attrs(
if attrs["primary_dashboard"] and attrs["primary_dashboard"].team_id != instance.id:
raise exceptions.ValidationError({"primary_dashboard": "Dashboard does not belong to this team."})
+ if "home_tab_dashboard" in attrs:
+ if not instance:
+ raise exceptions.ValidationError(
+ {"home_tab_dashboard": "Home tab dashboard cannot be set on project creation."}
+ )
+ if attrs["home_tab_dashboard"] and attrs["home_tab_dashboard"].team_id != instance.id:
+ raise exceptions.ValidationError({"home_tab_dashboard": "Dashboard does not belong to this team."})
+
if "autocapture_exceptions_errors_to_ignore" in attrs:
if not isinstance(attrs["autocapture_exceptions_errors_to_ignore"], list):
raise exceptions.ValidationError("Must provide a list for field: autocapture_exceptions_errors_to_ignore.")
diff --git a/posthog/api/test/dashboards/test_dashboard.py b/posthog/api/test/dashboards/test_dashboard.py
index 6334c454de4c..3d5f0d815ce2 100644
--- a/posthog/api/test/dashboards/test_dashboard.py
+++ b/posthog/api/test/dashboards/test_dashboard.py
@@ -1348,11 +1348,21 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):
dashboard_id, _ = self.dashboard_api.create_dashboard({})
self.team.primary_dashboard_id = dashboard_id
self.team.save()
+ self.team.home_tab_dashboard = Dashboard.objects.get(pk=dashboard_id)
self.dashboard_api.soft_delete(dashboard_id, "dashboards")
self.team.refresh_from_db()
assert self.team.primary_dashboard is None
+ assert self.team.home_tab_dashboard is None
+
+ def test_home_dashboard_ignores_bulk_soft_deleted_dashboard(self):
+ dashboard = Dashboard.objects.create(team=self.team, name="Home")
+ self.team.home_tab_dashboard = dashboard
+
+ Dashboard.objects.filter(pk=dashboard.pk).update(deleted=True)
+
+ assert self.team.home_tab_dashboard is None
def test_delete_dashboard_resets_group_type_detail_dashboard_if_needed(self):
group_type = create_group_type_mapping_without_created_at(
diff --git a/posthog/api/test/test_project.py b/posthog/api/test/test_project.py
index c2007b14611d..18b499d2f9a7 100644
--- a/posthog/api/test/test_project.py
+++ b/posthog/api/test/test_project.py
@@ -11,7 +11,7 @@ from parameterized import parameterized
from rest_framework import status
from rest_framework.test import APIRequestFactory
-from posthog.api.project import ProjectBackwardCompatSerializer, ProjectViewSet
+from posthog.api.project import ProjectBackwardCompatSerializer, ProjectCreateRequestSerializer, ProjectViewSet
from posthog.api.project_tags import MAX_TAGS_PER_FILTER
from posthog.api.team import TeamCustomerAnalyticsConfigSerializer, TeamSerializer
from posthog.api.test.test_team import EnvironmentToProjectRewriteClient, team_api_test_factory
@@ -44,6 +44,14 @@ class TestProjectAPI(team_api_test_factory()): # type: ignore
client_class = EnvironmentToProjectRewriteClient
+ def test_project_create_request_excludes_response_only_fields(self) -> None:
+ serializer = ProjectCreateRequestSerializer()
+ self.assertIn("name", serializer.fields)
+ self.assertFalse(any(field.required for field in serializer.fields.values()))
+ for field_name in ("id", "organization", "created_at", "api_token", "home_tab_dashboard"):
+ self.assertNotIn(field_name, serializer.fields)
+ self.assertFalse(any(field.read_only for field in serializer.fields.values()))
+
def test_projects_outside_personal_api_key_scoped_organizations_not_listed(self):
other_org, _, team_in_other_org = Organization.objects.bootstrap(self.user)
personal_api_key = generate_random_token_personal()
diff --git a/posthog/api/test/test_team.py b/posthog/api/test/test_team.py
index f4f8b534e732..3efccdea1a73 100644
--- a/posthog/api/test/test_team.py
+++ b/posthog/api/test/test_team.py
@@ -53,6 +53,7 @@ from posthog.utils import get_context_for_template, get_instance_realm
from products.access_control.backend.models.access_control import AccessControl
from products.conversations.backend.playbook import compose_support_playbook
from products.dashboards.backend.models.dashboard import Dashboard
+from products.dashboards.backend.models.team_home_tab_dashboard_config import TeamHomeTabDashboardConfig
from products.feature_flags.backend.facade.enums import FlagEvaluationsMode
from products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfig
from products.workflows.backend.facade.team_extension import TeamWorkflowsConfig
@@ -964,6 +965,60 @@ def team_api_test_factory():
self.validation_error_response("Dashboard does not belong to this team.", attr="primary_dashboard"),
)
+ def test_update_home_tab_dashboard(self):
+ self.assertFalse(TeamHomeTabDashboardConfig.objects.for_team(self.team.id).exists())
+ response = self.client.get("/api/environments/@current/")
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+ self.assertIsNone(response.json()["home_tab_dashboard"])
+ self.assertFalse(TeamHomeTabDashboardConfig.objects.for_team(self.team.id).exists())
+
+ d = Dashboard.objects.create(name="Test", team=self.team)
+
+ response = self.client.patch("/api/environments/@current/", {"home_tab_dashboard": d.id})
+ response_data = response.json()
+
+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())
+ self.assertEqual(response_data["home_tab_dashboard"], d.id)
+ self.assertEqual(Team.objects.get(pk=self.team.pk).home_tab_dashboard.id, d.id)
+
+ changes = [
+ change
+ for log in ActivityLog.objects.filter(team_id=self.team.id, scope="Team")
+ for change in (log.detail or {}).get("changes", [])
+ if change["field"] == "home_tab_dashboard"
+ ]
+ self.assertEqual(
+ changes,
+ [{"type": "Team", "action": "created", "field": "home_tab_dashboard", "before": None, "after": d.id}],
+ )
+
+ response = self.client.patch("/api/environments/@current/", {"home_tab_dashboard": None})
+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.json())
+ self.assertIsNone(response.json()["home_tab_dashboard"])
+ self.assertIsNone(Team.objects.get(pk=self.team.pk).home_tab_dashboard)
+ changes = [
+ change
+ for log in ActivityLog.objects.filter(team_id=self.team.id, scope="Team").order_by("created_at")
+ for change in (log.detail or {}).get("changes", [])
+ if change["field"] == "home_tab_dashboard"
+ ]
+ self.assertEqual([change["action"] for change in changes], ["created", "deleted"])
+ self.assertEqual(changes[-1]["before"], d.id)
+ self.assertIsNone(changes[-1]["after"])
+
+ def test_cant_set_home_tab_dashboard_to_another_teams_dashboard(self):
+ team_2 = Team.objects.create(organization=self.organization, name="Default project")
+ d = Dashboard.objects.create(name="Test", team=team_2)
+
+ response = self.client.patch("/api/environments/@current/", {"home_tab_dashboard": d.id})
+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
+ self.assertEqual(
+ response.json(),
+ self.validation_error_response(
+ "Dashboard does not belong to this team.", code="does_not_exist", attr="home_tab_dashboard"
+ ),
+ )
+
def test_is_generating_demo_data(self):
cache_key = f"is_generating_demo_data_{self.team.pk}"
cache.set(cache_key, "True")
diff --git a/posthog/api/test/test_team_project_differential.py b/posthog/api/test/test_team_project_differential.py
index faadcabe0c54..ad9ea69b48ed 100644
--- a/posthog/api/test/test_team_project_differential.py
+++ b/posthog/api/test/test_team_project_differential.py
@@ -183,6 +183,7 @@ FIELD_VALUES: dict[str, Any] = {
"survey_config": {"appearance": {"backgroundColor": "#ffffff"}},
"week_start_day": 1,
"primary_dashboard": "__PER_TWIN_DASHBOARD__", # special-cased: a dashboard belonging to each twin
+ "home_tab_dashboard": "__PER_TWIN_DASHBOARD__",
"live_events_columns": ["event"],
"recording_domains": ["https://example.com"],
"cookieless_server_hash_mode": 2,
@@ -232,7 +233,7 @@ class TestWriteParity(DifferentialParityBase):
project_b, team_b = self._make_twin()
value = FIELD_VALUES[field]
- if field == "primary_dashboard":
+ if field in {"primary_dashboard", "home_tab_dashboard"}:
dash_a = Dashboard.objects.create(team=team_a, name="d")
dash_b = Dashboard.objects.create(team=team_b, name="d")
body_a: dict[str, Any] = {field: dash_a.id}
@@ -256,7 +257,7 @@ class TestWriteParity(DifferentialParityBase):
# 2. Round-trip parity: reading the field back must yield the same result via both routes.
get_a = self.client.get(f"/api/environments/{team_a.id}/").json()
get_b = self.client.get(f"/api/projects/{project_b.id}/").json()
- if field == "primary_dashboard":
+ if field in {"primary_dashboard", "home_tab_dashboard"}:
self.assertEqual(get_a[field], dash_a.id)
self.assertEqual(get_b[field], dash_b.id)
else:
diff --git a/posthog/models/team/team.py b/posthog/models/team/team.py
index 7dce6d387001..b7a881c436fa 100644
--- a/posthog/models/team/team.py
+++ b/posthog/models/team/team.py
@@ -56,6 +56,8 @@ if TYPE_CHECKING:
from posthog.models.user import User
+ from products.dashboards.backend.models.dashboard import Dashboard
+
TIMEZONES = [(tz, tz) for tz in pytz.all_timezones]
# TODO: DEPRECATED; delete when these attributes can be fully removed from `Team` model
@@ -632,6 +634,25 @@ class Team(UUIDTClassicModel):
blank=True,
) # Dashboard shown on project homepage
+ # Exposed as a field on TeamSerializer/ProjectSerializer, so this descriptor is required per
+ # posthog/models/team/README.md ("An extension exposed as a nested field on the team or
+ # project serializer is the exception, and does need the descriptor.").
+ @property
+ def home_tab_dashboard(self) -> "Dashboard | None":
+ from products.dashboards.backend.models import TeamHomeTabDashboardConfig
+
+ config = TeamHomeTabDashboardConfig.objects.for_team(self.pk).select_related("dashboard").first()
+ dashboard = config.dashboard if config else None
+ return dashboard if dashboard and not dashboard.deleted and dashboard.team_id == self.pk else None
+
+ @home_tab_dashboard.setter
+ def home_tab_dashboard(self, dashboard: "Dashboard | None") -> None:
+ from products.dashboards.backend.models import TeamHomeTabDashboardConfig
+
+ config, _ = TeamHomeTabDashboardConfig.objects.for_team(self.pk).get_or_create(team_id=self.pk)
+ config.dashboard = dashboard
+ config.save(update_fields=["dashboard"])
+
default_data_theme = field_access_control(models.IntegerField(null=True, blank=True), "project", "admin")
# Generic field for storing any team-specific context
diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.py
index cdefa434627b..5cf04c32645b 100644
--- a/products/dashboards/backend/api/dashboard.py
+++ b/products/dashboards/backend/api/dashboard.py
@@ -1987,10 +1987,15 @@ class DashboardSerializer(DashboardMetadataSerializer):
self._delete_related_tiles(instance, self.validated_data.get("delete_insights", False))
from posthog.models.team import Team
+ from products.dashboards.backend.models import TeamHomeTabDashboardConfig
+
Team.objects.filter(
primary_dashboard=instance,
id=instance.team_id,
).update(primary_dashboard=None)
+ TeamHomeTabDashboardConfig.objects.for_team(instance.team_id).filter(dashboard_id=instance.id).update(
+ dashboard=None
+ )
from posthog.models.group_type_mapping import clear_dashboard_from_group_type_mapping
clear_dashboard_from_group_type_mapping(
diff --git a/products/dashboards/backend/migrations/0025_teamhometabdashboardconfig.py b/products/dashboards/backend/migrations/0025_teamhometabdashboardconfig.py
new file mode 100644
index 000000000000..0e5090f3eb6d
--- /dev/null
+++ b/products/dashboards/backend/migrations/0025_teamhometabdashboardconfig.py
@@ -0,0 +1,41 @@
+# Generated by Django 5.2.17 on 2026-09-29 13:14
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("dashboards", "0024_text_agent_context"),
+ ("posthog", "1388_activitylog_credential"),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="TeamHomeTabDashboardConfig",
+ fields=[
+ (
+ "team",
+ models.OneToOneField(
+ db_constraint=False,
+ on_delete=django.db.models.deletion.CASCADE,
+ primary_key=True,
+ related_name="+",
+ serialize=False,
+ to="posthog.team",
+ ),
+ ),
+ (
+ "dashboard",
+ models.ForeignKey(
+ blank=True,
+ help_text="Dashboard shown on the product analytics Home tab. Null shows the built-in generic view.",
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ related_name="+",
+ to="dashboards.dashboard",
+ ),
+ ),
+ ],
+ ),
+ ]
diff --git a/products/dashboards/backend/migrations/max_migration.txt b/products/dashboards/backend/migrations/max_migration.txt
index 1fef279eaf65..63f49b21ba19 100644
--- a/products/dashboards/backend/migrations/max_migration.txt
+++ b/products/dashboards/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0024_text_agent_context
+0025_teamhometabdashboardconfig
diff --git a/products/dashboards/backend/models/__init__.py b/products/dashboards/backend/models/__init__.py
index 20187ed53d46..285d7f35a324 100644
--- a/products/dashboards/backend/models/__init__.py
+++ b/products/dashboards/backend/models/__init__.py
@@ -2,6 +2,7 @@ from .dashboard import Dashboard
from .dashboard_templates import DashboardTemplate
from .dashboard_tile import ButtonTile, DashboardTile, Text
from .dashboard_widget import DashboardWidget
+from .team_home_tab_dashboard_config import TeamHomeTabDashboardConfig
__all__ = [
"ButtonTile",
@@ -10,4 +11,5 @@ __all__ = [
"DashboardTile",
"DashboardWidget",
"Text",
+ "TeamHomeTabDashboardConfig",
]
diff --git a/products/dashboards/backend/models/team_home_tab_dashboard_config.py b/products/dashboards/backend/models/team_home_tab_dashboard_config.py
new file mode 100644
index 000000000000..64688b377376
--- /dev/null
+++ b/products/dashboards/backend/models/team_home_tab_dashboard_config.py
@@ -0,0 +1,29 @@
+from django.db import models
+
+from posthog.models.scoping.manager import EnvironmentScopedManager
+
+
+class TeamHomeTabDashboardConfig(models.Model):
+ """Per-team choice of which dashboard the product analytics Home tab shows. Lives on a Team
+ extension so posthog_team is never ALTERed."""
+
+ # db_constraint=False: a real FK constraint takes SHARE ROW EXCLUSIVE on posthog_team while
+ # migrating, stalling writes under traffic. String reference avoids importing Team at module
+ # load time, which would circularly re-enter posthog.models.team (see dashboard_templates.py).
+ team = models.OneToOneField(
+ "posthog.Team", on_delete=models.CASCADE, primary_key=True, db_constraint=False, related_name="+"
+ )
+
+ dashboard = models.ForeignKey(
+ "dashboards.Dashboard",
+ on_delete=models.SET_NULL,
+ null=True,
+ blank=True,
+ related_name="+",
+ help_text="Dashboard shown on the product analytics Home tab. Null shows the built-in generic view.",
+ )
+
+ objects = EnvironmentScopedManager()
+
+ class Meta:
+ app_label = "dashboards"
diff --git a/products/product_analytics/frontend/insights/home/HomeDashboardStarterModal.stories.tsx b/products/product_analytics/frontend/insights/home/HomeDashboardStarterModal.stories.tsx
new file mode 100644
index 000000000000..5b1efd05322c
--- /dev/null
+++ b/products/product_analytics/frontend/insights/home/HomeDashboardStarterModal.stories.tsx
@@ -0,0 +1,45 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { HomeDashboardStarterModal } from './HomeDashboardStarterModal'
+
+const noop = (): void => undefined
+
+const meta: Meta<typeof HomeDashboardStarterModal> = {
+ component: HomeDashboardStarterModal,
+ title: 'Scenes-App/Product analytics home dashboard starter',
+ args: {
+ isOpen: true,
+ onClose: noop,
+ onTalkToAI: noop,
+ onStartFromTemplate: noop,
+ onChooseExisting: noop,
+ onRestorePostHogHome: noop,
+ hasCustomDashboard: false,
+ },
+ parameters: {
+ layout: 'fullscreen',
+ },
+}
+export default meta
+
+type Story = StoryObj<typeof HomeDashboardStarterModal>
+
+export const Default: Story = {}
+
+export const WithCustomDashboard: Story = {
+ args: { hasCustomDashboard: true },
+}
+
+export const CreatingWithAI: Story = {
+ args: { hasCustomDashboard: true, creatingWithAI: true },
+ parameters: { testOptions: { waitForLoadersToDisappear: false } },
+}
+
+export const AIUnavailable: Story = {
+ args: { aiDisabledReason: 'Approve AI data processing to use PostHog AI' },
+}
+
+export const Narrow: Story = {
+ args: { hasCustomDashboard: true },
+ parameters: { testOptions: { viewport: { width: 552, height: 900 } } },
+}
diff --git a/products/product_analytics/frontend/insights/home/HomeDashboardStarterModal.tsx b/products/product_analytics/frontend/insights/home/HomeDashboardStarterModal.tsx
new file mode 100644
index 000000000000..816904f95b66
--- /dev/null
+++ b/products/product_analytics/frontend/insights/home/HomeDashboardStarterModal.tsx
@@ -0,0 +1,114 @@
+import { IconChevronRight, IconDashboard, IconHome, IconSparkles, IconStack } from '@posthog/icons'
+import { LemonButton, LemonModal } from '@posthog/lemon-ui'
+
+export interface HomeDashboardStarterModalProps {
+ isOpen: boolean
+ onClose: () => void
+ onTalkToAI: () => void
+ onStartFromTemplate: () => void
+ onChooseExisting: () => void
+ hasCustomDashboard: boolean
+ onRestorePostHogHome?: () => void
+ restoringPostHogHome?: boolean
+ creatingWithAI?: boolean
+ aiDisabledReason?: string | false
+}
+
+export function HomeDashboardStarterModal({
+ isOpen,
+ onClose,
+ onTalkToAI,
+ onStartFromTemplate,
+ onChooseExisting,
+ hasCustomDashboard,
+ onRestorePostHogHome,
+ restoringPostHogHome = false,
+ creatingWithAI = false,
+ aiDisabledReason,
+}: HomeDashboardStarterModalProps): JSX.Element {
+ const creationDisabledReason = creatingWithAI ? 'Creating your dashboard…' : undefined
+ const choices = [
+ {
+ title: 'Talk to PostHog AI',
+ description: 'Describe what you want to track and let PostHog AI build it.',
+ icon: <IconSparkles />,
+ onClick: onTalkToAI,
+ dataAttr: 'home-dashboard-start-ai',
+ loading: creatingWithAI,
+ disabledReason: creationDisabledReason || aiDisabledReason,
+ },
+ {
+ title: 'Start from a template',
+ description: 'Choose a ready-made dashboard and adapt it to your product.',
+ icon: <IconStack />,
+ onClick: onStartFromTemplate,
+ dataAttr: 'home-dashboard-start-template',
+ loading: false,
+ disabledReason: creationDisabledReason,
+ },
+ {
+ title: 'Choose an existing dashboard',
+ description: 'Use one of this project’s dashboards for Home.',
+ icon: <IconDashboard />,
+ onClick: onChooseExisting,
+ dataAttr: 'home-dashboard-choose-existing',
+ loading: false,
+ disabledReason: creationDisabledReason,
+ },
+ ]
+
+ return (
+ <LemonModal
+ isOpen={isOpen}
+ onClose={onClose}
+ title="Make my own dashboard"
+ description="Choose how to get started, or use a dashboard you already have."
+ width="38rem"
+ maxWidth="calc(100vw - 2rem)"
+ data-attr="home-dashboard-starter-modal"
+ >
+ <div className="min-w-0 overflow-hidden rounded border border-primary divide-y divide-border">
+ {choices.map(({ title, description, icon, onClick, dataAttr, loading, disabledReason }) => (
+ <LemonButton
+ key={dataAttr}
+ type="tertiary"
+ fullWidth
+ icon={icon}
+ sideIcon={<IconChevronRight />}
+ className="!rounded-none"
+ onClick={onClick}
+ loading={loading}
+ disabledReason={disabledReason}
+ data-attr={dataAttr}
+ >
+ <span className="flex min-w-0 flex-col gap-0.5 py-2">
+ <span className="whitespace-normal font-semibold">{title}</span>
+ <span className="whitespace-normal text-xs font-normal text-secondary">{description}</span>
+ </span>
+ </LemonButton>
+ ))}
+ </div>
+ {hasCustomDashboard && onRestorePostHogHome ? (
+ <div className="mt-4 border-t border-primary pt-3">
+ <LemonButton
+ type="tertiary"
+ fullWidth
+ icon={<IconHome />}
+ sideIcon={<IconChevronRight />}
+ onClick={onRestorePostHogHome}
+ loading={restoringPostHogHome}
+ disabledReason={creationDisabledReason}
+ data-attr="home-dashboard-restore-posthog-home"
+ >
+ <span className="flex min-w-0 flex-col gap-0.5 py-1">
+ <span className="font-semibold">Use PostHog Home</span>
+ <span className="whitespace-normal text-xs font-normal text-secondary">
+ Return to the ready-made product analytics overview.
+ </span>
+ </span>
+ </LemonButton>
+ </div>
+ ) : null}
+ </LemonModal>
+ )
+}
diff --git a/products/product_analytics/frontend/insights/home/HomeTabExplore.tsx b/products/product_analytics/frontend/insights/home/HomeTabExplore.tsx
new file mode 100644
index 000000000000..0944c3d23b7d
--- /dev/null
+++ b/products/product_analytics/frontend/insights/home/HomeTabExplore.tsx
@@ -0,0 +1,87 @@
+import { combineUrl } from 'kea-router'
+
+import * as chartPng from '@posthog/brand/hoggies/png/chart'
+import * as explorerPng from '@posthog/brand/hoggies/png/explorer'
+import * as loopsPng from '@posthog/brand/hoggies/png/loops'
+import { LemonButton, LemonCard } from '@posthog/lemon-ui'
+
+import { pngHoggie } from 'lib/brand/hoggies'
+import { urls } from 'scenes/urls'
+
+import { InsightType } from '~/types'
+
+const HedgehogChart = pngHoggie(chartPng)
+const HedgehogExplorer = pngHoggie(explorerPng)
+const HedgehogLoops = pngHoggie(loopsPng)
+
+const analyses = [
+ {
+ type: InsightType.FUNNELS,
+ Hedgehog: HedgehogChart,
+ name: 'Funnels',
+ question: 'Where do people drop off?',
+ description: 'Measure conversion between the steps people take.',
+ dataAttr: 'home-tab-explore-funnels',
+ },
+ {
+ type: InsightType.PATHS,
+ Hedgehog: HedgehogExplorer,
+ name: 'Paths',
+ question: 'What do people do next?',
+ description: 'See the actions people take before or after an event.',
+ dataAttr: 'home-tab-explore-paths',
+ },
+ {
+ type: InsightType.STICKINESS,
+ Hedgehog: HedgehogLoops,
+ name: 'Stickiness',
+ question: 'How often do people come back?',
+ description: 'Measure how many days people use a feature.',
+ dataAttr: 'home-tab-explore-stickiness',
+ },
+]
+
+export function HomeTabExplore(): JSX.Element {
+ return (
+ <section aria-labelledby="home-tab-explore-heading" className="@container/home-explore min-w-0">
+ <LemonCard hoverEffect={false} className="flex h-full min-w-0 flex-col overflow-hidden p-0">
+ <div className="border-b border-primary px-4 py-3">
+ <span className="text-xs font-medium text-secondary">Explore</span>
+ <h2 id="home-tab-explore-heading" className="m-0 text-base font-semibold">
+ Answer your next question
+ </h2>
+ </div>
+ <ul className="m-0 flex flex-1 list-none flex-col p-0">
+ {analyses.map(({ type, Hedgehog, name, question, description, dataAttr }) => (
+ <li
+ key={type}
+ className="grid flex-1 grid-cols-1 items-center gap-2 border-b border-primary px-4 py-2 last:border-b-0 @min-[19rem]/home-explore:grid-cols-[4rem_minmax(0,1fr)]"
+ >
+ <Hedgehog
+ className="hidden h-16 w-16 @min-[19rem]/home-explore:block"
+ aria-hidden="true"
+ loading="eager"
+ />
+ <div className="min-w-0">
+ <div className="flex flex-wrap items-center justify-between gap-x-2 gap-y-1">
+ <span className="text-xs font-medium text-secondary">{name}</span>
+ <LemonButton
+ type="tertiary"
+ size="small"
+ to={combineUrl(urls.insightNew({ type }), { homeGuide: type }).url}
+ aria-label={`Learn and build a ${name.toLowerCase()} insight`}
+ data-attr={dataAttr}
+ >
+ Learn and build
+ </LemonButton>
+ </div>
+ <h3 className="m-0 text-sm font-semibold">{question}</h3>
+ <p className="m-0 text-xs text-secondary">{description}</p>
+ </div>
+ </li>
+ ))}
+ </ul>
+ </LemonCard>
+ </section>
+ )
+}
diff --git a/products/product_analytics/frontend/insights/home/InsightHomeGuide.stories.tsx b/products/product_analytics/frontend/insights/home/InsightHomeGuide.stories.tsx
new file mode 100644
index 000000000000..ae534511f157
--- /dev/null
+++ b/products/product_analytics/frontend/insights/home/InsightHomeGuide.stories.tsx
@@ -0,0 +1,55 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { getDefaultQuery } from '~/queries/nodes/InsightViz/utils'
+import { InsightType } from '~/types'
+
+import { InsightHomeGuide } from './InsightHomeGuide'
+
+const meta: Meta<typeof InsightHomeGuide> = {
+ component: InsightHomeGuide,
+ title: 'Scenes-App/Insights/Product analytics/Insight home guide',
+ parameters: {
+ pageUrl: '/insights/new?homeGuide=FUNNELS#insight=FUNNELS',
+ layout: 'centered',
+ },
+ render: (args) => (
+ <div className="w-[960px] max-w-full">
+ <InsightHomeGuide {...args} />
+ </div>
+ ),
+}
+export default meta
+
+type Story = StoryObj<typeof InsightHomeGuide>
+
+export const Funnels: Story = {
+ args: { query: getDefaultQuery(InsightType.FUNNELS, false) },
+}
+
+export const Paths: Story = {
+ parameters: { pageUrl: '/insights/new?homeGuide=PATHS#insight=PATHS' },
+ args: { query: getDefaultQuery(InsightType.PATHS, false) },
+}
+
+export const Stickiness: Story = {
+ parameters: { pageUrl: '/insights/new?homeGuide=STICKINESS#insight=STICKINESS' },
+ args: { query: getDefaultQuery(InsightType.STICKINESS, false) },
+}
+
+export const Narrow: Story = {
+ args: { query: getDefaultQuery(InsightType.FUNNELS, false) },
+ render: (args) => (
+ <div className="w-[512px] max-w-full">
+ <InsightHomeGuide {...args} />
+ </div>
+ ),
+}
+
+export const Phone: Story = {
+ args: { query: getDefaultQuery(InsightType.FUNNELS, false) },
+ render: (args) => (
+ <div className="w-72">
+ <InsightHomeGuide {...args} />
+ </div>
+ ),
+}
diff --git a/products/product_analytics/frontend/insights/home/InsightHomeGuide.test.tsx b/products/product_analytics/frontend/insights/home/InsightHomeGuide.test.tsx
new file mode 100644
index 000000000000..3532e83ba15f
--- /dev/null
+++ b/products/product_analytics/frontend/insights/home/InsightHomeGuide.test.tsx
@@ -0,0 +1,47 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { router } from 'kea-router'
+
+import { getDefaultQuery } from '~/queries/nodes/InsightViz/utils'
+import { initKeaTests } from '~/test/init'
+import { InsightType } from '~/types'
+
+import { InsightHomeGuide } from './InsightHomeGuide'
+
+describe('InsightHomeGuide', () => {
+ beforeEach(() => initKeaTests())
+ afterEach(cleanup)
+
+ it('remains visible after the editor replaces the insight hash with a draft query', () => {
+ const query = getDefaultQuery(InsightType.FUNNELS, false)
+ router.actions.push('/insights/new', { homeGuide: InsightType.FUNNELS }, { q: JSON.stringify(query) })
+
+ render(<InsightHomeGuide query={query} />)
+
+ expect(screen.getByText('Build a funnel')).toBeInTheDocument()
+ })
+
+ it('dismisses the guide without losing the draft query or other URL parameters', () => {
+ const query = getDefaultQuery(InsightType.FUNNELS, false)
+ const draft = JSON.stringify(query)
+ router.actions.push('/insights/new', { homeGuide: InsightType.FUNNELS, foo: 'bar' }, { q: draft })
+ const { container } = render(<InsightHomeGuide query={query} />)
+
+ fireEvent.click(container.querySelector('[data-attr="insight-home-guide-dismiss"]')!)
+
+ expect(screen.queryByText('Build a funnel')).not.toBeInTheDocument()
+ expect(router.values.searchParams).toEqual({ foo: 'bar' })
+ expect(router.values.hashParams.q).toBe(draft)
+ })
+
+ it('only renders a known guide for its matching query type', () => {
+ router.actions.push('/insights/new', { homeGuide: InsightType.FUNNELS }, { insight: InsightType.FUNNELS })
+ const { container, rerender } = render(<InsightHomeGuide query={getDefaultQuery(InsightType.PATHS, false)} />)
+ expect(container).toBeEmptyDOMElement()
+
+ router.actions.push('/insights/new', { homeGuide: 'toString' }, { insight: InsightType.FUNNELS })
+ rerender(<InsightHomeGuide query={getDefaultQuery(InsightType.FUNNELS, false)} />)
+ expect(container).toBeEmptyDOMElement()
+ })
+})
diff --git a/products/product_analytics/frontend/insights/home/InsightHomeGuide.tsx b/products/product_analytics/frontend/insights/home/InsightHomeGuide.tsx
new file mode 100644
index 000000000000..5ee426af7eea
--- /dev/null
+++ b/products/product_analytics/frontend/insights/home/InsightHomeGuide.tsx
@@ -0,0 +1,156 @@
+import { useValues } from 'kea'
+import { router } from 'kea-router'
+
+import * as chartPng from '@posthog/brand/hoggies/png/chart'
+import * as explorerPng from '@posthog/brand/hoggies/png/explorer'
+import * as loopsPng from '@posthog/brand/hoggies/png/loops'
+import { IconX } from '@posthog/icons'
+import { LemonButton, LemonCard } from '@posthog/lemon-ui'
+
+import { pngHoggie } from 'lib/brand/hoggies'
+import { Link } from 'lib/lemon-ui/Link'
+
+import { Node, NodeKind } from '~/queries/schema/schema-general'
+import { isInsightVizNode } from '~/queries/utils'
+import { InsightType } from '~/types'
+
+type GuidedInsightType = InsightType.FUNNELS | InsightType.PATHS | InsightType.STICKINESS
+
+const GUIDE_ARTWORK = {
+ [InsightType.FUNNELS]: pngHoggie(chartPng),
+ [InsightType.PATHS]: pngHoggie(explorerPng),
+ [InsightType.STICKINESS]: pngHoggie(loopsPng),
+}
+
+const GUIDE_QUERY_KIND: Record<GuidedInsightType, NodeKind> = {
+ [InsightType.FUNNELS]: NodeKind.FunnelsQuery,
+ [InsightType.PATHS]: NodeKind.PathsQuery,
+ [InsightType.STICKINESS]: NodeKind.StickinessQuery,
+}
+
+function isGuidedInsightType(value: unknown): value is GuidedInsightType {
+ return value === InsightType.FUNNELS || value === InsightType.PATHS || value === InsightType.STICKINESS
+}
+
+interface GuideContent {
+ title: string
+ explanation: string
+ example: string
+ steps: [string, string, string]
+ resources: { label: string; url: string }[]
+}
+
+const GUIDE_CONTENT: Record<GuidedInsightType, GuideContent> = {
+ [InsightType.FUNNELS]: {
+ title: 'Build a funnel',
+ explanation: 'See how many people complete a sequence of actions and where they leave it.',
+ example: 'For example: view a product, start checkout, then complete a purchase.',
+ steps: [
+ 'Choose the event that starts the journey.',
+ 'Add the next events in the order people should complete them.',
+ 'Use the results to find the step with the largest drop-off.',
+ ],
+ resources: [{ label: 'Funnel analysis guide', url: 'https://posthog.com/docs/product-analytics/funnels' }],
+ },
+ [InsightType.PATHS]: {
+ title: 'Explore paths',
+ explanation: 'See the routes people take through pages, screens, and events.',
+ example: 'For example: start at a pricing page and follow the next actions people take.',
+ steps: [
+ 'Choose the events or pages to include.',
+ 'Set a start or end point when you have a specific journey in mind.',
+ 'Follow the branches to find common routes and unexpected detours.',
+ ],
+ resources: [{ label: 'User paths guide', url: 'https://posthog.com/docs/product-analytics/paths' }],
+ },
+ [InsightType.STICKINESS]: {
+ title: 'Measure stickiness',
+ explanation: 'See how often people repeat an action within a period.',
+ example: 'For example: how many people viewed a page on three or more days this week?',
+ steps: [
+ 'Choose the event that represents meaningful activity.',
+ 'Pick the date range and interval you want to study.',
+ 'Read the frequency chart to see how many days people used the feature.',
+ ],
+ resources: [
+ { label: 'Stickiness overview', url: 'https://posthog.com/docs/product-analytics/insights#stickiness' },
+ {
+ label: 'App and feature stickiness examples',
+ url: 'https://posthog.com/product-engineers/mobile-app-metrics-kpis#6-app-and-feature-stickiness',
+ },
+ ],
+ },
+}
+
+export function InsightHomeGuide({ query }: { query: Node | null }): JSX.Element | null {
+ const { location, searchParams, hashParams } = useValues(router)
+ const requestedType = searchParams.homeGuide
+
+ if (!isGuidedInsightType(requestedType) || !isInsightVizNode(query)) {
+ return null
+ }
+
+ if (query.source.kind !== GUIDE_QUERY_KIND[requestedType]) {
+ return null
+ }
+
+ const guide = GUIDE_CONTENT[requestedType]
+ const Hedgehog = GUIDE_ARTWORK[requestedType]
+
+ const dismiss = (): void => {
+ const nextSearchParams = { ...searchParams }
+ delete nextSearchParams.homeGuide
+ router.actions.replace(location.pathname, nextSearchParams, hashParams)
+ }
+
+ return (
+ <LemonCard hoverEffect={false} className="@container/insight-home-guide mb-1 overflow-hidden p-0">
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ icon={<IconX />}
+ onClick={dismiss}
+ aria-label="close"
+ tooltip="Dismiss guide"
+ data-attr="insight-home-guide-dismiss"
+ className="absolute right-2 top-2"
+ />
+ <div className="flex items-center gap-4 px-4 py-4 pr-10 @min-[32rem]/insight-home-guide:px-5 @min-[32rem]/insight-home-guide:pr-10">
+ <Hedgehog
+ className="hidden h-20 w-20 shrink-0 @min-[32rem]/insight-home-guide:block @min-[48rem]/insight-home-guide:h-24 @min-[48rem]/insight-home-guide:w-24"
+ aria-hidden="true"
+ loading="eager"
+ />
+ <div className="min-w-0">
+ <h2 className="m-0 mb-1 text-lg font-semibold">{guide.title}</h2>
+ <p className="m-0 text-sm">{guide.explanation}</p>
+ <p className="m-0 mt-1 text-sm text-secondary">{guide.example}</p>
+ </div>
+ </div>
+ <div className="border-t border-primary bg-fill-secondary px-4 py-3 @min-[32rem]/insight-home-guide:px-5">
+ <h3 className="m-0 mb-3 text-xs font-semibold text-secondary">Get started</h3>
+ <ol className="m-0 flex list-none flex-col gap-3 p-0">
+ {guide.steps.map((step, index) => (
+ <li key={step} className="flex items-start gap-3 text-sm">
+ <span
+ className="flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-primary bg-surface-primary text-xs font-semibold text-secondary"
+ aria-hidden="true"
+ >
+ {index + 1}
+ </span>
+ <span>{step}</span>
+ </li>
+ ))}
+ </ol>
+ <div className="mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs">
+ <span className="text-secondary">Read more:</span>
+ {guide.resources.map(({ label, url }) => (
+ <Link key={url} to={url} target="_blank" targetBlankIcon>
+ {label}
+ </Link>
+ ))}
+ </div>
+ </div>
+ </LemonCard>
+ )
+}
diff --git a/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx b/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
index 4d03c58d8a2e..5e02ff2dcf0e 100644
--- a/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
+++ b/products/product_analytics/frontend/insights/retention/RetentionLineChart/RetentionLineChart.tsx
@@ -10,6 +10,7 @@ import { getColorVar } from 'lib/colors'
import { roundToDecimal } from 'lib/utils/numbers'
import { insightLogic } from 'scenes/insights/insightLogic'
import type { SeriesDatum } from 'scenes/insights/InsightTooltip/insightTooltipUtils'
+import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { groupsModel } from '~/models/groupsModel'
import type { GoalLine } from '~/queries/schema/schema-general'
@@ -57,6 +58,7 @@ function resolveGroupTypeLabel(
export function RetentionLineChart({ inSharedMode = false }: RetentionLineChartProps): JSX.Element | null {
const { insightProps } = useValues(insightLogic)
+ const { insightDataLoading } = useValues(insightVizDataLogic(insightProps))
const theme = useChartTheme()
const {
@@ -209,6 +211,14 @@ export function RetentionLineChart({ inSharedMode = false }: RetentionLineChartP
)
}
+ if (series.length === 0) {
+ return insightDataLoading ? null : (
+ <p className="m-0 w-full text-center text-sm text-secondary">
+ No retention data in this date range. Try a longer date range.
+ </p>
+ )
+ }
+
return (
<TimeSeriesLineChart<RetentionSeriesMeta>
series={series}
diff --git a/products/product_analytics/frontend/insights/retention/retentionGraphLogic.test.ts b/products/product_analytics/frontend/insights/retention/retentionGraphLogic.test.ts
index 647f1a7480df..9e35b692c55c 100644
--- a/products/product_analytics/frontend/insights/retention/retentionGraphLogic.test.ts
+++ b/products/product_analytics/frontend/insights/retention/retentionGraphLogic.test.ts
@@ -127,6 +127,13 @@ describe('retentionGraphLogic', () => {
expect(logic.values.xAxisLabels).toEqual(['2024-01-01T00:00:00.000Z', '2025-01-01T00:00:00.000Z'])
})
+ it('provides empty chart labels when a retention query has no cohorts', async () => {
+ await loadResults({ kind: NodeKind.RetentionQuery, retentionFilter: { period: RetentionPeriod.Week } }, [])
+
+ expect(logic.values.filteredTrendSeries).toEqual([])
+ expect(logic.values.xAxisLabels).toEqual([])
+ })
+
it('per-cohort series keep rawBreakdownValue unset when filtered to one breakdown value', async () => {
await loadResults(breakdownQuery, breakdownRows)
diff --git a/products/product_analytics/frontend/insights/retention/retentionGraphLogic.ts b/products/product_analytics/frontend/insights/retention/retentionGraphLogic.ts
index 5d9fe4b84857..58eaa803ee45 100644
--- a/products/product_analytics/frontend/insights/retention/retentionGraphLogic.ts
+++ b/products/product_analytics/frontend/insights/retention/retentionGraphLogic.ts
@@ -470,7 +470,7 @@ export const retentionGraphLogic = kea<retentionGraphLogicType>([
}
return labels
}
- return results?.[0]?.values.map((_, i) => `${period} ${i + offset}`)
+ return results?.[0]?.values.map((_, i) => `${period} ${i + offset}`) ?? []
},
],
}),
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 3c8e8a449fd8..a6369ad4817a 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -80881,6 +80881,11 @@ export namespace Schemas {
* @nullable
*/
primary_dashboard?: number | null;
+ /**
+ * ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view.
+ * @nullable
+ */
+ home_tab_dashboard?: number | null;
/** @nullable */
live_events_columns?: string[] | null;
/**
@@ -85757,6 +85762,11 @@ export namespace Schemas {
* @nullable
*/
primary_dashboard?: number | null;
+ /**
+ * ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view.
+ * @nullable
+ */
+ home_tab_dashboard?: number | null;
/** @nullable */
live_events_columns?: string[] | null;
/**
@@ -85891,6 +85901,825 @@ export namespace Schemas {
app_urls: string[];
}
+ /**
+ * Settings for Conversations. Must be a JSON object or null.
+ * @nullable
+ */
+ export type ProjectCreateRequestConversationsSettings = { [key: string]: unknown } | null;
+
+ /**
+ * A project and its settings, including the settings that live on its passthrough Team.
+ *
+ * This shape is a superset of TeamSerializer's, so a request rewritten from /api/environments/
+ * onto /api/projects/ never loses a field.
+ */
+ export interface ProjectCreateRequest {
+ /**
+ * Project name. Must be unique within the organization (case-insensitive). If omitted on creation, a unique default name is generated.
+ * @minLength 1
+ * @maxLength 200
+ */
+ name?: string;
+ /**
+ * Short description of what the project is about. This is helpful to give our AI agents context about your project.
+ * @maxLength 1000
+ * @nullable
+ */
+ product_description?: string | null;
+ /**
+ * Labels applied to this project. Names are trimmed and lowercased, and sending this field replaces the project's existing tags.
+ * @items.maxLength 255
+ */
+ tags?: string[];
+ /** @items.maxLength 200 */
+ app_urls?: (string | null)[];
+ /** When true, PostHog drops the IP address from every ingested event. */
+ anonymize_ips?: boolean;
+ completed_snippet_onboarding?: boolean;
+ /** Filter groups that identify internal/test traffic to be excluded from insights. */
+ test_account_filters?: unknown;
+ /**
+ * When true, new insights default to excluding internal/test users.
+ * @nullable
+ */
+ test_account_filters_default_checked?: boolean | null;
+ /** Regex rewrite rules that collapse dynamic path segments (e.g. user IDs) before displaying URLs in paths. */
+ path_cleaning_filters?: unknown;
+ is_demo?: boolean;
+ /** IANA timezone used for date-based filters and reporting (e.g. `America/Los_Angeles`).
+ *
+ * * `Africa/Abidjan` - Africa/Abidjan
+ * * `Africa/Accra` - Africa/Accra
+ * * `Africa/Addis_Ababa` - Africa/Addis_Ababa
+ * * `Africa/Algiers` - Africa/Algiers
+ * * `Africa/Asmara` - Africa/Asmara
+ * * `Africa/Asmera` - Africa/Asmera
+ * * `Africa/Bamako` - Africa/Bamako
+ * * `Africa/Bangui` - Africa/Bangui
+ * * `Africa/Banjul` - Africa/Banjul
+ * * `Africa/Bissau` - Africa/Bissau
+ * * `Africa/Blantyre` - Africa/Blantyre
+ * * `Africa/Brazzaville` - Africa/Brazzaville
+ * * `Africa/Bujumbura` - Africa/Bujumbura
+ * * `Africa/Cairo` - Africa/Cairo
+ * * `Africa/Casablanca` - Africa/Casablanca
+ * * `Africa/Ceuta` - Africa/Ceuta
+ * * `Africa/Conakry` - Africa/Conakry
+ * * `Africa/Dakar` - Africa/Dakar
+ * * `Africa/Dar_es_Salaam` - Africa/Dar_es_Salaam
+ * * `Africa/Djibouti` - Africa/Djibouti
+ * * `Africa/Douala` - Africa/Douala
+ * * `Africa/El_Aaiun` - Africa/El_Aaiun
+ * * `Africa/Freetown` - Africa/Freetown
+ * * `Africa/Gaborone` - Africa/Gaborone
+ * * `Africa/Harare` - Africa/Harare
+ * * `Africa/Johannesburg` - Africa/Johannesburg
+ * * `Africa/Juba` - Africa/Juba
+ * * `Africa/Kampala` - Africa/Kampala
+ * * `Africa/Khartoum` - Africa/Khartoum
+ * * `Africa/Kigali` - Africa/Kigali
+ * * `Africa/Kinshasa` - Africa/Kinshasa
+ * * `Africa/Lagos` - Africa/Lagos
+ * * `Africa/Libreville` - Africa/Libreville
+ * * `Africa/Lome` - Africa/Lome
+ * * `Africa/Luanda` - Africa/Luanda
+ * * `Africa/Lubumbashi` - Africa/Lubumbashi
+ * * `Africa/Lusaka` - Africa/Lusaka
+ * * `Africa/Malabo` - Africa/Malabo
+ * * `Africa/Maputo` - Africa/Maputo
+ * * `Africa/Maseru` - Africa/Maseru
+ * * `Africa/Mbabane` - Africa/Mbabane
+ * * `Africa/Mogadishu` - Africa/Mogadishu
+ * * `Africa/Monrovia` - Africa/Monrovia
+ * * `Africa/Nairobi` - Africa/Nairobi
+ * * `Africa/Ndjamena` - Africa/Ndjamena
+ * * `Africa/Niamey` - Africa/Niamey
+ * * `Africa/Nouakchott` - Africa/Nouakchott
+ * * `Africa/Ouagadougou` - Africa/Ouagadougou
+ * * `Africa/Porto-Novo` - Africa/Porto-Novo
+ * * `Africa/Sao_Tome` - Africa/Sao_Tome
+ * * `Africa/Timbuktu` - Africa/Timbuktu
+ * * `Africa/Tripoli` - Africa/Tripoli
+ * * `Africa/Tunis` - Africa/Tunis
+ * * `Africa/Windhoek` - Africa/Windhoek
+ * * `America/Adak` - America/Adak
+ * * `America/Anchorage` - America/Anchorage
+ * * `America/Anguilla` - America/Anguilla
+ * * `America/Antigua` - America/Antigua
+ * * `America/Araguaina` - America/Araguaina
+ * * `America/Argentina/Buenos_Aires` - America/Argentina/Buenos_Aires
+ * * `America/Argentina/Catamarca` - America/Argentina/Catamarca
+ * * `America/Argentina/ComodRivadavia` - America/Argentina/ComodRivadavia
+ * * `America/Argentina/Cordoba` - America/Argentina/Cordoba
+ * * `America/Argentina/Jujuy` - America/Argentina/Jujuy
+ * * `America/Argentina/La_Rioja` - America/Argentina/La_Rioja
+ * * `America/Argentina/Mendoza` - America/Argentina/Mendoza
+ * * `America/Argentina/Rio_Gallegos` - America/Argentina/Rio_Gallegos
+ * * `America/Argentina/Salta` - America/Argentina/Salta
+ * * `America/Argentina/San_Juan` - America/Argentina/San_Juan
+ * * `America/Argentina/San_Luis` - America/Argentina/San_Luis
+ * * `America/Argentina/Tucuman` - America/Argentina/Tucuman
+ * * `America/Argentina/Ushuaia` - America/Argentina/Ushuaia
+ * * `America/Aruba` - America/Aruba
+ * * `America/Asuncion` - America/Asuncion
+ * * `America/Atikokan` - America/Atikokan
+ * * `America/Atka` - America/Atka
+ * * `America/Bahia` - America/Bahia
+ * * `America/Bahia_Banderas` - America/Bahia_Banderas
+ * * `America/Barbados` - America/Barbados
+ * * `America/Belem` - America/Belem
+ * * `America/Belize` - America/Belize
+ * * `America/Blanc-Sablon` - America/Blanc-Sablon
+ * * `America/Boa_Vista` - America/Boa_Vista
+ * * `America/Bogota` - America/Bogota
+ * * `America/Boise` - America/Boise
+ * * `America/Buenos_Aires` - America/Buenos_Aires
+ * * `America/Cambridge_Bay` - America/Cambridge_Bay
+ * * `America/Campo_Grande` - America/Campo_Grande
+ * * `America/Cancun` - America/Cancun
+ * * `America/Caracas` - America/Caracas
+ * * `America/Catamarca` - America/Catamarca
+ * * `America/Cayenne` - America/Cayenne
+ * * `America/Cayman` - America/Cayman
+ * * `America/Chicago` - America/Chicago
+ * * `America/Chihuahua` - America/Chihuahua
+ * * `America/Ciudad_Juarez` - America/Ciudad_Juarez
+ * * `America/Coral_Harbour` - America/Coral_Harbour
+ * * `America/Cordoba` - America/Cordoba
+ * * `America/Costa_Rica` - America/Costa_Rica
+ * * `America/Creston` - America/Creston
+ * * `America/Cuiaba` - America/Cuiaba
+ * * `America/Curacao` - America/Curacao
+ * * `America/Danmarkshavn` - America/Danmarkshavn
+ * * `America/Dawson` - America/Dawson
+ * * `America/Dawson_Creek` - America/Dawson_Creek
+ * * `America/Denver` - America/Denver
+ * * `America/Detroit` - America/Detroit
+ * * `America/Dominica` - America/Dominica
+ * * `America/Edmonton` - America/Edmonton
+ * * `America/Eirunepe` - America/Eirunepe
+ * * `America/El_Salvador` - America/El_Salvador
+ * * `America/Ensenada` - America/Ensenada
+ * * `America/Fort_Nelson` - America/Fort_Nelson
+ * * `America/Fort_Wayne` - America/Fort_Wayne
+ * * `America/Fortaleza` - America/Fortaleza
+ * * `America/Glace_Bay` - America/Glace_Bay
+ * * `America/Godthab` - America/Godthab
+ * * `America/Goose_Bay` - America/Goose_Bay
+ * * `America/Grand_Turk` - America/Grand_Turk
+ * * `America/Grenada` - America/Grenada
+ * * `America/Guadeloupe` - America/Guadeloupe
+ * * `America/Guatemala` - America/Guatemala
+ * * `America/Guayaquil` - America/Guayaquil
+ * * `America/Guyana` - America/Guyana
+ * * `America/Halifax` - America/Halifax
+ * * `America/Havana` - America/Havana
+ * * `America/Hermosillo` - America/Hermosillo
+ * * `America/Indiana/Indianapolis` - America/Indiana/Indianapolis
+ * * `America/Indiana/Knox` - America/Indiana/Knox
+ * * `America/Indiana/Marengo` - America/Indiana/Marengo
+ * * `America/Indiana/Petersburg` - America/Indiana/Petersburg
+ * * `America/Indiana/Tell_City` - America/Indiana/Tell_City
+ * * `America/Indiana/Vevay` - America/Indiana/Vevay
+ * * `America/Indiana/Vincennes` - America/Indiana/Vincennes
+ * * `America/Indiana/Winamac` - America/Indiana/Winamac
+ * * `America/Indianapolis` - America/Indianapolis
+ * * `America/Inuvik` - America/Inuvik
+ * * `America/Iqaluit` - America/Iqaluit
+ * * `America/Jamaica` - America/Jamaica
+ * * `America/Jujuy` - America/Jujuy
+ * * `America/Juneau` - America/Juneau
+ * * `America/Kentucky/Louisville` - America/Kentucky/Louisville
+ * * `America/Kentucky/Monticello` - America/Kentucky/Monticello
+ * * `America/Knox_IN` - America/Knox_IN
+ * * `America/Kralendijk` - America/Kralendijk
+ * * `America/La_Paz` - America/La_Paz
+ * * `America/Lima` - America/Lima
+ * * `America/Los_Angeles` - America/Los_Angeles
+ * * `America/Louisville` - America/Louisville
+ * * `America/Lower_Princes` - America/Lower_Princes
+ * * `America/Maceio` - America/Maceio
+ * * `America/Managua` - America/Managua
+ * * `America/Manaus` - America/Manaus
+ * * `America/Marigot` - America/Marigot
+ * * `America/Martinique` - America/Martinique
+ * * `America/Matamoros` - America/Matamoros
+ * * `America/Mazatlan` - America/Mazatlan
+ * * `America/Mendoza` - America/Mendoza
+ * * `America/Menominee` - America/Menominee
+ * * `America/Merida` - America/Merida
+ * * `America/Metlakatla` - America/Metlakatla
+ * * `America/Mexico_City` - America/Mexico_City
+ * * `America/Miquelon` - America/Miquelon
+ * * `America/Moncton` - America/Moncton
+ * * `America/Monterrey` - America/Monterrey
+ * * `America/Montevideo` - America/Montevideo
+ * * `America/Montreal` - America/Montreal
+ * * `America/Montserrat` - America/Montserrat
+ * * `America/Nassau` - America/Nassau
+ * * `America/New_York` - America/New_York
+ * * `America/Nipigon` - America/Nipigon
+ * * `America/Nome` - America/Nome
+ * * `America/Noronha` - America/Noronha
+ * * `America/North_Dakota/Beulah` - America/North_Dakota/Beulah
+ * * `America/North_Dakota/Center` - America/North_Dakota/Center
+ * * `America/North_Dakota/New_Salem` - America/North_Dakota/New_Salem
+ * * `America/Nuuk` - America/Nuuk
+ * * `America/Ojinaga` - America/Ojinaga
+ * * `America/Panama` - America/Panama
+ * * `America/Pangnirtung` - America/Pangnirtung
+ * * `America/Paramaribo` - America/Paramaribo
+ * * `America/Phoenix` - America/Phoenix
+ * * `America/Port-au-Prince` - America/Port-au-Prince
+ * * `America/Port_of_Spain` - America/Port_of_Spain
+ * * `America/Porto_Acre` - America/Porto_Acre
+ * * `America/Porto_Velho` - America/Porto_Velho
+ * * `America/Puerto_Rico` - America/Puerto_Rico
+ * * `America/Punta_Arenas` - America/Punta_Arenas
+ * * `America/Rainy_River` - America/Rainy_River
+ * * `America/Rankin_Inlet` - America/Rankin_Inlet
+ * * `America/Recife` - America/Recife
+ * * `America/Regina` - America/Regina
+ * * `America/Resolute` - America/Resolute
+ * * `America/Rio_Branco` - America/Rio_Branco
+ * * `America/Rosario` - America/Rosario
+ * * `America/Santa_Isabel` - America/Santa_Isabel
+ * * `America/Santarem` - America/Santarem
+ * * `America/Santiago` - America/Santiago
+ * * `America/Santo_Domingo` - America/Santo_Domingo
+ * * `America/Sao_Paulo` - America/Sao_Paulo
+ * * `America/Scoresbysund` - America/Scoresbysund
+ * * `America/Shiprock` - America/Shiprock
+ * * `America/Sitka` - America/Sitka
+ * * `America/St_Barthelemy` - America/St_Barthelemy
+ * * `America/St_Johns` - America/St_Johns
+ * * `America/St_Kitts` - America/St_Kitts
+ * * `America/St_Lucia` - America/St_Lucia
+ * * `America/St_Thomas` - America/St_Thomas
+ * * `America/St_Vincent` - America/St_Vincent
+ * * `America/Swift_Current` - America/Swift_Current
+ * * `America/Tegucigalpa` - America/Tegucigalpa
+ * * `America/Thule` - America/Thule
+ * * `America/Thunder_Bay` - America/Thunder_Bay
+ * * `America/Tijuana` - America/Tijuana
+ * * `America/Toronto` - America/Toronto
+ * * `America/Tortola` - America/Tortola
+ * * `America/Vancouver` - America/Vancouver
+ * * `America/Virgin` - America/Virgin
+ * * `America/Whitehorse` - America/Whitehorse
+ * * `America/Winnipeg` - America/Winnipeg
+ * * `America/Yakutat` - America/Yakutat
+ * * `America/Yellowknife` - America/Yellowknife
+ * * `Antarctica/Casey` - Antarctica/Casey
+ * * `Antarctica/Davis` - Antarctica/Davis
+ * * `Antarctica/DumontDUrville` - Antarctica/DumontDUrville
+ * * `Antarctica/Macquarie` - Antarctica/Macquarie
+ * * `Antarctica/Mawson` - Antarctica/Mawson
+ * * `Antarctica/McMurdo` - Antarctica/McMurdo
+ * * `Antarctica/Palmer` - Antarctica/Palmer
+ * * `Antarctica/Rothera` - Antarctica/Rothera
+ * * `Antarctica/South_Pole` - Antarctica/South_Pole
+ * * `Antarctica/Syowa` - Antarctica/Syowa
+ * * `Antarctica/Troll` - Antarctica/Troll
+ * * `Antarctica/Vostok` - Antarctica/Vostok
+ * * `Arctic/Longyearbyen` - Arctic/Longyearbyen
+ * * `Asia/Aden` - Asia/Aden
+ * * `Asia/Almaty` - Asia/Almaty
+ * * `Asia/Amman` - Asia/Amman
+ * * `Asia/Anadyr` - Asia/Anadyr
+ * * `Asia/Aqtau` - Asia/Aqtau
+ * * `Asia/Aqtobe` - Asia/Aqtobe
+ * * `Asia/Ashgabat` - Asia/Ashgabat
+ * * `Asia/Ashkhabad` - Asia/Ashkhabad
+ * * `Asia/Atyrau` - Asia/Atyrau
+ * * `Asia/Baghdad` - Asia/Baghdad
+ * * `Asia/Bahrain` - Asia/Bahrain
+ * * `Asia/Baku` - Asia/Baku
+ * * `Asia/Bangkok` - Asia/Bangkok
+ * * `Asia/Barnaul` - Asia/Barnaul
+ * * `Asia/Beirut` - Asia/Beirut
+ * * `Asia/Bishkek` - Asia/Bishkek
+ * * `Asia/Brunei` - Asia/Brunei
+ * * `Asia/Calcutta` - Asia/Calcutta
+ * * `Asia/Chita` - Asia/Chita
+ * * `Asia/Choibalsan` - Asia/Choibalsan
+ * * `Asia/Chongqing` - Asia/Chongqing
+ * * `Asia/Chungking` - Asia/Chungking
+ * * `Asia/Colombo` - Asia/Colombo
+ * * `Asia/Dacca` - Asia/Dacca
+ * * `Asia/Damascus` - Asia/Damascus
+ * * `Asia/Dhaka` - Asia/Dhaka
+ * * `Asia/Dili` - Asia/Dili
+ * * `Asia/Dubai` - Asia/Dubai
+ * * `Asia/Dushanbe` - Asia/Dushanbe
+ * * `Asia/Famagusta` - Asia/Famagusta
+ * * `Asia/Gaza` - Asia/Gaza
+ * * `Asia/Harbin` - Asia/Harbin
+ * * `Asia/Hebron` - Asia/Hebron
+ * * `Asia/Ho_Chi_Minh` - Asia/Ho_Chi_Minh
+ * * `Asia/Hong_Kong` - Asia/Hong_Kong
+ * * `Asia/Hovd` - Asia/Hovd
+ * * `Asia/Irkutsk` - Asia/Irkutsk
+ * * `Asia/Istanbul` - Asia/Istanbul
+ * * `Asia/Jakarta` - Asia/Jakarta
+ * * `Asia/Jayapura` - Asia/Jayapura
+ * * `Asia/Jerusalem` - Asia/Jerusalem
+ * * `Asia/Kabul` - Asia/Kabul
+ * * `Asia/Kamchatka` - Asia/Kamchatka
+ * * `Asia/Karachi` - Asia/Karachi
+ * * `Asia/Kashgar` - Asia/Kashgar
+ * * `Asia/Kathmandu` - Asia/Kathmandu
+ * * `Asia/Katmandu` - Asia/Katmandu
+ * * `Asia/Khandyga` - Asia/Khandyga
+ * * `Asia/Kolkata` - Asia/Kolkata
+ * * `Asia/Krasnoyarsk` - Asia/Krasnoyarsk
+ * * `Asia/Kuala_Lumpur` - Asia/Kuala_Lumpur
+ * * `Asia/Kuching` - Asia/Kuching
+ * * `Asia/Kuwait` - Asia/Kuwait
+ * * `Asia/Macao` - Asia/Macao
+ * * `Asia/Macau` - Asia/Macau
+ * * `Asia/Magadan` - Asia/Magadan
+ * * `Asia/Makassar` - Asia/Makassar
+ * * `Asia/Manila` - Asia/Manila
+ * * `Asia/Muscat` - Asia/Muscat
+ * * `Asia/Nicosia` - Asia/Nicosia
+ * * `Asia/Novokuznetsk` - Asia/Novokuznetsk
+ * * `Asia/Novosibirsk` - Asia/Novosibirsk
+ * * `Asia/Omsk` - Asia/Omsk
+ * * `Asia/Oral` - Asia/Oral
+ * * `Asia/Phnom_Penh` - Asia/Phnom_Penh
+ * * `Asia/Pontianak` - Asia/Pontianak
+ * * `Asia/Pyongyang` - Asia/Pyongyang
+ * * `Asia/Qatar` - Asia/Qatar
+ * * `Asia/Qostanay` - Asia/Qostanay
+ * * `Asia/Qyzylorda` - Asia/Qyzylorda
+ * * `Asia/Rangoon` - Asia/Rangoon
+ * * `Asia/Riyadh` - Asia/Riyadh
+ * * `Asia/Saigon` - Asia/Saigon
+ * * `Asia/Sakhalin` - Asia/Sakhalin
+ * * `Asia/Samarkand` - Asia/Samarkand
+ * * `Asia/Seoul` - Asia/Seoul
+ * * `Asia/Shanghai` - Asia/Shanghai
+ * * `Asia/Singapore` - Asia/Singapore
+ * * `Asia/Srednekolymsk` - Asia/Srednekolymsk
+ * * `Asia/Taipei` - Asia/Taipei
+ * * `Asia/Tashkent` - Asia/Tashkent
+ * * `Asia/Tbilisi` - Asia/Tbilisi
+ * * `Asia/Tehran` - Asia/Tehran
+ * * `Asia/Tel_Aviv` - Asia/Tel_Aviv
+ * * `Asia/Thimbu` - Asia/Thimbu
+ * * `Asia/Thimphu` - Asia/Thimphu
+ * * `Asia/Tokyo` - Asia/Tokyo
+ * * `Asia/Tomsk` - Asia/Tomsk
+ * * `Asia/Ujung_Pandang` - Asia/Ujung_Pandang
+ * * `Asia/Ulaanbaatar` - Asia/Ulaanbaatar
+ * * `Asia/Ulan_Bator` - Asia/Ulan_Bator
+ * * `Asia/Urumqi` - Asia/Urumqi
+ * * `Asia/Ust-Nera` - Asia/Ust-Nera
+ * * `Asia/Vientiane` - Asia/Vientiane
+ * * `Asia/Vladivostok` - Asia/Vladivostok
+ * * `Asia/Yakutsk` - Asia/Yakutsk
+ * * `Asia/Yangon` - Asia/Yangon
+ * * `Asia/Yekaterinburg` - Asia/Yekaterinburg
+ * * `Asia/Yerevan` - Asia/Yerevan
+ * * `Atlantic/Azores` - Atlantic/Azores
+ * * `Atlantic/Bermuda` - Atlantic/Bermuda
+ * * `Atlantic/Canary` - Atlantic/Canary
+ * * `Atlantic/Cape_Verde` - Atlantic/Cape_Verde
+ * * `Atlantic/Faeroe` - Atlantic/Faeroe
+ * * `Atlantic/Faroe` - Atlantic/Faroe
+ * * `Atlantic/Jan_Mayen` - Atlantic/Jan_Mayen
+ * * `Atlantic/Madeira` - Atlantic/Madeira
+ * * `Atlantic/Reykjavik` - Atlantic/Reykjavik
+ * * `Atlantic/South_Georgia` - Atlantic/South_Georgia
+ * * `Atlantic/St_Helena` - Atlantic/St_Helena
+ * * `Atlantic/Stanley` - Atlantic/Stanley
+ * * `Australia/ACT` - Australia/ACT
+ * * `Australia/Adelaide` - Australia/Adelaide
+ * * `Australia/Brisbane` - Australia/Brisbane
+ * * `Australia/Broken_Hill` - Australia/Broken_Hill
+ * * `Australia/Canberra` - Australia/Canberra
+ * * `Australia/Currie` - Australia/Currie
+ * * `Australia/Darwin` - Australia/Darwin
+ * * `Australia/Eucla` - Australia/Eucla
+ * * `Australia/Hobart` - Australia/Hobart
+ * * `Australia/LHI` - Australia/LHI
+ * * `Australia/Lindeman` - Australia/Lindeman
+ * * `Australia/Lord_Howe` - Australia/Lord_Howe
+ * * `Australia/Melbourne` - Australia/Melbourne
+ * * `Australia/NSW` - Australia/NSW
+ * * `Australia/North` - Australia/North
+ * * `Australia/Perth` - Australia/Perth
+ * * `Australia/Queensland` - Australia/Queensland
+ * * `Australia/South` - Australia/South
+ * * `Australia/Sydney` - Australia/Sydney
+ * * `Australia/Tasmania` - Australia/Tasmania
+ * * `Australia/Victoria` - Australia/Victoria
+ * * `Australia/West` - Australia/West
+ * * `Australia/Yancowinna` - Australia/Yancowinna
+ * * `Brazil/Acre` - Brazil/Acre
+ * * `Brazil/DeNoronha` - Brazil/DeNoronha
+ * * `Brazil/East` - Brazil/East
+ * * `Brazil/West` - Brazil/West
+ * * `CET` - CET
+ * * `CST6CDT` - CST6CDT
+ * * `Canada/Atlantic` - Canada/Atlantic
+ * * `Canada/Central` - Canada/Central
+ * * `Canada/Eastern` - Canada/Eastern
+ * * `Canada/Mountain` - Canada/Mountain
+ * * `Canada/Newfoundland` - Canada/Newfoundland
+ * * `Canada/Pacific` - Canada/Pacific
+ * * `Canada/Saskatchewan` - Canada/Saskatchewan
+ * * `Canada/Yukon` - Canada/Yukon
+ * * `Chile/Continental` - Chile/Continental
+ * * `Chile/EasterIsland` - Chile/EasterIsland
+ * * `Cuba` - Cuba
+ * * `EET` - EET
+ * * `EST` - EST
+ * * `EST5EDT` - EST5EDT
+ * * `Egypt` - Egypt
+ * * `Eire` - Eire
+ * * `Etc/GMT` - Etc/GMT
+ * * `Etc/GMT+0` - Etc/GMT+0
+ * * `Etc/GMT+1` - Etc/GMT+1
+ * * `Etc/GMT+10` - Etc/GMT+10
+ * * `Etc/GMT+11` - Etc/GMT+11
+ * * `Etc/GMT+12` - Etc/GMT+12
+ * * `Etc/GMT+2` - Etc/GMT+2
+ * * `Etc/GMT+3` - Etc/GMT+3
+ * * `Etc/GMT+4` - Etc/GMT+4
+ * * `Etc/GMT+5` - Etc/GMT+5
+ * * `Etc/GMT+6` - Etc/GMT+6
+ * * `Etc/GMT+7` - Etc/GMT+7
+ * * `Etc/GMT+8` - Etc/GMT+8
+ * * `Etc/GMT+9` - Etc/GMT+9
+ * * `Etc/GMT-0` - Etc/GMT-0
+ * * `Etc/GMT-1` - Etc/GMT-1
+ * * `Etc/GMT-10` - Etc/GMT-10
+ * * `Etc/GMT-11` - Etc/GMT-11
+ * * `Etc/GMT-12` - Etc/GMT-12
+ * * `Etc/GMT-13` - Etc/GMT-13
+ * * `Etc/GMT-14` - Etc/GMT-14
+ * * `Etc/GMT-2` - Etc/GMT-2
+ * * `Etc/GMT-3` - Etc/GMT-3
+ * * `Etc/GMT-4` - Etc/GMT-4
+ * * `Etc/GMT-5` - Etc/GMT-5
+ * * `Etc/GMT-6` - Etc/GMT-6
+ * * `Etc/GMT-7` - Etc/GMT-7
+ * * `Etc/GMT-8` - Etc/GMT-8
+ * * `Etc/GMT-9` - Etc/GMT-9
+ * * `Etc/GMT0` - Etc/GMT0
+ * * `Etc/Greenwich` - Etc/Greenwich
+ * * `Etc/UCT` - Etc/UCT
+ * * `Etc/UTC` - Etc/UTC
+ * * `Etc/Universal` - Etc/Universal
+ * * `Etc/Zulu` - Etc/Zulu
+ * * `Europe/Amsterdam` - Europe/Amsterdam
+ * * `Europe/Andorra` - Europe/Andorra
+ * * `Europe/Astrakhan` - Europe/Astrakhan
+ * * `Europe/Athens` - Europe/Athens
+ * * `Europe/Belfast` - Europe/Belfast
+ * * `Europe/Belgrade` - Europe/Belgrade
+ * * `Europe/Berlin` - Europe/Berlin
+ * * `Europe/Bratislava` - Europe/Bratislava
+ * * `Europe/Brussels` - Europe/Brussels
+ * * `Europe/Bucharest` - Europe/Bucharest
+ * * `Europe/Budapest` - Europe/Budapest
+ * * `Europe/Busingen` - Europe/Busingen
+ * * `Europe/Chisinau` - Europe/Chisinau
+ * * `Europe/Copenhagen` - Europe/Copenhagen
+ * * `Europe/Dublin` - Europe/Dublin
+ * * `Europe/Gibraltar` - Europe/Gibraltar
+ * * `Europe/Guernsey` - Europe/Guernsey
+ * * `Europe/Helsinki` - Europe/Helsinki
+ * * `Europe/Isle_of_Man` - Europe/Isle_of_Man
+ * * `Europe/Istanbul` - Europe/Istanbul
+ * * `Europe/Jersey` - Europe/Jersey
+ * * `Europe/Kaliningrad` - Europe/Kaliningrad
+ * * `Europe/Kiev` - Europe/Kiev
+ * * `Europe/Kirov` - Europe/Kirov
+ * * `Europe/Kyiv` - Europe/Kyiv
+ * * `Europe/Lisbon` - Europe/Lisbon
+ * * `Europe/Ljubljana` - Europe/Ljubljana
+ * * `Europe/London` - Europe/London
+ * * `Europe/Luxembourg` - Europe/Luxembourg
+ * * `Europe/Madrid` - Europe/Madrid
+ * * `Europe/Malta` - Europe/Malta
+ * * `Europe/Mariehamn` - Europe/Mariehamn
+ * * `Europe/Minsk` - Europe/Minsk
+ * * `Europe/Monaco` - Europe/Monaco
+ * * `Europe/Moscow` - Europe/Moscow
+ * * `Europe/Nicosia` - Europe/Nicosia
+ * * `Europe/Oslo` - Europe/Oslo
+ * * `Europe/Paris` - Europe/Paris
+ * * `Europe/Podgorica` - Europe/Podgorica
+ * * `Europe/Prague` - Europe/Prague
+ * * `Europe/Riga` - Europe/Riga
+ * * `Europe/Rome` - Europe/Rome
+ * * `Europe/Samara` - Europe/Samara
+ * * `Europe/San_Marino` - Europe/San_Marino
+ * * `Europe/Sarajevo` - Europe/Sarajevo
+ * * `Europe/Saratov` - Europe/Saratov
+ * * `Europe/Simferopol` - Europe/Simferopol
+ * * `Europe/Skopje` - Europe/Skopje
+ * * `Europe/Sofia` - Europe/Sofia
+ * * `Europe/Stockholm` - Europe/Stockholm
+ * * `Europe/Tallinn` - Europe/Tallinn
+ * * `Europe/Tirane` - Europe/Tirane
+ * * `Europe/Tiraspol` - Europe/Tiraspol
+ * * `Europe/Ulyanovsk` - Europe/Ulyanovsk
+ * * `Europe/Uzhgorod` - Europe/Uzhgorod
+ * * `Europe/Vaduz` - Europe/Vaduz
+ * * `Europe/Vatican` - Europe/Vatican
+ * * `Europe/Vienna` - Europe/Vienna
+ * * `Europe/Vilnius` - Europe/Vilnius
+ * * `Europe/Volgograd` - Europe/Volgograd
+ * * `Europe/Warsaw` - Europe/Warsaw
+ * * `Europe/Zagreb` - Europe/Zagreb
+ * * `Europe/Zaporozhye` - Europe/Zaporozhye
+ * * `Europe/Zurich` - Europe/Zurich
+ * * `GB` - GB
+ * * `GB-Eire` - GB-Eire
+ * * `GMT` - GMT
+ * * `GMT+0` - GMT+0
+ * * `GMT-0` - GMT-0
+ * * `GMT0` - GMT0
+ * * `Greenwich` - Greenwich
+ * * `HST` - HST
+ * * `Hongkong` - Hongkong
+ * * `Iceland` - Iceland
+ * * `Indian/Antananarivo` - Indian/Antananarivo
+ * * `Indian/Chagos` - Indian/Chagos
+ * * `Indian/Christmas` - Indian/Christmas
+ * * `Indian/Cocos` - Indian/Cocos
+ * * `Indian/Comoro` - Indian/Comoro
+ * * `Indian/Kerguelen` - Indian/Kerguelen
+ * * `Indian/Mahe` - Indian/Mahe
+ * * `Indian/Maldives` - Indian/Maldives
+ * * `Indian/Mauritius` - Indian/Mauritius
+ * * `Indian/Mayotte` - Indian/Mayotte
+ * * `Indian/Reunion` - Indian/Reunion
+ * * `Iran` - Iran
+ * * `Israel` - Israel
+ * * `Jamaica` - Jamaica
+ * * `Japan` - Japan
+ * * `Kwajalein` - Kwajalein
+ * * `Libya` - Libya
+ * * `MET` - MET
+ * * `MST` - MST
+ * * `MST7MDT` - MST7MDT
+ * * `Mexico/BajaNorte` - Mexico/BajaNorte
+ * * `Mexico/BajaSur` - Mexico/BajaSur
+ * * `Mexico/General` - Mexico/General
+ * * `NZ` - NZ
+ * * `NZ-CHAT` - NZ-CHAT
+ * * `Navajo` - Navajo
+ * * `PRC` - PRC
+ * * `PST8PDT` - PST8PDT
+ * * `Pacific/Apia` - Pacific/Apia
+ * * `Pacific/Auckland` - Pacific/Auckland
+ * * `Pacific/Bougainville` - Pacific/Bougainville
+ * * `Pacific/Chatham` - Pacific/Chatham
+ * * `Pacific/Chuuk` - Pacific/Chuuk
+ * * `Pacific/Easter` - Pacific/Easter
+ * * `Pacific/Efate` - Pacific/Efate
+ * * `Pacific/Enderbury` - Pacific/Enderbury
+ * * `Pacific/Fakaofo` - Pacific/Fakaofo
+ * * `Pacific/Fiji` - Pacific/Fiji
+ * * `Pacific/Funafuti` - Pacific/Funafuti
+ * * `Pacific/Galapagos` - Pacific/Galapagos
+ * * `Pacific/Gambier` - Pacific/Gambier
+ * * `Pacific/Guadalcanal` - Pacific/Guadalcanal
+ * * `Pacific/Guam` - Pacific/Guam
+ * * `Pacific/Honolulu` - Pacific/Honolulu
+ * * `Pacific/Johnston` - Pacific/Johnston
+ * * `Pacific/Kanton` - Pacific/Kanton
+ * * `Pacific/Kiritimati` - Pacific/Kiritimati
+ * * `Pacific/Kosrae` - Pacific/Kosrae
+ * * `Pacific/Kwajalein` - Pacific/Kwajalein
+ * * `Pacific/Majuro` - Pacific/Majuro
+ * * `Pacific/Marquesas` - Pacific/Marquesas
+ * * `Pacific/Midway` - Pacific/Midway
+ * * `Pacific/Nauru` - Pacific/Nauru
+ * * `Pacific/Niue` - Pacific/Niue
+ * * `Pacific/Norfolk` - Pacific/Norfolk
+ * * `Pacific/Noumea` - Pacific/Noumea
+ * * `Pacific/Pago_Pago` - Pacific/Pago_Pago
+ * * `Pacific/Palau` - Pacific/Palau
+ * * `Pacific/Pitcairn` - Pacific/Pitcairn
+ * * `Pacific/Pohnpei` - Pacific/Pohnpei
+ * * `Pacific/Ponape` - Pacific/Ponape
+ * * `Pacific/Port_Moresby` - Pacific/Port_Moresby
+ * * `Pacific/Rarotonga` - Pacific/Rarotonga
+ * * `Pacific/Saipan` - Pacific/Saipan
+ * * `Pacific/Samoa` - Pacific/Samoa
+ * * `Pacific/Tahiti` - Pacific/Tahiti
+ * * `Pacific/Tarawa` - Pacific/Tarawa
+ * * `Pacific/Tongatapu` - Pacific/Tongatapu
+ * * `Pacific/Truk` - Pacific/Truk
+ * * `Pacific/Wake` - Pacific/Wake
+ * * `Pacific/Wallis` - Pacific/Wallis
+ * * `Pacific/Yap` - Pacific/Yap
+ * * `Poland` - Poland
+ * * `Portugal` - Portugal
+ * * `ROC` - ROC
+ * * `ROK` - ROK
+ * * `Singapore` - Singapore
+ * * `Turkey` - Turkey
+ * * `UCT` - UCT
+ * * `US/Alaska` - US/Alaska
+ * * `US/Aleutian` - US/Aleutian
+ * * `US/Arizona` - US/Arizona
+ * * `US/Central` - US/Central
+ * * `US/East-Indiana` - US/East-Indiana
+ * * `US/Eastern` - US/Eastern
+ * * `US/Hawaii` - US/Hawaii
+ * * `US/Indiana-Starke` - US/Indiana-Starke
+ * * `US/Michigan` - US/Michigan
+ * * `US/Mountain` - US/Mountain
+ * * `US/Pacific` - US/Pacific
+ * * `US/Samoa` - US/Samoa
+ * * `UTC` - UTC
+ * * `Universal` - Universal
+ * * `W-SU` - W-SU
+ * * `WET` - WET
+ * * `Zulu` - Zulu */
+ timezone?: string;
+ /** Element attributes that posthog-js should capture as action identifiers (e.g. `['data-attr']`). */
+ data_attributes?: unknown;
+ /**
+ * Ordered list of person properties used to render a human-friendly display name in the UI.
+ * @nullable
+ * @items.maxLength 400
+ */
+ person_display_name_properties?: string[] | null;
+ correlation_config?: unknown;
+ /**
+ * Disables posthog-js autocapture (clicks, page views) when true.
+ * @nullable
+ */
+ autocapture_opt_out?: boolean | null;
+ /**
+ * Enables automatic capture of JavaScript exceptions via the SDK.
+ * @nullable
+ */
+ autocapture_exceptions_opt_in?: boolean | null;
+ /**
+ * Enables automatic capture of Core Web Vitals performance metrics.
+ * @nullable
+ */
+ autocapture_web_vitals_opt_in?: boolean | null;
+ autocapture_web_vitals_allowed_metrics?: unknown;
+ autocapture_exceptions_errors_to_ignore?: unknown;
+ /**
+ * Enables capturing browser console logs alongside session replays.
+ * @nullable
+ */
+ capture_console_log_opt_in?: boolean | null;
+ /**
+ * Enables capturing performance timing and network requests.
+ * @nullable
+ */
+ capture_performance_opt_in?: boolean | null;
+ /** Enables session replay recording for this project. */
+ session_recording_opt_in?: boolean;
+ /**
+ * Fraction of sessions to record, as a decimal string between `0.00` and `1.00` (e.g. `0.1` = 10%).
+ * @nullable
+ * @pattern ^-?\d{0,1}(?:\.\d{0,2})?$
+ */
+ session_recording_sample_rate?: string | null;
+ /**
+ * Skip saving sessions shorter than this many milliseconds.
+ * @minimum 0
+ * @maximum 30000
+ * @nullable
+ */
+ session_recording_minimum_duration_milliseconds?: number | null;
+ session_recording_linked_flag?: unknown;
+ session_recording_network_payload_capture_config?: unknown;
+ session_recording_masking_config?: unknown;
+ /** @nullable */
+ session_recording_url_trigger_config?: unknown[] | null;
+ /** @nullable */
+ session_recording_url_blocklist_config?: unknown[] | null;
+ /** @nullable */
+ session_recording_event_trigger_config?: (string | null)[] | null;
+ /**
+ * @maxLength 24
+ * @nullable
+ */
+ session_recording_trigger_match_type_config?: string | null;
+ /** V2 trigger groups configuration for session recording. If present, takes precedence over legacy trigger fields. */
+ session_recording_trigger_groups?: unknown;
+ /** How long to retain new session recordings. One of `30d`, `90d`, `1y`, or `5y` (availability depends on plan).
+ *
+ * * `30d` - 30 Days
+ * * `90d` - 90 Days
+ * * `1y` - 1 Year
+ * * `5y` - 5 Years */
+ session_recording_retention_period?: SessionRecordingRetentionPeriodEnum;
+ session_replay_config?: unknown;
+ survey_config?: unknown;
+ access_control?: boolean;
+ /** First day of the week for date range filters. 0 = Sunday, 1 = Monday.
+ *
+ * * `0` - Sunday
+ * * `1` - Monday */
+ week_start_day?: WeekStartDayEnum | null;
+ /**
+ * ID of the dashboard shown as the project's default landing dashboard.
+ * @nullable
+ */
+ primary_dashboard?: number | null;
+ /** @nullable */
+ live_events_columns?: string[] | null;
+ /**
+ * Origins permitted to record session replays and heatmaps. Empty list allows all origins.
+ * @nullable
+ * @items.maxLength 200
+ */
+ recording_domains?: (string | null)[] | null;
+ /** @nullable */
+ inject_web_apps?: boolean | null;
+ extra_settings?: unknown;
+ modifiers?: unknown;
+ has_completed_onboarding_for?: unknown;
+ /**
+ * Enables displaying surveys via posthog-js on allowed origins.
+ * @nullable
+ */
+ surveys_opt_in?: boolean | null;
+ /**
+ * Enables heatmap recording on pages that host posthog-js.
+ * @nullable
+ */
+ heatmaps_opt_in?: boolean | null;
+ /**
+ * Default value for the `persist` option on newly created feature flags.
+ * @nullable
+ */
+ flags_persistence_default?: boolean | null;
+ /** @nullable */
+ receive_org_level_activity_logs?: boolean | null;
+ /** Whether this project serves B2B or B2C customers. Used to optimize default UI layouts.
+ *
+ * * `b2b` - B2B
+ * * `b2c` - B2C
+ * * `other` - Other */
+ business_model?: BusinessModelEnum | BlankEnum | null;
+ /**
+ * Enables the customer conversations / live chat product for this project.
+ * @nullable
+ */
+ conversations_enabled?: boolean | null;
+ /**
+ * Settings for Conversations. Must be a JSON object or null.
+ * @nullable
+ */
+ conversations_settings?: ProjectCreateRequestConversationsSettings;
+ logs_settings?: unknown;
+ /** @nullable */
+ proactive_tasks_enabled?: boolean | null;
+ revenue_analytics_config?: TeamRevenueAnalyticsConfig;
+ marketing_analytics_config?: TeamMarketingAnalyticsConfig;
+ customer_analytics_config?: TeamCustomerAnalyticsConfig;
+ workflows_config?: TeamWorkflowsConfig;
+ feature_flag_policy_config?: TeamFeatureFlagPolicyConfig;
+ base_currency?: BaseCurrencyEnum;
+ /**
+ * Enables capturing clicks that had no effect (rage-click detection).
+ * @nullable
+ */
+ capture_dead_clicks?: boolean | null;
+ cookieless_server_hash_mode?: CookielessServerHashModeEnum | null;
+ /** @nullable */
+ human_friendly_comparison_periods?: boolean | null;
+ /** @nullable */
+ feature_flag_confirmation_enabled?: boolean | null;
+ /** @nullable */
+ feature_flag_confirmation_message?: string | null;
+ /**
+ * Whether to automatically apply default evaluation contexts to new feature flags
+ * @nullable
+ */
+ default_evaluation_contexts_enabled?: boolean | null;
+ /**
+ * Whether to require at least one evaluation context tag when creating new feature flags
+ * @nullable
+ */
+ require_evaluation_contexts?: boolean | null;
+ /**
+ * @minimum -2147483648
+ * @maximum 2147483647
+ * @nullable
+ */
+ default_data_theme?: number | null;
+ onboarding_tasks?: unknown;
+ /** @nullable */
+ web_analytics_pre_aggregated_tables_enabled?: boolean | null;
+ }
+
/**
* The compact envelope returned ahead of the verbose `payload`.
*
diff --git a/services/mcp/src/generated/core/api.ts b/services/mcp/src/generated/core/api.ts
index 6fe7ccccf3db..330e59ec940b 100644
--- a/services/mcp/src/generated/core/api.ts
+++ b/services/mcp/src/generated/core/api.ts
@@ -3201,6 +3201,12 @@ export const OrganizationsProjectsPartialUpdateBody = () => zod
.number()
.nullish()
.describe("ID of the dashboard shown as the project's default landing dashboard."),
+ home_tab_dashboard: zod
+ .number()
+ .nullish()
+ .describe(
+ 'ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view.'
+ ),
live_events_columns: zod.array(zod.string()).nullish(),
recording_domains: zod
.array(zod.string().max(organizationsProjectsPartialUpdateBodyRecordingDomainsItemMax).nullable())
diff --git a/services/mcp/src/tools/generated/core.ts b/services/mcp/src/tools/generated/core.ts
index f8b3d1b1b1f4..0d16f3181aa1 100644
--- a/services/mcp/src/tools/generated/core.ts
+++ b/services/mcp/src/tools/generated/core.ts
@@ -858,6 +858,9 @@ const projectSettingsUpdate = (): ToolBase<
if (params.primary_dashboard !== undefined) {
body['primary_dashboard'] = params.primary_dashboard
}
+ if (params.home_tab_dashboard !== undefined) {
+ body['home_tab_dashboard'] = params.home_tab_dashboard
+ }
if (params.live_events_columns !== undefined) {
body['live_events_columns'] = params.live_events_columns
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json
index a0c3d2992ac1..626132ac9548 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json
@@ -448,6 +448,17 @@
],
"description": "Enables heatmap recording on pages that host posthog-js."
},
+ "home_tab_dashboard": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "ID of the dashboard shown on the product analytics Home tab. Null shows the built-in generic view."
+ },
"human_friendly_comparison_periods": {
"anyOf": [
{