feat(02-purchase-event-prepayment): move purchase event to przelewy24 pre-payment page

Phase 2 complete:
- buildPurchaseDataLayer() called in przelewy24() controller, payload passed to template
- dataLayer.push added to templates/tickets/przelewy24.php (fires at order commitment)
- dataLayer.push removed from templates/tickets/order-confirm.php
- Captures 100% of orders regardless of user returning from payment gateway

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 22:29:54 +02:00
parent 5bbec72b59
commit 86e712ba4f
9 changed files with 404 additions and 54 deletions

View File

@@ -1,21 +1,3 @@
<?php
$purchaseDataLayerJson = null;
if (is_array($this->purchase_data_layer ?? null)) {
$purchaseDataLayerJson = json_encode(
$this->purchase_data_layer,
JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_INVALID_UTF8_SUBSTITUTE
);
}
?>
<?php if($purchaseDataLayerJson) : ?>
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push(<?= $purchaseDataLayerJson; ?>);
</script>
<?php endif; ?>
<?php if($this->order_successful === true) : ?>
<script type="text/javascript">
$.alert({

View File

@@ -1,3 +1,21 @@
<?php
$purchaseDataLayerJson = null;
if (is_array($this->purchase_data_layer ?? null)) {
$purchaseDataLayerJson = json_encode(
$this->purchase_data_layer,
JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_INVALID_UTF8_SUBSTITUTE
);
}
?>
<?php if($purchaseDataLayerJson) : ?>
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push(<?= $purchaseDataLayerJson; ?>);
</script>
<?php endif; ?>
<?php
$clientData = $this->order;
$merchant_id = $this->settings['p24']['merchant_id'];