Skip to content

Commit

Permalink
Add events properties to survey edited too
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanatic committed Jun 17, 2024
1 parent 2dfedd0 commit e242532
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1276,11 +1276,21 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
})
},
reportSurveyEdited: ({ survey }) => {
const questionsWithShuffledOptions = survey.questions.filter((question) => {
return question.hasOwnProperty('shuffleOptions') && (question as MultipleSurveyQuestion).shuffleOptions
})

posthog.capture('survey edited', {
name: survey.name,
id: survey.id,
created_at: survey.created_at,
start_date: survey.start_date,
events_count: survey.conditions?.events?.values.length,
recurring_survey_iteration_count: survey.iteration_count == undefined ? 0 : survey.iteration_count,
recurring_survey_iteration_interval:
survey.iteration_frequency_days == undefined ? 0 : survey.iteration_frequency_days,
shuffle_questions_enabled: !!survey.appearance.shuffleQuestions,
shuffle_question_options_enabled_count: questionsWithShuffledOptions.length,
})
},
reportSurveyTemplateClicked: ({ template }) => {
Expand Down

0 comments on commit e242532

Please sign in to comment.