Skip to content

Commit

Permalink
feat(surveys): detect cycles in branching logic (#23062)
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajmajerik authored Jun 19, 2024
1 parent b421c8d commit 2ab8495
Show file tree
Hide file tree
Showing 3 changed files with 575 additions and 2 deletions.
11 changes: 10 additions & 1 deletion frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from 'scenes/insights/sharedUtils'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { EventIndex } from 'scenes/session-recordings/player/eventIndex'
import { SurveyTemplateType } from 'scenes/surveys/constants'
import { NewSurvey, SurveyTemplateType } from 'scenes/surveys/constants'
import { userLogic } from 'scenes/userLogic'

import {
Expand Down Expand Up @@ -511,6 +511,7 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportSurveyResumed: (survey: Survey) => ({ survey }),
reportSurveyArchived: (survey: Survey) => ({ survey }),
reportSurveyTemplateClicked: (template: SurveyTemplateType) => ({ template }),
reportSurveyCycleDetected: (survey: Survey | NewSurvey) => ({ survey }),
reportProductUnsubscribed: (product: string) => ({ product }),
// onboarding
reportOnboardingProductSelected: (
Expand Down Expand Up @@ -1298,6 +1299,14 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
template,
})
},
reportSurveyCycleDetected: ({ survey }) => {
posthog.capture('survey cycle detected', {
name: survey.name,
id: survey.id,
start_date: survey.start_date,
end_date: survey.end_date,
})
},
reportProductUnsubscribed: ({ product }) => {
const property_key = `unsubscribed_from_${product}`
posthog.capture('product unsubscribed', {
Expand Down
Loading

0 comments on commit 2ab8495

Please sign in to comment.