Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(alerts): trigger survey after alert wizard completes (#86756)

Matt Pua2dcd8fa91d65
diff --git a/products/alerts/frontend/logic/alertFormLogic.test.ts b/products/alerts/frontend/logic/alertFormLogic.test.ts
index e3dc2c7b8813..bcd2a3eed520 100644
--- a/products/alerts/frontend/logic/alertFormLogic.test.ts
+++ b/products/alerts/frontend/logic/alertFormLogic.test.ts
@@ -218,6 +218,10 @@ describe('alertFormLogic', () => {
expect(captureSpy).toHaveBeenCalledWith('alert creation completed', {
ui_version: 'redesigned',
})
+ expect(captureSpy).toHaveBeenCalledWith('alert wizard completed', {
+ action: 'created',
+ alert_type: 'insight',
+ })
const toastOptions = successToastSpy.mock.calls[0][1] as { button: { action: () => void } }
toastOptions.button.action()
@@ -320,6 +324,10 @@ describe('alertFormLogic', () => {
expect(updateSpy).toHaveBeenCalledTimes(1)
expect(errorToastSpy).not.toHaveBeenCalled()
expect(successToastSpy).toHaveBeenCalledWith('Alert saved.')
+ expect(captureSpy).toHaveBeenCalledWith('alert wizard completed', {
+ action: 'updated',
+ alert_type: 'insight',
+ })
})
it('blocks save when threshold alert has no lower or upper bound', async () => {
diff --git a/products/alerts/frontend/logic/alertFormLogic.ts b/products/alerts/frontend/logic/alertFormLogic.ts
index ba9bd9b3ace7..4637dd7a809f 100644
--- a/products/alerts/frontend/logic/alertFormLogic.ts
+++ b/products/alerts/frontend/logic/alertFormLogic.ts
@@ -657,6 +657,11 @@ export const alertFormLogic = kea<alertFormLogicType>([
})
}
+ posthog.capture('alert wizard completed', {
+ action: isNewAlert ? 'created' : 'updated',
+ alert_type: 'insight',
+ })
+
// The alert is already persisted — any error from the local side-effects below is a
// client-side bug, not a save failure. Capture it for investigation but don't surface it
// as "Error saving alert" since the API returned 2xx. Regression guarded by `alertFormLogic.test.ts`.