Check if Matomo Event Tracker is present
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2025-03-23 16:40:11 +01:00
parent 763076ca8b
commit d24a456152
2 changed files with 16 additions and 4 deletions

View File

@ -38,4 +38,8 @@ function onStart() {
g.async=true; g.src=u+'proxy.php'; s.parentNode.insertBefore(g,s);
})();
</script>
{% else %}
<script>
var _paq = undefined;
</script>
{% endif %}

View File

@ -76,7 +76,9 @@ Alpine.data('form', () => ({
}
);
_paq.push(['trackEvent', 'anfrage', 'dateValidated', response.data.result ? 'valid' : 'invalid']);
if (_paq !== undefined) {
_paq.push(['trackEvent', 'anfrage', 'dateValidated', response.data.result ? 'valid' : 'invalid']);
}
tippy('[data-tippy-target]', {
content: response.data.result ? 'Dieser Termin ist voraussichtlich verfügbar' : 'Dieser Termin ist leider nicht buchbar',
@ -107,15 +109,21 @@ Alpine.data('form', () => ({
behaviour: 'smooth',
});
this.sending = false;
_paq.push(['trackEvent', 'anfrage', 'submitted']);
if (_paq !== undefined) {
_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']);
if (_paq !== undefined) {
_paq.push(['trackEvent', 'anfrage', 'submitInternalError']);
}
throw e;
}
const errors = e.response.data['X_WINTER_ERROR_FIELDS'];
_paq.push(['trackEvent', 'anfrage', 'submitValidationFailed']);
if (_paq !== undefined) {
_paq.push(['trackEvent', 'anfrage', 'submitValidationFailed']);
}
Object.keys(errors).forEach((k) => {
errors[k].forEach((msg) => error(msg));
});