From cdd7fb5765a48bdd08be7a84cda4f56e45792a3f Mon Sep 17 00:00:00 2001 From: Simon Hamery Date: Mon, 12 Aug 2024 16:05:05 +0200 Subject: [PATCH] =?UTF-8?q?Ajoute=20un=20event=20pour=20suivre=20les=20for?= =?UTF-8?q?mulaires=20valid=C3=A9s=20sans=20recontact=20(#4516)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: ajoute un event pour suivre les formulaires validés sans recontact * refactor: recap-email-form event --- lib/enums/event.ts | 1 + src/components/recap-email-and-sms-form.vue | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/enums/event.ts b/lib/enums/event.ts index ab6f04577f..4eef9cd60e 100644 --- a/lib/enums/event.ts +++ b/lib/enums/event.ts @@ -39,6 +39,7 @@ export enum EventAction { FormulaireEmailInvalide = "Invalid email form", FormulaireTelephoneInvalide = "Invalid phone form", FormulaireValideAvecRecontact = "Formulaire validé avec recontact", + FormulaireValideSansRecontact = "Formulaire validé sans recontact", Instructions = CTALabel.Instructions, JeDonneMonAvis = "Je donne mon avis", Link = "link", diff --git a/src/components/recap-email-and-sms-form.vue b/src/components/recap-email-and-sms-form.vue index bc85faeb7a..c9905da0fd 100644 --- a/src/components/recap-email-and-sms-form.vue +++ b/src/components/recap-email-and-sms-form.vue @@ -67,14 +67,17 @@ const sendRecap = async (surveyOptin) => { emailInputErrorMessage.value = true } - const sendOptinSurveyEvent = - surveyOptin && - (!phoneInputErrorMessage.value || !emailInputErrorMessage.value) + const hasInputErrorMessage = + phoneInputErrorMessage.value || emailInputErrorMessage.value + + if (!hasInputErrorMessage) { + const eventAction = surveyOptin + ? EventAction.FormulaireValideAvecRecontact + : EventAction.FormulaireValideSansRecontact - if (sendOptinSurveyEvent) { StatisticsMixin.methods.sendEventToMatomo( EventCategory.Followup, - EventAction.FormulaireValideAvecRecontact, + eventAction, ABTestingService.getValues().CTA_EmailRecontact ) }