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.

fix(insights): add SQL to product analytics sidebar new menu (#63021)

Vasco de Krijger075e0ed8644a
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 7c5250b83c88..cc589dbd8660 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -10,6 +10,7 @@ import type { Params } from 'scenes/sceneTypes'
import { SurveysTabs } from 'scenes/surveys/surveysLogic'
import { urls } from 'scenes/urls'
+import { examples } from '~/queries/examples'
import type { FileSystemImport } from '~/queries/schema/schema-general'
import {
DashboardFilter,
@@ -17,6 +18,7 @@ import {
ExperimentMetric,
FileSystemIconType,
HogQLFilters,
+ HogQLQuery,
HogQLVariable,
Node,
NodeKind,
@@ -1453,6 +1455,15 @@ export const getTreeItemsNew = (): FileSystemImport[] => [
visualOrder: INSIGHT_VISUAL_ORDER.retention,
sceneKeys: ['Insight'],
},
+ {
+ path: `Insight/SQL`,
+ type: 'insight',
+ href: urls.sqlEditor({ query: (examples.HogQLForDataVisualization as HogQLQuery).query }),
+ iconType: 'insight/hog',
+ iconColor: ['var(--color-insight-sql-light)'] as FileSystemIconColor,
+ visualOrder: INSIGHT_VISUAL_ORDER.sql,
+ sceneKeys: ['Insight'],
+ },
{
path: `Insight/Stickiness`,
type: 'insight',
diff --git a/products/product_analytics/manifest.tsx b/products/product_analytics/manifest.tsx
index 9f54a70b53fb..6fc20445fe85 100644
--- a/products/product_analytics/manifest.tsx
+++ b/products/product_analytics/manifest.tsx
@@ -4,9 +4,11 @@ import { AlertType } from 'lib/components/Alerts/types'
import { FEATURE_FLAGS, INSIGHT_VISUAL_ORDER } from 'lib/constants'
import { urls } from 'scenes/urls'
+import { examples } from '~/queries/examples'
import {
DashboardFilter,
HogQLFilters,
+ HogQLQuery,
HogQLVariable,
Node,
NodeKind,
@@ -159,6 +161,15 @@ export const manifest: ProductManifest = {
visualOrder: INSIGHT_VISUAL_ORDER.lifecycle,
sceneKeys: ['Insight'],
},
+ {
+ path: `Insight/SQL`,
+ type: 'insight',
+ href: urls.sqlEditor({ query: (examples.HogQLForDataVisualization as HogQLQuery).query }),
+ iconType: 'insight/hog',
+ iconColor: ['var(--color-insight-sql-light)'] as FileSystemIconColor,
+ visualOrder: INSIGHT_VISUAL_ORDER.sql,
+ sceneKeys: ['Insight'],
+ },
],
treeItemsProducts: [
{