Checkout tracking (dataLayer)¶
The checkout pushes events to the GTM dataLayer so GA4 and Meta can show where customers drop off. Tags and triggers live in GTM; the frontend only pushes the events.
All pushes go through app/composables/useCheckoutTracking.ts.
Rules¶
- Event and parameter names are wired to GTM by name. Do not rename them without updating GTM.
- No personal data in any parameter. Only field names, payment types and reasons.
- Works in every market, not only DE.
Payment types¶
Gateway ids are mapped to market-neutral values:
| Gateway | payment_type |
|---|---|
frisbii_paypal | paypal |
frisbii_apple_pay | apple_pay |
frisbii_credit_card | card |
frisbii_google_pay | google_pay |
| anything else | the id without frisbii_ |
Events¶
| Event | When | Parameters | Where |
|---|---|---|---|
checkout_form_start | First focus on a form field, once per page view | – | pages/checkout/index.vue |
checkout_form_error | "Pay" clicked and validation fails (in the browser or the backend) | error_field (first failing field, e.g. postcode) | useCheckout.ts |
add_payment_info | "Pay" clicked, order created, right before the redirect to payment | payment_type | useCheckout.ts |
checkout_payment_method_change | Customer picks a different payment method | from_payment_type, to_payment_type | checkout/payment-gateways |
checkout_coupon_open | Discount code field opened | – | checkout/discount |
checkout_order_summary_open | Order overview opened on mobile ("Bestellübersicht" and "Gesamt") | – | checkout/review/mobile.vue |
checkout_support_click | Click in the support box | channel: phone, chat, whatsapp, email | checkout/support-box |
checkout_payment_page_view | /checkout/pay-order/… shown with something to pay | payment_type | pages/checkout/pay-order |
checkout_payment_error | Payment failed or was abandoned, seen on /checkout/verify/… | payment_type, error_reason | pages/checkout/verify |
Parameters on existing events¶
These events come from the backend (pixel-tracker) through useServerEvent. The frontend adds the parameter to every dataLayer event the server returns for that call:
| Server event | Added parameter |
|---|---|
checkoutStarted (Meta InitiateCheckout) | default_payment_type: the method preselected on load |
checkoutConversion (purchase) | payment_type: the method on the paid order |
default_payment_type is read from the payment list itself, because useCheckout seeds a placeholder before the list has loaded. The checkout event waits up to 3 seconds for the list and is sent without the parameter if it never arrives.
add_payment_info and the redirect¶
The redirect to payment waits for GTM to confirm the event (eventCallback), but never longer than one second. If GTM is blocked, the customer is redirected after that second.
checkout_payment_error¶
/checkout/verify/… is also used for renewals and payment-method updates. To count only checkout payments, add_payment_info stores { orderId, paymentType } in sessionStorage. The verify page only pushes the error when the order id matches, and only once per payment attempt. The entry is cleared when the order is paid.
| Poll result | error_reason |
|---|---|
status canceled | cancelled |
status rejected | declined |
status expired | expired |
| other failed status | failed |
| no final status in time | timeout |
| the poll threw | error |
Testing in the browser¶
Open the checkout with GTM preview, or run this in the console:
In npm run dev every push is also logged as [ANALYTICS] pushEvent.