feat: tracking integration with GTM and CMP

This commit is contained in:
Björn Fromme
2026-03-16 12:02:59 +01:00
parent 11ab98b3d8
commit 3957f6bd09
21 changed files with 453 additions and 51 deletions
@@ -55,4 +55,23 @@
</div>
</div>
{% if bookingTotal is not null and travelName is not null %}
<script>
window.dataLayer = window.dataLayer || [];
var consent = (window.CookieFirst && window.CookieFirst.consent) || { advertising: false };
if (consent.advertising) {
dataLayer.push({
'event': 'Transaction',
'userInfo': '{{ is_granted('ROLE_USER') ? 'mitglied' : 'gast' }}',
'transactionId': '{{ bookingNumber }}',
'transactionTotal': {{ bookingTotal }},
'transactionProducts': [{
'name': '{{ travelName|e('js') }}',
'price': {{ bookingTotal }},
'quantity': 1
}]
});
}
</script>
{% endif %}
{% endblock %}