diff --git a/src/components/YandexForm/YandexForm.tsx b/src/components/YandexForm/YandexForm.tsx index 4c5de7732..e39f5c289 100644 --- a/src/components/YandexForm/YandexForm.tsx +++ b/src/components/YandexForm/YandexForm.tsx @@ -102,7 +102,7 @@ const YandexForm = (props: YandexFormProps) => { try { const parsed = JSON.parse(data); const height = parsed['iframe-height']; - const {message, name} = parsed; + const {message, name, redirectUrl} = parsed; if (name !== `form${id}`) { return; } @@ -112,7 +112,10 @@ const YandexForm = (props: YandexFormProps) => { onLoad?.(); } - if (message === 'sent') { + if (message === 'sent' || redirectUrl) { + // event with redirectUrl is comming when form with redirect is used + // otherwise, message: 'sent' is not comming on such sort of forms + // to catch this event and handle analytics redirectUrl is added to condition handleSubmit(); } } catch (error) {