From c6643ea85dc062c27291c2226cd987d8f46ccee3 Mon Sep 17 00:00:00 2001 From: Bianca Yang Date: Thu, 2 Nov 2023 16:01:32 -0700 Subject: [PATCH 1/3] capture survey dismissed event --- frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx index c72f44f68cd41..4a0d0b15b9462 100644 --- a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx +++ b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx @@ -3,6 +3,7 @@ import { billingProductLogic } from './billingProductLogic' import { useActions, useValues } from 'kea' import { BillingProductV2Type } from '~/types' import { billingLogic } from './billingLogic' +import posthog from 'posthog-js' export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2Type }): JSX.Element | null => { const { surveyID, surveyResponse } = useValues(billingProductLogic({ product })) @@ -14,6 +15,9 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T { setSurveyID('') + posthog.capture('survey dismissed', { + $survey_id: surveyID, + }) }} width={'max(40vw)'} > @@ -65,6 +69,9 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T status="muted" onClick={() => { setSurveyID('') + posthog.capture('survey dismissed', { + $survey_id: surveyID, + }) }} > Cancel From 27091f3602de7fe2e38b9dd2f435179438bfb554 Mon Sep 17 00:00:00 2001 From: Bianca Yang Date: Thu, 2 Nov 2023 17:42:07 -0700 Subject: [PATCH 2/3] address pr feedback --- .../src/scenes/billing/UnsubscribeSurveyModal.tsx | 13 +++---------- frontend/src/scenes/billing/billingProductLogic.ts | 7 +++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx index 4a0d0b15b9462..1cccc59563e87 100644 --- a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx +++ b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx @@ -3,21 +3,17 @@ import { billingProductLogic } from './billingProductLogic' import { useActions, useValues } from 'kea' import { BillingProductV2Type } from '~/types' import { billingLogic } from './billingLogic' -import posthog from 'posthog-js' export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2Type }): JSX.Element | null => { const { surveyID, surveyResponse } = useValues(billingProductLogic({ product })) - const { setSurveyResponse, setSurveyID, reportSurveySent } = useActions(billingProductLogic({ product })) + const { setSurveyResponse, reportSurveySent, reportSurveyDismissed } = useActions(billingProductLogic({ product })) const { deactivateProduct } = useActions(billingLogic) const textAreaNotEmpty = surveyResponse['$survey_repsonse']?.length > 0 return ( { - setSurveyID('') - posthog.capture('survey dismissed', { - $survey_id: surveyID, - }) + reportSurveyDismissed(surveyID) }} width={'max(40vw)'} > @@ -68,10 +64,7 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T type="tertiary" status="muted" onClick={() => { - setSurveyID('') - posthog.capture('survey dismissed', { - $survey_id: surveyID, - }) + reportSurveyDismissed(surveyID) }} > Cancel diff --git a/frontend/src/scenes/billing/billingProductLogic.ts b/frontend/src/scenes/billing/billingProductLogic.ts index 0b0a7ef4dd358..aeb72f177c5be 100644 --- a/frontend/src/scenes/billing/billingProductLogic.ts +++ b/frontend/src/scenes/billing/billingProductLogic.ts @@ -30,6 +30,7 @@ export const billingProductLogic = kea([ surveyID, surveyResponse, }), + reportSurveyDismissed: (surveyID: string) => ({ surveyID }), setSurveyID: (surveyID: string) => ({ surveyID }), }), reducers({ @@ -208,5 +209,11 @@ export const billingProductLogic = kea([ }) actions.setSurveyID('') }, + reportSurveyDismissed: ({ surveyID }) => { + posthog.capture('survey dismissed', { + $survey_id: surveyID, + }) + actions.setSurveyID('') + }, })), ]) From e3992cc46ecabdec315be65996c2743388daf784 Mon Sep 17 00:00:00 2001 From: Bianca Yang Date: Thu, 2 Nov 2023 18:08:18 -0700 Subject: [PATCH 3/3] close modal after clicking on links --- frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx index 1cccc59563e87..77e0936068b45 100644 --- a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx +++ b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx @@ -34,6 +34,9 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T { + reportSurveyDismissed(surveyID) + }} > reduce your bill @@ -41,6 +44,9 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T { + reportSurveyDismissed(surveyID) + }} > chat with support @@ -51,6 +57,9 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T { + reportSurveyDismissed(surveyID) + }} > join our beta