PageSourceSearch

https://www.tor7.de/custom/plugins/DIScoGA4S5/Resources/js/ga4/actions/purchase.action.js

js tor7.de collected 2026-10-02 21:37:57 UTC 1,387 bytes, 52 lines download raw bytes

1import ga4ControllerAction from "../ga4-action.js";
2import DatalayerHelper from "../helpers/datalayer.helper.js";
3import CheckoutAccessHelper from "../helpers/checkout-access.helper.js";
4
5export default class purchaseAction extends ga4ControllerAction {
6
7    trigger() {
8        document.querySelector('button[form="confirm--form"]').addEventListener('click', this._onConfirm.bind(this));
9    }
10
11    _onConfirm() {
12
13        if (!this.actionEnabled) {
14            return;
15        }
16
17        let tosInput = document.querySelector('#sAGB');
18
19        /* check AGB */
20        if (tosInput && tosInput.getAttribute('required') === "required"){
21            if (!tosInput.checked) {
22                return;
23            }
24        }
25
26
27        const checkoutContainer = CheckoutAccessHelper.lineItemsContainer();
28
29        if (!checkoutContainer) {
30            return;
31        }
32
33        let shipping = document.querySelector('.shipping--description').innerText;
34
35        if (shipping) {
36            DatalayerHelper.shippingInfo(checkoutContainer, shipping);
37        }
38
39        let payment = document.querySelector('.payment--description').innerText;
40
41
42        if (payment) {
43            DatalayerHelper.paymentInfo(checkoutContainer, payment);
44        }
45
46        localStorage.setItem("checkoutContainer", checkoutContainer.innerHTML);
47
48        localStorage.setItem("purchaseSent", "no");
49
50    }
51
52}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.