From 20d53177d4f9fd28e2391a5940af0a7168fc324c Mon Sep 17 00:00:00 2001 From: philipp lang Date: Thu, 3 Oct 2024 19:47:28 +0200 Subject: [PATCH] Add events --- resources/js/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/js/app.js b/resources/js/app.js index c1a8540..5914d00 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -76,6 +76,8 @@ Alpine.data('form', () => ({ } ); + _paq.push(['trackEvent', 'anfrage', 'dateValidated', 'result', response.data.result]); + tippy('[data-tippy-target]', { content: response.data.result ? 'Dieser Termin ist voraussichtlich verfügbar' : 'Dieser Termin ist leider nicht buchbar', showOnCreate: true, @@ -105,12 +107,15 @@ Alpine.data('form', () => ({ behaviour: 'smooth', }); this.sending = false; + _paq.push(['trackEvent', 'anfrage', 'submitted']); } catch (e) { this.sending = false; if (!e instanceof axios.AxiosError || !e.response || !e.response.data || !e.response.data['X_WINTER_ERROR_FIELDS']) { + _paq.push(['trackEvent', 'anfrage', 'submitInternalError']); throw e; } const errors = e.response.data['X_WINTER_ERROR_FIELDS']; + _paq.push(['trackEvent', 'anfrage', 'submitValidationFailed']); Object.keys(errors).forEach((k) => { errors[k].forEach((msg) => error(msg)); });